From 6658065ff697d95ab44f8229bf7d3cc32f093b3a Mon Sep 17 00:00:00 2001 From: TalyaNaima Date: Sun, 13 Oct 2024 11:40:28 +0300 Subject: [PATCH] commiting without unrelated changes Signed-off-by: TalyaNaima --- client/public/locales/en/translation.json | 1 + client/public/locales/es/translation.json | 3 +- .../applications-table/applications-table.tsx | 68 +++++-------------- 3 files changed, 20 insertions(+), 52 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 29a0a4a34..f67848a00 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -508,6 +508,7 @@ "saveWhat": "{{type}} {{what}} was successfully saved.", "save": "{{type}} was successfully saved.", "applicationDeleted": "{{appName}} application(s) successfully deleted.", + "applicationsDeleted": "{{appIDcount}} application(s) successfully deleted.", "assessmentAndReviewCopied": "Success! Assessment and review copied to selected applications", "assessmentCopied": "Success! Assessment copied to selected applications", "assessmentDiscarded": "Success! Assessment discarded for {{application}}.", diff --git a/client/public/locales/es/translation.json b/client/public/locales/es/translation.json index a90a57db0..0b6731399 100644 --- a/client/public/locales/es/translation.json +++ b/client/public/locales/es/translation.json @@ -309,7 +309,8 @@ "toastr": { "success": { "added": "Éxito! {{what}} fue creado como un {{type}}.", - "applicationDeleted": "{{appName}} aplicacione(s) descheda.", + "applicationDeleted": "{{appName}} aplicacione descheda.", + "applicationsDeleted": "{{appIDcount}} aplicacione(s) descheda.", "assessmentAndReviewCopied": "Éxito! Evaluación y revisión copiada a las aplicaciones seleccionadas", "assessmentCopied": "Éxito! Evaluación copiada a las aplicaciones seleccionadas", "assessmentDiscarded": "Éxito! Evaluación de {{application}} desechada.", 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 b343de28c..c218adbfb 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -85,14 +85,10 @@ import { import { useDeleteAssessmentMutation } from "@app/queries/assessments"; import { useDeleteReviewMutation } from "@app/queries/reviews"; import { useFetchTagsWithTagItems } from "@app/queries/tags"; -import { TaskState } from "@app/api/models"; // Relative components import { AnalysisWizard } from "../analysis-wizard/analysis-wizard"; -import { - ApplicationAnalysisStatus, - taskStateToAnalyze, -} from "../components/application-analysis-status"; +import { ApplicationAnalysisStatus } 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"; @@ -238,12 +234,20 @@ export const ApplicationsTable: React.FC = () => { } = useDecoratedApplications(baseApplications, tasks); const onDeleteApplicationSuccess = (appIDCount: number) => { - pushNotification({ - title: t("toastr.success.applicationDeleted", { - appName: applicationsToDelete[0].name, - }), - variant: "success", - }); + if (applicationsToDelete.length == 1) + pushNotification({ + title: t("toastr.success.applicationDeleted", { + appName: applicationsToDelete[0].name, + }), + variant: "success", + }); + else + pushNotification({ + title: t("toastr.success.applicationsDeleted", { + appIdCount: appIDCount, + }), + variant: "success", + }); clearActiveItem(); setApplicationsToDelete([]); }; @@ -339,7 +343,7 @@ export const ApplicationsTable: React.FC = () => { sort: "sessionStorage", }, isLoading: isFetchingApplications, - sortableColumns: ["name", "businessService", "tags", "effort", "analysis"], + sortableColumns: ["name", "businessService", "tags", "effort"], initialSort: { columnKey: "name", direction: "asc" }, initialColumns: { name: { isIdentity: true }, @@ -372,7 +376,7 @@ export const ApplicationsTable: React.FC = () => { title: t("terms.archetypes"), type: FilterType.multiselect, placeholderText: - t("action s.filterBy", { + t("actions.filterBy", { what: t("terms.archetypes").toLowerCase(), }) + "...", selectOptions: referencedArchetypeRefs.map(({ name }) => ({ @@ -504,44 +508,6 @@ 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: Object.values(applications) - // .map(a => ({ - // value: a?.tasks.currentAnalyzer?.state || "No Task", - // label: a?.tasks.currentAnalyzer?.state || "Not Started", - // })) - // .filter((v, i, a) => a.findIndex(v2 => v2.label === v.label) === i) - // .sort((a, b) => a.value.localeCompare(b.value)), - // getItemValue: (item) => item?.tasks.currentAnalyzer?.state || "No Task", - // } - { - categoryKey: "analysis", - title: t("terms.analysis"), - type: FilterType.multiselect, - placeholderText: - t("actions.filterBy", { - what: t("terms.analysis").toLowerCase(), - }) + "...", - selectOptions: Object.values(applications) - .map((a) => { - let value = a?.tasks.currentAnalyzer?.state || "No Task"; - if (value === "No Task") { - value = "No task"; - } - const label = taskStateToAnalyze.get(value as TaskState) || value; - return { value, label }; - }) - .filter((v, i, a) => a.findIndex((v2) => v2.label === v.label) === i) - .sort((a, b) => a.value.localeCompare(b.value)), - getItemValue: (item) => item?.tasks.currentAnalyzer?.state || "No Task", - }, ], initialItemsPerPage: 10, hasActionsColumn: true,