|
@@ -28,6 +28,7 @@ import InputLabel from "@mui/material/InputLabel";
|
|
|
import MenuItem from "@mui/material/MenuItem";
|
|
|
import Dialog from "@mui/material/Dialog";
|
|
|
import Select from "@mui/material/Select";
|
|
|
+import Stack from "@mui/material/Stack";
|
|
|
import TextField from "@mui/material/TextField";
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
import { Close, DeleteOutline, Add, EditOutlined } from "@mui/icons-material";
|
|
@@ -107,7 +108,7 @@ const emptyScenario: ScenarioDict = {
|
|
|
properties: [],
|
|
|
};
|
|
|
|
|
|
-const ActionContentSx = { mr: 2, ml: 2 };
|
|
|
+const ActionContentSx = { mr: 2, ml: 2, width: "100%" };
|
|
|
|
|
|
const DialogContentSx = {
|
|
|
maxHeight: "calc(100vh - 256px)",
|
|
@@ -126,10 +127,6 @@ const SquareButtonSx = {
|
|
|
aspectRatio: "1",
|
|
|
};
|
|
|
|
|
|
-const CancelBtnSx = {
|
|
|
- mr: 2,
|
|
|
-};
|
|
|
-
|
|
|
const IconButtonSx = {
|
|
|
p: 0,
|
|
|
};
|
|
@@ -370,36 +367,28 @@ const ScenarioEditDialog = ({ scenario, submit, open, actionEdit, configs, close
|
|
|
</DialogContent>
|
|
|
|
|
|
<DialogActions>
|
|
|
- <Grid container justifyContent="space-between" sx={ActionContentSx}>
|
|
|
+ <Stack direction="row" justifyContent="space-between" sx={ActionContentSx}>
|
|
|
{actionEdit && (
|
|
|
- <Grid size={6}>
|
|
|
- <Button
|
|
|
- variant="outlined"
|
|
|
- color="error"
|
|
|
- onClick={onConfirmDialogOpen}
|
|
|
- disabled={!scenario || !scenario[ScFProps.deletable]}
|
|
|
- >
|
|
|
- Delete
|
|
|
- </Button>
|
|
|
- </Grid>
|
|
|
+ <Button
|
|
|
+ variant="outlined"
|
|
|
+ color="error"
|
|
|
+ onClick={onConfirmDialogOpen}
|
|
|
+ disabled={!scenario || !scenario[ScFProps.deletable]}
|
|
|
+ >
|
|
|
+ Delete
|
|
|
+ </Button>
|
|
|
)}
|
|
|
- <Grid container size={actionEdit ? 6 : 12} justifyContent="flex-end">
|
|
|
- <Grid sx={CancelBtnSx}>
|
|
|
- <Button variant="outlined" color="inherit" onClick={close}>
|
|
|
- Cancel
|
|
|
- </Button>
|
|
|
- </Grid>
|
|
|
- <Grid>
|
|
|
- <Button
|
|
|
- variant="contained"
|
|
|
- type="submit"
|
|
|
- disabled={!form.values.config || !form.values.name}
|
|
|
- >
|
|
|
- {actionEdit ? "Apply" : "Create"}
|
|
|
- </Button>
|
|
|
- </Grid>
|
|
|
- </Grid>
|
|
|
- </Grid>
|
|
|
+ <Button variant="outlined" color="inherit" onClick={close}>
|
|
|
+ Cancel
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ variant="contained"
|
|
|
+ type="submit"
|
|
|
+ disabled={!form.values.config || !form.values.name}
|
|
|
+ >
|
|
|
+ {actionEdit ? "Apply" : "Create"}
|
|
|
+ </Button>
|
|
|
+ </Stack>
|
|
|
</DialogActions>
|
|
|
</form>
|
|
|
</Dialog>
|
|
@@ -489,18 +478,18 @@ const ScenarioSelector = (props: ScenarioSelectorProps) => {
|
|
|
const openEditDialog = useCallback(
|
|
|
(e: React.MouseEvent<HTMLElement>) => {
|
|
|
e.stopPropagation();
|
|
|
- const { id: scenId } = e.currentTarget?.dataset || {};
|
|
|
+ const { id: scId } = e.currentTarget?.dataset || {};
|
|
|
const varName = getUpdateVar(updateScVars, "sc_id");
|
|
|
- scenId &&
|
|
|
+ scId &&
|
|
|
props.onScenarioSelect &&
|
|
|
- dispatch(createSendActionNameAction(props.id, module, props.onScenarioSelect, varName, scenId));
|
|
|
+ dispatch(createSendActionNameAction(props.id, module, props.onScenarioSelect, varName, scId));
|
|
|
setOpen(true);
|
|
|
setActionEdit(true);
|
|
|
},
|
|
|
[props.onScenarioSelect, props.id, dispatch, module, updateScVars]
|
|
|
);
|
|
|
|
|
|
- const EditScenario = useCallback(
|
|
|
+ const editScenario = useCallback(
|
|
|
(props: EditProps) => (
|
|
|
<Tooltip title={props.active ? "Edit Scenario" : "Can't edit Scenario"}>
|
|
|
<span>
|
|
@@ -508,7 +497,7 @@ const ScenarioSelector = (props: ScenarioSelectorProps) => {
|
|
|
data-id={props.id}
|
|
|
onClick={openEditDialog}
|
|
|
sx={tinyEditIconButtonSx}
|
|
|
- disabled={props.active}
|
|
|
+ disabled={!props.active}
|
|
|
>
|
|
|
<EditOutlined />
|
|
|
</IconButton>
|
|
@@ -526,7 +515,7 @@ const ScenarioSelector = (props: ScenarioSelectorProps) => {
|
|
|
entities={props.innerScenarios}
|
|
|
leafType={NodeType.SCENARIO}
|
|
|
lovPropertyName="innerScenarios"
|
|
|
- editComponent={EditScenario}
|
|
|
+ editComponent={editScenario}
|
|
|
showPins={showPins}
|
|
|
multiple={multiple}
|
|
|
updateCoreVars={updateScVars}
|