|
@@ -53,7 +53,6 @@ interface ScenarioViewerProps {
|
|
|
id?: string;
|
|
|
expandable?: boolean;
|
|
|
expanded?: boolean;
|
|
|
- defaultExpanded?: boolean;
|
|
|
updateVarName?: string;
|
|
|
defaultScenario?: string;
|
|
|
scenario?: ScenarioFull | Array<ScenarioFull>;
|
|
@@ -233,6 +232,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
const {
|
|
|
id = "",
|
|
|
expandable = true,
|
|
|
+ expanded = true,
|
|
|
showConfig = false,
|
|
|
showCycle = false,
|
|
|
showDelete = true,
|
|
@@ -240,7 +240,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
showPipelines = true,
|
|
|
showSubmit = true,
|
|
|
showSubmitPipelines = true,
|
|
|
- showTags = false,
|
|
|
+ showTags = true,
|
|
|
} = props;
|
|
|
|
|
|
const dispatch = useDispatch();
|
|
@@ -250,7 +250,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
scId,
|
|
|
scPrimary,
|
|
|
scConfig,
|
|
|
- scDate,
|
|
|
+ scCycle,
|
|
|
scLabel,
|
|
|
scTags,
|
|
|
scProperties,
|
|
@@ -275,7 +275,6 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
}, [props.scenario, props.defaultScenario]);
|
|
|
|
|
|
const active = useDynamicProperty(props.active, props.defaultActive, true);
|
|
|
- const expanded = useDynamicProperty(props.expanded, props.defaultExpanded, false);
|
|
|
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
|
|
|
|
|
|
const [deleteDialog, setDeleteDialogOpen] = useState(false);
|
|
@@ -306,8 +305,11 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
});
|
|
|
|
|
|
// userExpanded
|
|
|
- const [userExpanded, setUserExpanded] = useState(false);
|
|
|
- const onExpand = useCallback((e: SyntheticEvent, exp: boolean) => setUserExpanded(exp), []);
|
|
|
+ const [userExpanded, setUserExpanded] = useState(isScenario && expanded);
|
|
|
+ const onExpand = useCallback(
|
|
|
+ (e: SyntheticEvent, expand: boolean) => expandable && setUserExpanded(expand),
|
|
|
+ [expandable]
|
|
|
+ );
|
|
|
|
|
|
// submits
|
|
|
const submitPipeline = useCallback(
|
|
@@ -467,8 +469,8 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
}))
|
|
|
);
|
|
|
setLabel(scLabel);
|
|
|
- isScenario || setUserExpanded(false);
|
|
|
- }, [scTags, scProperties, scLabel, isScenario, showTags, showProperties]);
|
|
|
+ setUserExpanded(expanded && isScenario);
|
|
|
+ }, [scTags, scProperties, scLabel, isScenario, showTags, showProperties, expanded]);
|
|
|
|
|
|
// Refresh on broadcast
|
|
|
useEffect(() => {
|
|
@@ -482,13 +484,13 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
<>
|
|
|
<Box sx={MainBoxSx} id={id} onClick={onFocus} className={className}>
|
|
|
<Accordion
|
|
|
- defaultExpanded={expandable && expanded}
|
|
|
+ defaultExpanded={expanded}
|
|
|
expanded={userExpanded}
|
|
|
onChange={onExpand}
|
|
|
disabled={!isScenario}
|
|
|
>
|
|
|
<AccordionSummary
|
|
|
- expandIcon={<ArrowForwardIosSharp sx={AccordionIconSx} />}
|
|
|
+ expandIcon={expandable ? <ArrowForwardIosSharp sx={AccordionIconSx} /> : null}
|
|
|
sx={AccordionSummarySx}
|
|
|
>
|
|
|
<Grid
|
|
@@ -501,14 +503,13 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
>
|
|
|
<Grid item>
|
|
|
{scLabel}
|
|
|
- {scPrimary && (
|
|
|
- <Chip
|
|
|
+ {scPrimary ? <Chip
|
|
|
color="primary"
|
|
|
label={<FlagOutlined sx={FlagSx} />}
|
|
|
size="small"
|
|
|
sx={ChipSx}
|
|
|
/>
|
|
|
- )}
|
|
|
+ : null}
|
|
|
</Grid>
|
|
|
<Grid item>
|
|
|
{showSubmit ? (
|
|
@@ -544,7 +545,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
<Typography variant="subtitle2">Cycle / Frequency</Typography>
|
|
|
</Grid>
|
|
|
<Grid item xs={8}>
|
|
|
- <Typography variant="subtitle2">{scDate}</Typography>
|
|
|
+ <Typography variant="subtitle2">{scCycle}</Typography>
|
|
|
</Grid>
|
|
|
</Grid>
|
|
|
) : null}
|
|
@@ -667,9 +668,6 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
</Grid>
|
|
|
{showProperties ? (
|
|
|
<>
|
|
|
- <Grid item xs={12} container>
|
|
|
- <Typography variant="h6">Custom Properties</Typography>
|
|
|
- </Grid>
|
|
|
<Grid item xs={12} container rowSpacing={2}>
|
|
|
{properties
|
|
|
? properties.map((property) => {
|
|
@@ -700,7 +698,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
onChange={updatePropertyField}
|
|
|
/>
|
|
|
</Grid>
|
|
|
- <Grid item xs={6}>
|
|
|
+ <Grid item xs={5}>
|
|
|
<TextField
|
|
|
label="Value"
|
|
|
variant="outlined"
|
|
@@ -714,7 +712,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
</Grid>
|
|
|
<Grid
|
|
|
item
|
|
|
- xs={1}
|
|
|
+ xs={2}
|
|
|
container
|
|
|
alignContent="center"
|
|
|
alignItems="center"
|
|
@@ -766,12 +764,12 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
{property.key}
|
|
|
</Typography>
|
|
|
</Grid>
|
|
|
- <Grid item xs={6}>
|
|
|
+ <Grid item xs={5}>
|
|
|
<Typography variant="subtitle2">
|
|
|
{property.value}
|
|
|
</Typography>
|
|
|
</Grid>{" "}
|
|
|
- <Grid item xs={2} />
|
|
|
+ <Grid item xs={3} />
|
|
|
</>
|
|
|
)}
|
|
|
</Grid>
|
|
@@ -801,7 +799,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
disabled={!isScenario}
|
|
|
/>
|
|
|
</Grid>
|
|
|
- <Grid item xs={6}>
|
|
|
+ <Grid item xs={5}>
|
|
|
<TextField
|
|
|
value={newProp.value}
|
|
|
data-name="value"
|
|
@@ -814,7 +812,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
</Grid>
|
|
|
<Grid
|
|
|
item
|
|
|
- xs={1}
|
|
|
+ xs={2}
|
|
|
container
|
|
|
alignContent="center"
|
|
|
alignItems="center"
|
|
@@ -834,10 +832,10 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
|
<Grid item xs={4}>
|
|
|
<Typography variant="subtitle2">New Property Key</Typography>
|
|
|
</Grid>
|
|
|
- <Grid item xs={6}>
|
|
|
+ <Grid item xs={5}>
|
|
|
<Typography variant="subtitle2">Value</Typography>
|
|
|
</Grid>
|
|
|
- <Grid item xs={2} />
|
|
|
+ <Grid item xs={3} />
|
|
|
</>
|
|
|
)}
|
|
|
</Grid>
|