Skip to content

Commit

Permalink
🐛 Allow wizard to proceed with an empty custom target
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Jan 3, 2024
1 parent d5c186a commit 2058569
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const CustomRules: React.FC = () => {
</Title>
<Text> {t("wizard.label.customRules")}</Text>
</TextContent>
{values.formLabels.length === 0 &&
{values.selectedTargets.length === 0 &&
values.customRulesFiles.length === 0 &&
!values.sourceRepository && (
<Alert
Expand Down
12 changes: 8 additions & 4 deletions client/src/app/pages/applications/analysis-wizard/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,14 @@ const useCustomRulesStepSchema = (): yup.SchemaOf<CustomRulesStepValues> => {
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<string>().when("rulesKind", {
is: "repository",
Expand Down

0 comments on commit 2058569

Please sign in to comment.