|
@@ -106,7 +106,7 @@ interface SequencesRowProps {
|
|
focusName: string;
|
|
focusName: string;
|
|
setFocusName: (name: string) => void;
|
|
setFocusName: (name: string) => void;
|
|
notSubmittableReason: string;
|
|
notSubmittableReason: string;
|
|
- editable: boolean;
|
|
|
|
|
|
+ notEditableReason: string;
|
|
isValid: (sLabel: string, label: string) => boolean;
|
|
isValid: (sLabel: string, label: string) => boolean;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -119,12 +119,12 @@ const tagsAutocompleteSx = {
|
|
maxWidth: "none",
|
|
maxWidth: "none",
|
|
};
|
|
};
|
|
|
|
|
|
-type SequenceFull = [string, string[], string, boolean];
|
|
|
|
|
|
+type SequenceFull = [string, string[], string, string];
|
|
// enum SeFProps {
|
|
// enum SeFProps {
|
|
// label,
|
|
// label,
|
|
// tasks,
|
|
// tasks,
|
|
-// submittable,
|
|
|
|
-// editable,
|
|
|
|
|
|
+// notSubmittableReason,
|
|
|
|
+// notEditablereason,
|
|
// }
|
|
// }
|
|
|
|
|
|
const SequenceRow = ({
|
|
const SequenceRow = ({
|
|
@@ -141,7 +141,7 @@ const SequenceRow = ({
|
|
focusName,
|
|
focusName,
|
|
setFocusName,
|
|
setFocusName,
|
|
notSubmittableReason,
|
|
notSubmittableReason,
|
|
- editable,
|
|
|
|
|
|
+ notEditableReason,
|
|
isValid,
|
|
isValid,
|
|
}: SequencesRowProps) => {
|
|
}: SequencesRowProps) => {
|
|
const [label, setLabel] = useState("");
|
|
const [label, setLabel] = useState("");
|
|
@@ -202,7 +202,7 @@ const SequenceRow = ({
|
|
|
|
|
|
return (
|
|
return (
|
|
<Grid item xs={12} container justifyContent="space-between" data-focus={name} onClick={onFocus} sx={hoverSx}>
|
|
<Grid item xs={12} container justifyContent="space-between" data-focus={name} onClick={onFocus} sx={hoverSx}>
|
|
- {active && editable && focusName === name ? (
|
|
|
|
|
|
+ {active && !notEditableReason && focusName === name ? (
|
|
<>
|
|
<>
|
|
<Grid item xs={4}>
|
|
<Grid item xs={4}>
|
|
<TextField
|
|
<TextField
|
|
@@ -324,11 +324,11 @@ const invalidScenario: ScenarioFull = [
|
|
[],
|
|
[],
|
|
{},
|
|
{},
|
|
[],
|
|
[],
|
|
- false,
|
|
|
|
- false,
|
|
|
|
"invalid",
|
|
"invalid",
|
|
- false,
|
|
|
|
- false,
|
|
|
|
|
|
+ "invalid",
|
|
|
|
+ "invalid",
|
|
|
|
+ "invalid",
|
|
|
|
+ "invalid",
|
|
];
|
|
];
|
|
|
|
|
|
const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
@@ -390,11 +390,11 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
scDeletable,
|
|
scDeletable,
|
|
scPromotable,
|
|
scPromotable,
|
|
scNotSubmittableReason,
|
|
scNotSubmittableReason,
|
|
- scReadable,
|
|
|
|
- scEditable,
|
|
|
|
|
|
+ scNotReadableReason,
|
|
|
|
+ scNotEditableReason,
|
|
] = scenario || invalidScenario;
|
|
] = scenario || invalidScenario;
|
|
|
|
|
|
- const active = useDynamicProperty(props.active, props.defaultActive, true) && scReadable;
|
|
|
|
|
|
+ const active = useDynamicProperty(props.active, props.defaultActive, true) && !scNotReadableReason;
|
|
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
|
|
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
|
|
|
|
|
|
const [deleteDialog, setDeleteDialogOpen] = useState(false);
|
|
const [deleteDialog, setDeleteDialogOpen] = useState(false);
|
|
@@ -595,7 +595,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
[sequences]
|
|
[sequences]
|
|
);
|
|
);
|
|
|
|
|
|
- const addSequenceHandler = useCallback(() => setSequences((seq) => [...seq, ["", [], "", true]]), []);
|
|
|
|
|
|
+ const addSequenceHandler = useCallback(() => setSequences((seq) => [...seq, ["", [], "", ""]]), []);
|
|
|
|
|
|
// on scenario change
|
|
// on scenario change
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -714,7 +714,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
onClick={onFocus}
|
|
onClick={onFocus}
|
|
sx={hoverSx}
|
|
sx={hoverSx}
|
|
>
|
|
>
|
|
- {active && scEditable && focusName === "label" ? (
|
|
|
|
|
|
+ {active && !scNotEditableReason && focusName === "label" ? (
|
|
<TextField
|
|
<TextField
|
|
label="Label"
|
|
label="Label"
|
|
variant="outlined"
|
|
variant="outlined"
|
|
@@ -770,7 +770,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
onClick={onFocus}
|
|
onClick={onFocus}
|
|
sx={hoverSx}
|
|
sx={hoverSx}
|
|
>
|
|
>
|
|
- {active && scEditable && focusName === "tags" ? (
|
|
|
|
|
|
+ {active && !scNotEditableReason && focusName === "tags" ? (
|
|
<Autocomplete
|
|
<Autocomplete
|
|
multiple
|
|
multiple
|
|
options={scAuthorizedTags}
|
|
options={scAuthorizedTags}
|
|
@@ -857,7 +857,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
setFocusName={setFocusName}
|
|
setFocusName={setFocusName}
|
|
onFocus={onFocus}
|
|
onFocus={onFocus}
|
|
onEdit={props.onEdit}
|
|
onEdit={props.onEdit}
|
|
- editable={scEditable}
|
|
|
|
|
|
+ notEditableReason={scNotEditableReason}
|
|
updatePropVars={updateScVars}
|
|
updatePropVars={updateScVars}
|
|
/>
|
|
/>
|
|
{showSequences ? (
|
|
{showSequences ? (
|
|
@@ -874,7 +874,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
</Grid>
|
|
</Grid>
|
|
|
|
|
|
{sequences.map((item, index) => {
|
|
{sequences.map((item, index) => {
|
|
- const [label, taskIds, notSubmittableReason, editable] = item;
|
|
|
|
|
|
+ const [label, taskIds, notSubmittableReason, notEditableReason] = item;
|
|
return (
|
|
return (
|
|
<SequenceRow
|
|
<SequenceRow
|
|
active={active}
|
|
active={active}
|
|
@@ -891,7 +891,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
|
|
focusName={focusName}
|
|
focusName={focusName}
|
|
setFocusName={setFocusName}
|
|
setFocusName={setFocusName}
|
|
notSubmittableReason={notSubmittableReason}
|
|
notSubmittableReason={notSubmittableReason}
|
|
- editable={editable}
|
|
|
|
|
|
+ notEditableReason={notEditableReason}
|
|
isValid={isValidSequence}
|
|
isValid={isValidSequence}
|
|
/>
|
|
/>
|
|
);
|
|
);
|