mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 13:20:43 +00:00
fixed layout, null checks
This commit is contained in:
@ -102,12 +102,18 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit
|
||||
widgetData[i] = await qController.widget(widgetMetaData.name, urlParams);
|
||||
setWidgetData(widgetData);
|
||||
setWidgetCounter(widgetCounter + 1);
|
||||
widgetData[i]["errorLoading"] = false;
|
||||
if(widgetData[i])
|
||||
{
|
||||
widgetData[i]["errorLoading"] = false;
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
widgetData[i]["errorLoading"] = true;
|
||||
if(widgetData[i])
|
||||
{
|
||||
widgetData[i]["errorLoading"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
forceUpdate();
|
||||
@ -121,23 +127,31 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit
|
||||
{
|
||||
const urlParams = getQueryParams(widgetMetaDataList[index], data);
|
||||
setCurrentUrlParams(urlParams);
|
||||
widgetData[index] = {};
|
||||
|
||||
try
|
||||
{
|
||||
widgetData[index] = await qController.widget(widgetMetaDataList[index].name, urlParams);
|
||||
setWidgetCounter(widgetCounter + 1);
|
||||
setWidgetData(widgetData);
|
||||
widgetData[index]["errorLoading"] = false;
|
||||
|
||||
if (widgetData[index])
|
||||
{
|
||||
widgetData[index]["errorLoading"] = false;
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
widgetData[index]["errorLoading"] = true;
|
||||
if (widgetData[index])
|
||||
{
|
||||
widgetData[index]["errorLoading"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
forceUpdate();
|
||||
})();
|
||||
};
|
||||
}
|
||||
|
||||
function getQueryParams(widgetMetaData: QWidgetMetaData, extraParams: string): string
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
|
||||
</Box>
|
||||
{
|
||||
errorLoading ? (
|
||||
<Box p={3} sx={{display: "flex", justifyContent: "center", alignItems: "flex-start"}}>
|
||||
<Box pb={3} sx={{display: "flex", justifyContent: "center", alignItems: "flex-start"}}>
|
||||
<Icon color="error">error</Icon>
|
||||
<Typography sx={{paddingLeft: "4px", textTransform: "revert"}} variant="button">An error occurred loading widget content.</Typography>
|
||||
</Box>
|
||||
|
Reference in New Issue
Block a user