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 05541b89b..2ec6753a6 100644 --- a/client/src/app/pages/applications/analysis-wizard/analysis-wizard.tsx +++ b/client/src/app/pages/applications/analysis-wizard/analysis-wizard.tsx @@ -51,6 +51,41 @@ interface IAnalysisWizard { isOpen: boolean; } +const determineMode = ( + applications: Application[] +): "binary" | "source-code-deps" | "" => { + // If only one application is selected + if (applications.length === 1) { + const app = applications[0]; + // Check if the application has only source definitions or both source and binary + if (app.repository || (app.repository && app.binary)) { + return "source-code-deps"; // Return 'Source + Dependencies' if source or both + } + // Check if the application has only binary definitions + else if (app.binary) { + return "binary"; // Return 'Binary' if binary only + } + // If the application has no definitions + else { + return ""; // Return empty string if no definitions (no default selection) + } + } + // If more than one application is selected + else { + // Check if all applications are in "binary" mode + const allBinary = applications.every((app) => app.binary); + // Check if all applications are in "source-code-deps" mode (or a mix of source-code and binary) + const allSourceDeps = applications.every( + (app) => app.repository || app.binary + ); + // If all applications are binary, return "binary" + if (allBinary) { + return "binary"; + } + // If all applications are source-code-deps or there's a mix, return "source-code-deps" + return "source-code-deps"; + } +}; const defaultTaskData: TaskData = { tagger: { enabled: true, @@ -340,12 +375,12 @@ export const AnalysisWizard: React.FC = ({ const analyzableApplications = useAnalyzableApplications(applications, mode); - const isStepEnabled = (stepId: StepId) => { - return ( - stepIdReached + 1 >= stepId && - (firstInvalidStep === null || firstInvalidStep >= stepId) - ); - }; + const isStepEnabled = (stepId: StepId) => true; //{ + // return ( + // stepIdReached + 1 >= stepId && + // (firstInvalidStep === null || firstInvalidStep >= stepId) + // ); + // }; const steps = [ = ({ , diff --git a/client/src/app/pages/applications/analysis-wizard/set-mode.tsx b/client/src/app/pages/applications/analysis-wizard/set-mode.tsx index 5050d3df6..371ae4332 100644 --- a/client/src/app/pages/applications/analysis-wizard/set-mode.tsx +++ b/client/src/app/pages/applications/analysis-wizard/set-mode.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { SelectOptionProps, TextContent, @@ -17,9 +17,14 @@ import { SimpleSelectBasic } from "@app/components/SimpleSelectBasic"; interface ISetMode { isSingleApp: boolean; isModeValid: boolean; + defaultValue: string; } -export const SetMode: React.FC = ({ isSingleApp, isModeValid }) => { +export const SetMode: React.FC = ({ + isSingleApp, + isModeValid, + defaultValue, +}) => { const { t } = useTranslation(); const { watch, control } = useFormContext(); @@ -46,6 +51,7 @@ export const SetMode: React.FC = ({ isSingleApp, isModeValid }) => { children: "Upload a local binary", }); } + const [selectedValue, setSelectedValue] = useState(defaultValue); return (
= ({ isSingleApp, isModeValid }) => { toggleId="analysis-mode-toggle" toggleAriaLabel="Analysis mode dropdown toggle" aria-label={name} - value={value} - onChange={onChange} + value={selectedValue} + onChange={(value) => { + setSelectedValue(value); + onChange(value); // עדכון של הערך בשדה + }} options={options} /> )} /> - {!isModeValid && ( + {/* {!isModeValid && ( = ({ isSingleApp, isModeValid }) => { >

{t("wizard.label.notAllAnalyzableDetails")}

- )} + )} */} {mode === "source-code" && (