Skip to content

Commit

Permalink
🐛 Disable add button when file with error is present (#799)
Browse files Browse the repository at this point in the history
- Fixes https://issues.redhat.com/browse/MTA-443
- Clears error alert when no files with error state exist after removal

Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 authored Apr 5, 2023
1 parent d213437 commit 9827d14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client/src/app/common/CustomRules/useRuleFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ export default function useRuleFiles(
)
);
setRuleFiles(updatedRuleFilesList);
if (!updatedRuleFilesList.some((file) => file.loadResult === "danger")) {
setUploadError("");
}
if (methods) {
methods.setValue(
"customRulesFiles",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ export const CustomRules: React.FC<CustomRulesProps> = (props) => {
key="add"
variant="primary"
isDisabled={
!ruleFiles.find((file) => file.loadResult === "success")
!ruleFiles.find((file) => file.loadResult === "success") ||
ruleFiles.some((file) => file.loadResult === "danger")
}
onClick={(event) => {
let hasExistingRuleFile = null;
Expand Down

0 comments on commit 9827d14

Please sign in to comment.