From b21de21bc826caf8b9671bbe837d26104944cd97 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Tue, 2 Jan 2024 19:36:34 -0500 Subject: [PATCH] :bug: Allow wizard to proceed with an empty custom target (#1649) - Update custom rules step validation to allow custom targets with no labels when using rules from a repo. Signed-off-by: ibolton336 --- .../applications/analysis-wizard/custom-rules.tsx | 2 +- .../app/pages/applications/analysis-wizard/schema.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx b/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx index 6f268ed1bf..24508ac368 100644 --- a/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx +++ b/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx @@ -222,7 +222,7 @@ export const CustomRules: React.FC = () => { {t("wizard.label.customRules")} - {values.formLabels.length === 0 && + {values.selectedTargets.length === 0 && values.customRulesFiles.length === 0 && !values.sourceRepository && ( => { then: yup.array().of(customRulesFilesSchema), otherwise: (schema) => schema, }) - .when(["formLabels", "rulesKind"], { - is: (labels: TargetLabel[], rulesKind: string) => - labels.length === 0 && rulesKind === "manual", - then: (schema) => schema.min(1, "At least 1 Rule File is required"), // TODO translation here + .when(["formLabels", "rulesKind", "selectedTargets"], { + is: ( + labels: TargetLabel[], + rulesKind: string, + selectedTargets: number + ) => + labels.length === 0 && rulesKind === "manual" && selectedTargets <= 0, + then: (schema) => schema.min(1, "At least 1 Rule File is required"), }), repositoryType: yup.mixed().when("rulesKind", { is: "repository",