Skip to content

Commit

Permalink
Merge branch 'main' into mta-1893-2
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Jan 3, 2024
2 parents aa79151 + b21de21 commit 9720248
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export const AnalysisWizard: React.FC<IAnalysisWizard> = ({

const { mode, withKnownLibs, hasExcludedPackages } = values;
const hasIncludedPackages = withKnownLibs.includes("select");

const setupTaskgroup = (
currentTaskgroup: Taskgroup,
fieldValues: AnalysisWizardFormValues
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export const CustomTargetForm: React.FC<CustomTargetFormProps> = ({
description: formValues?.description?.trim() || "",
...(formValues.imageID && { image: { id: formValues.imageID } }),
custom: true,
labels: labels.length ? labels : [{ name: "custom", label: "custom" }],
labels: labels.length ? labels : [],
ruleset: {
id: target && target.custom ? target.ruleset.id : undefined,
name: formValues.name.trim(),
Expand Down

0 comments on commit 9720248

Please sign in to comment.