Merge pull request #44 from Kingsrook/feature/CE-878-make-the-operations-dashboard

CE-878: updated to allow sublabel to be displayed under label
This commit is contained in:
2024-03-04 14:47:52 -06:00
committed by GitHub

View File

@ -242,7 +242,7 @@ export class Dropdown extends LabelComponent
{
if (this.options[i].id == id)
{
defaultValue = this.options[i]
defaultValue = this.options[i];
args.dropdownData[args.componentIndex] = defaultValue?.id;
}
}
@ -250,7 +250,7 @@ export class Dropdown extends LabelComponent
}
catch (e)
{
console.log(`Error getting default value for dropdown [${this.dropdownName}] from local storage`, e)
console.log(`Error getting default value for dropdown [${this.dropdownName}] from local storage`, e);
}
}
@ -401,7 +401,7 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
// for initial render, put right-components from props into the state variable //
/////////////////////////////////////////////////////////////////////////////////
const stateLabelComponentsRight = [] as LabelComponent[];
// console.log(`${props.widgetMetaData.name} init'ing right-components`);
// console.log(`${props.widgetMetaData.name} initiating right-components`);
if (props.labelAdditionalComponentsRight)
{
props.labelAdditionalComponentsRight.map((component) => stateLabelComponentsRight.push(component));
@ -606,9 +606,17 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
</Typography>
);
let sublabelElement = (
<Box height="20px">
<Typography sx={{position: "relative", top: "-18px"}} variant="caption">
{props.widgetData?.sublabel}
</Typography>
</Box>
);
if (labelToUse && labelToUse != lastSeenLabel)
{
setLastSeenLabel(labelToUse)
setLastSeenLabel(labelToUse);
setUsingLabelAsTitle(props.widgetData.isLabelPageTitle);
}
@ -634,6 +642,7 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
{
needLabelBox &&
<Box display="flex" justifyContent="space-between" alignItems="flex-start" sx={{width: "100%", ...props.labelBoxAdditionalSx}} minHeight={"2.5rem"}>
<Box display="flex" flexDirection="column">
<Box display="flex" alignItems="baseline">
{
hasPermission ?
@ -685,6 +694,12 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
}
{localLabelAdditionalElementsLeft}
</Box>
<Box display="flex">
{
hasPermission && props.widgetData?.sublabel && (sublabelElement)
}
</Box>
</Box>
<Box>
{
hasPermission && (