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",