mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-19 05:40:44 +00:00
SPRINT-17: added tablename in widgets
This commit is contained in:
32
src/qqq/pages/dashboards/Widgets/Data/Divider.tsx
Normal file
32
src/qqq/pages/dashboards/Widgets/Data/Divider.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import Divider from "@mui/material/Divider";
|
||||
|
||||
|
||||
function DividerWidget(): JSX.Element
|
||||
{
|
||||
return (
|
||||
<Divider sx={{padding: "1px", background: "red"}}/>
|
||||
);
|
||||
}
|
||||
|
||||
export default DividerWidget;
|
@ -38,7 +38,7 @@ const options = {
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false,
|
||||
display: true,
|
||||
},
|
||||
tooltip: {
|
||||
enabled: true,
|
||||
|
@ -42,6 +42,7 @@ export interface ParentWidgetData
|
||||
label: string
|
||||
}[][];
|
||||
childWidgetNameList: string[];
|
||||
dropdownNeedsSelectedText?: string;
|
||||
}
|
||||
|
||||
|
||||
@ -55,11 +56,12 @@ interface Props
|
||||
data: ParentWidgetData;
|
||||
reloadWidgetCallback?: (widgetIndex: number, params: string) => void;
|
||||
entityPrimaryKey?: string;
|
||||
tableName?: string;
|
||||
}
|
||||
|
||||
|
||||
const qController = QClient.getInstance();
|
||||
function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPrimaryKey}: Props, ): JSX.Element
|
||||
function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPrimaryKey, tableName}: Props, ): JSX.Element
|
||||
{
|
||||
const [childUrlParams, setChildUrlParams] = useState("");
|
||||
const [qInstance, setQInstance] = useState(null as QInstance);
|
||||
@ -86,15 +88,9 @@ function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPri
|
||||
widgetMetaDataList.push(qInstance.widgets.get(widgetName));
|
||||
})
|
||||
setWidgets(widgetMetaDataList);
|
||||
console.log(`SETTINGWIDGETS...${widgetMetaDataList.length}`)
|
||||
}
|
||||
}, [qInstance, data]);
|
||||
|
||||
function doit()
|
||||
{
|
||||
reloadWidgetCallback(0, "ok");
|
||||
}
|
||||
|
||||
function handleDataChange(dropdownLabel: string, changedData: any)
|
||||
{
|
||||
if(dropdownData)
|
||||
@ -128,8 +124,6 @@ function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPri
|
||||
{
|
||||
if(dropdownData)
|
||||
{
|
||||
console.log(JSON.stringify(data));
|
||||
|
||||
let params = "";
|
||||
for (let i = 0; i < dropdownData.length; i++)
|
||||
{
|
||||
@ -144,7 +138,6 @@ function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPri
|
||||
|
||||
}
|
||||
}
|
||||
console.log(params);
|
||||
reloadWidgetCallback(widgetIndex, params);
|
||||
setChildUrlParams(params)
|
||||
}
|
||||
@ -173,7 +166,7 @@ function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPri
|
||||
<DropdownMenu
|
||||
key={`dropdown-${data.dropdownLabelList[index]}-${index}`}
|
||||
label={`Select ${data.dropdownLabelList[index]}`}
|
||||
sx={{width: 200, marginLeft: "15px", float: "right"}}
|
||||
sx={{width: 250, marginLeft: "15px", float: "right"}}
|
||||
dropdownOptions={dropdownData}
|
||||
onChangeCallback={handleDataChange}
|
||||
/>
|
||||
@ -183,7 +176,17 @@ function ParentWidget({widgetIndex, label, data, reloadWidgetCallback, entityPri
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Box pr={3} pl={3}>
|
||||
<DashboardWidgets widgetMetaDataList={widgets} entityPrimaryKey={entityPrimaryKey} childUrlParams={childUrlParams} areChildren={true}/>
|
||||
{
|
||||
data?.dropdownNeedsSelectedText ? (
|
||||
<Box pb={3} sx={{width: "100%", textAlign: "right"}}>
|
||||
<Typography variant="body2">
|
||||
{data.dropdownNeedsSelectedText}
|
||||
</Typography>
|
||||
</Box>
|
||||
) :(
|
||||
<DashboardWidgets widgetMetaDataList={widgets} entityPrimaryKey={entityPrimaryKey} tableName={tableName} childUrlParams={childUrlParams} areChildren={true}/>
|
||||
)
|
||||
}
|
||||
</Box>
|
||||
</Card>
|
||||
);
|
||||
|
@ -316,7 +316,7 @@ function EntityView({table, launchProcess}: Props): JSX.Element
|
||||
sectionFieldElements.set(section.name,
|
||||
<Grid id={section.name} key={section.name} item lg={widgetMetaData.gridColumns ? widgetMetaData.gridColumns : 12} xs={12} sx={{display: "flex", alignItems: "stretch", flexGrow: 1, scrollMarginTop: "100px"}}>
|
||||
<Box width="100%" flexGrow={1} alignItems="stretch">
|
||||
<DashboardWidgets key={section.name} widgetMetaDataList={[widgetMetaData]} entityPrimaryKey={record.values.get(tableMetaData.primaryKeyField)} omitWrappingGridContainer={true} />
|
||||
<DashboardWidgets key={section.name} tableName={tableMetaData.name} widgetMetaDataList={[widgetMetaData]} entityPrimaryKey={record.values.get(tableMetaData.primaryKeyField)} omitWrappingGridContainer={true} />
|
||||
</Box>
|
||||
</Grid>
|
||||
);
|
||||
|
Reference in New Issue
Block a user