Skip to content

Commit

Permalink
Removed prob rate in edit menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasmadei authored and blcham committed Jun 26, 2024
1 parent 571a071 commit 16d367a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/components/dialog/faultEvent/FaultEventCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ interface Props {
eventValue?: FaultEvent;
isEditedEvent?: boolean;
disabled?: boolean;
isSimplified?: boolean;
}

// TODO: remove ts-ignores and migrate to higher version of react-hook-form
const FaultEventCreation = ({ useFormMethods, isRootEvent, eventValue, isEditedEvent = false, disabled }: Props) => {
const FaultEventCreation = ({
useFormMethods,
isRootEvent,
eventValue,
isEditedEvent = false,
disabled,
isSimplified, // Hides props that are needed only for creation
}: Props) => {
const { classes } = useStyles();
const { t } = useTranslation();

Expand Down Expand Up @@ -181,18 +189,20 @@ const FaultEventCreation = ({ useFormMethods, isRootEvent, eventValue, isEditedE
/>

{/* Probability field */}
<TextField
label={t("newFtaModal.probability")}
type="number"
min={0}
max={1}
step={0.01}
error={!!errors.probability}
helperText={errors.probability?.message}
className={classes.probability}
defaultValue=""
{...register("probability")}
/>
{!isSimplified && eventTypeWatch === EventType.BASIC && (
<TextField
label={t("newFtaModal.probability")}
type="number"
min={0}
max={1}
step={0.01}
error={!!errors.probability}
helperText={errors.probability?.message}
className={classes.probability}
defaultValue=""
{...register("probability")}
/>
)}

{(gateTypeWatch === GateType.PRIORITY_AND || !gateTypeWatch) &&
eventTypeWatch === EventType.INTERMEDIATE &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const FaultEventShapeToolPane = ({ data, onEventUpdated, refreshTree }: Props) =
eventValue={data}
isEditedEvent={true}
disabled={data ? data.eventType === EventType.INTERMEDIATE || data.isReference : false}
isSimplified={true}
/>
</ReusableFaultEventsProvider>
);
Expand Down

0 comments on commit 16d367a

Please sign in to comment.