Skip to content

Commit

Permalink
fix(rbac): do not disable already selected rule for allOf/anyOf (#1739)
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshiGupta authored May 30, 2024
1 parent c0f4de9 commit dc73650
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ export const ConditionsFormRow = ({
criteria={criteria}
conditionRulesData={conditionRulesData}
setErrors={setErrors}
optionDisabled={ruleOption =>
ruleOptionDisabled(ruleOption, conditionRow.allOf)
}
setRemoveAllClicked={setRemoveAllClicked}
/>
<IconButton
Expand Down Expand Up @@ -194,9 +191,6 @@ export const ConditionsFormRow = ({
criteria={criteria}
conditionRulesData={conditionRulesData}
setErrors={setErrors}
optionDisabled={ruleOption =>
ruleOptionDisabled(ruleOption, conditionRow.anyOf)
}
setRemoveAllClicked={setRemoveAllClicked}
/>
<IconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ConditionFormRowFieldsProps = {
conditionRow: ConditionsData;
conditionRulesData?: RulesData;
setErrors: React.Dispatch<React.SetStateAction<RuleParamsErrors | undefined>>;
optionDisabled: (ruleOption: string) => boolean;
optionDisabled?: (ruleOption: string) => boolean;
setRemoveAllClicked: React.Dispatch<React.SetStateAction<boolean>>;
};

Expand Down Expand Up @@ -96,7 +96,9 @@ export const ConditionsFormRowFields = ({
style={{ marginTop: '27px', width: '50%' }}
options={rules ?? []}
value={oldCondition?.rule || null}
getOptionDisabled={option => optionDisabled(option)}
getOptionDisabled={option =>
optionDisabled ? optionDisabled(option) : false
}
onChange={(_event, ruleVal?: string | null) =>
handleConditionChange({
...oldCondition,
Expand Down

0 comments on commit dc73650

Please sign in to comment.