mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
SPRINT-12: added widget meta data
This commit is contained in:
@ -24,6 +24,7 @@ import {QInstance} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QInstan
|
||||
import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData";
|
||||
import {QReportMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QReportMetaData";
|
||||
import {QTableMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QTableMetaData";
|
||||
import {QWidgetMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QWidgetMetaData";
|
||||
import {Icon} from "@mui/material";
|
||||
import Card from "@mui/material/Card";
|
||||
import Divider from "@mui/material/Divider";
|
||||
@ -123,17 +124,16 @@ function AppHome({app}: Props): JSX.Element
|
||||
|
||||
if (app.widgets)
|
||||
{
|
||||
const widgets: any[] = [];
|
||||
for (let i = 0; i < app.widgets.length; i++)
|
||||
///////////////////////////
|
||||
// load widget meta data //
|
||||
///////////////////////////
|
||||
const matchingWidgets: QWidgetMetaData[] = [];
|
||||
app.widgets.forEach((widgetName) =>
|
||||
{
|
||||
widgets[i] = {};
|
||||
setTimeout(async () =>
|
||||
{
|
||||
widgets[i] = await qController.widget(app.widgets[i]);
|
||||
setUpdatedTableCounts(new Date());
|
||||
}, 1);
|
||||
}
|
||||
setWidgets(widgets);
|
||||
const widget = qInstance.widgets.get(widgetName);
|
||||
matchingWidgets.push(widget);
|
||||
});
|
||||
setWidgets(matchingWidgets);
|
||||
}
|
||||
}, [qInstance, location]);
|
||||
|
||||
@ -144,8 +144,6 @@ function AppHome({app}: Props): JSX.Element
|
||||
|
||||
const handleDropdownOnChange = (value: string, index: number) =>
|
||||
{
|
||||
alert(value);
|
||||
|
||||
setTimeout(async () =>
|
||||
{
|
||||
widgets[index] = await qController.widget(app.widgets[index]);
|
||||
@ -158,7 +156,7 @@ function AppHome({app}: Props): JSX.Element
|
||||
<MDBox mt={4}>
|
||||
{app.widgets && (
|
||||
<Grid container spacing={3}>
|
||||
<DashboardWidgets widgetNameList={app.widgets} />
|
||||
<DashboardWidgets widgetMetaDataList={widgets} />
|
||||
</Grid>
|
||||
)}
|
||||
<Grid container spacing={3}>
|
||||
|
@ -20,11 +20,12 @@
|
||||
*/
|
||||
|
||||
import {Check, Pending, RocketLaunch} from "@mui/icons-material";
|
||||
import {StepConnector} from "@mui/material";
|
||||
import {Skeleton, StepConnector} from "@mui/material";
|
||||
import Step from "@mui/material/Step";
|
||||
import StepLabel from "@mui/material/StepLabel";
|
||||
import Stepper from "@mui/material/Stepper";
|
||||
import {withStyles} from "@mui/styles";
|
||||
import React from "react";
|
||||
import {NavLink} from "react-router-dom";
|
||||
import MDBox from "qqq/components/Temporary/MDBox";
|
||||
|
||||
@ -71,12 +72,14 @@ function StepperCard({data}: Props): JSX.Element
|
||||
}
|
||||
})(StepConnector);
|
||||
|
||||
console.log(`data ${JSON.stringify(data)}`);
|
||||
|
||||
return (
|
||||
<Stepper connector={<CustomizedConnector />} activeStep={activeStep} alternativeLabel sx={{paddingBottom: "0px", boxShadow: "none", background: "white"}}>
|
||||
{
|
||||
data && (
|
||||
data && data.steps ? (
|
||||
data.steps.map((step, index) => (
|
||||
<Step key={step.label} sx={{color: "red"}}>
|
||||
<Step key={step.label}>
|
||||
{
|
||||
index < activeStep && (
|
||||
<MDBox>
|
||||
@ -128,6 +131,8 @@ function StepperCard({data}: Props): JSX.Element
|
||||
}
|
||||
</Step>
|
||||
))
|
||||
) : (
|
||||
<Skeleton width="100%" height="80px" />
|
||||
)
|
||||
}
|
||||
</Stepper>
|
||||
|
@ -22,6 +22,7 @@
|
||||
import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData";
|
||||
import {QTableMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QTableMetaData";
|
||||
import {QTableSection} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QTableSection";
|
||||
import {QWidgetMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QWidgetMetaData";
|
||||
import {QRecord} from "@kingsrook/qqq-frontend-core/lib/model/QRecord";
|
||||
import Avatar from "@mui/material/Avatar";
|
||||
import Button from "@mui/material/Button";
|
||||
@ -77,7 +78,7 @@ function ViewContents({id, table}: Props): JSX.Element
|
||||
const [nonT1TableSections, setNonT1TableSections] = useState([] as QTableSection[]);
|
||||
const [tableProcesses, setTableProcesses] = useState([] as QProcessMetaData[]);
|
||||
const [actionsMenu, setActionsMenu] = useState(null);
|
||||
const [widgets, setWidgets] = useState([] as string[]);
|
||||
const [tableWidgets, setTableWidgets] = useState([] as QWidgetMetaData[]);
|
||||
const [searchParams] = useSearchParams();
|
||||
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
||||
|
||||
@ -113,7 +114,17 @@ function ViewContents({id, table}: Props): JSX.Element
|
||||
/////////////////////
|
||||
const record = await qController.get(tableName, id);
|
||||
setRecord(record);
|
||||
setWidgets(tableMetaData.widgets);
|
||||
|
||||
///////////////////////////
|
||||
// load widget meta data //
|
||||
///////////////////////////
|
||||
const matchingWidgets: QWidgetMetaData[] = [];
|
||||
tableMetaData.widgets && tableMetaData.widgets.forEach((widgetName) =>
|
||||
{
|
||||
const widget = metaData.widgets.get(widgetName);
|
||||
matchingWidgets.push(widget);
|
||||
});
|
||||
setTableWidgets(matchingWidgets);
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// define the sections, e.g., for the left-bar //
|
||||
@ -245,7 +256,7 @@ function ViewContents({id, table}: Props): JSX.Element
|
||||
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12} lg={3}>
|
||||
<QRecordSidebar tableSections={tableSections} widgetNames={widgets} />
|
||||
<QRecordSidebar tableSections={tableSections} widgetMetaDataList={tableWidgets} />
|
||||
</Grid>
|
||||
<Grid item xs={12} lg={9}>
|
||||
|
||||
@ -273,7 +284,7 @@ function ViewContents({id, table}: Props): JSX.Element
|
||||
</Grid>
|
||||
</Grid>
|
||||
{tableMetaData && tableMetaData.widgets && record && (
|
||||
<DashboardWidgets widgetNameList={tableMetaData.widgets} entityPrimaryKey={record.values.get(tableMetaData.primaryKeyField)} />
|
||||
<DashboardWidgets widgetMetaDataList={tableWidgets} entityPrimaryKey={record.values.get(tableMetaData.primaryKeyField)} />
|
||||
)}
|
||||
{nonT1TableSections.length > 0 ? nonT1TableSections.map(({
|
||||
iconName, label, name, fieldNames, tier,
|
||||
|
Reference in New Issue
Block a user