diff --git a/client/src/app/pages/applications/analysis-wizard/analysis-wizard.tsx b/client/src/app/pages/applications/analysis-wizard/analysis-wizard.tsx index 96befc64e..6461c4391 100644 --- a/client/src/app/pages/applications/analysis-wizard/analysis-wizard.tsx +++ b/client/src/app/pages/applications/analysis-wizard/analysis-wizard.tsx @@ -60,7 +60,22 @@ const determineMode = ( | "binary-upload" | undefined => { if (applications.length === 0) return undefined; + + const modes = Array.from( + new Set( + applications.map((app) => { + const { repository, binary } = app; + return repository || (repository && binary) + ? "source-code-deps" + : binary && binary !== "" + ? "binary" + : undefined; + }) + ) + ); + return modes.length === 1 ? modes[0] : undefined; }; + const defaultTaskData: TaskData = { tagger: { enabled: true, @@ -173,7 +188,7 @@ export const AnalysisWizard: React.FC = ({ const methods = useForm({ defaultValues: { artifact: null, - mode: determineMode(applications), + mode: determineMode(applications) ?? "source-code-deps", formLabels: [], selectedTargets: [], // defaults will be passed as initialFilterValues to the table hook