From 205856932da8690c4db5c08be4aa612e8eab3aa1 Mon Sep 17 00:00:00 2001 From: ibolton336 Date: Tue, 2 Jan 2024 19:07:10 -0500 Subject: [PATCH] :bug: Allow wizard to proceed with an empty custom target 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",