From a6390505530ee410b4c0bed445f34e3e7852faf1 Mon Sep 17 00:00:00 2001 From: HadasahR Date: Wed, 18 Sep 2024 12:08:41 +0300 Subject: [PATCH] adding filter by analysis to Application inventory table --- .../applications-table/applications-table.tsx | 22 ++++++++++++++++++- .../application-analysis-status.tsx | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index d102d69a2a..6f023228a2 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -88,7 +88,10 @@ import { useFetchTagsWithTagItems } from "@app/queries/tags"; // Relative components import { AnalysisWizard } from "../analysis-wizard/analysis-wizard"; -import { ApplicationAnalysisStatus } from "../components/application-analysis-status"; +import { + ApplicationAnalysisStatus, + taskStateToAnalyze, +} from "../components/application-analysis-status"; import { ApplicationAssessmentStatus } from "../components/application-assessment-status"; import { ApplicationBusinessService } from "../components/application-business-service"; import { ApplicationDependenciesForm } from "@app/components/ApplicationDependenciesFormContainer/ApplicationDependenciesForm"; @@ -499,7 +502,24 @@ export const ApplicationsTable: React.FC = () => { ], getItemValue: (item) => normalizeRisk(item.risk) ?? "", }, + { + categoryKey: "analysis", + title: t("terms.analysis"), + type: FilterType.multiselect, + placeholderText: + t("actions.filterBy", { + what: t("terms.analysis").toLowerCase(), + }) + "...", + selectOptions: Array.from(taskStateToAnalyze).map( + ([taskState, displayStatus]) => ({ + value: taskState, + label: t(`${displayStatus}`), + }) + ), + getItemValue: (item) => item?.tasks.currentAnalyzer?.state || "No Task", + }, ], + initialItemsPerPage: 10, hasActionsColumn: true, isSelectionEnabled: true, diff --git a/client/src/app/pages/applications/components/application-analysis-status.tsx b/client/src/app/pages/applications/components/application-analysis-status.tsx index 4462aacaff..94c1e79537 100644 --- a/client/src/app/pages/applications/components/application-analysis-status.tsx +++ b/client/src/app/pages/applications/components/application-analysis-status.tsx @@ -7,7 +7,7 @@ export interface ApplicationAnalysisStatusProps { state: TaskState; } -const taskStateToAnalyze: Map = new Map([ +export const taskStateToAnalyze: Map = new Map([ ["not supported", "Canceled"], ["Canceled", "Canceled"], ["Created", "Scheduled"],