diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 6942e06e7d..7608805b07 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -161,6 +161,10 @@ "medium": "Medium", "small": "Small" }, + "issues": { + "noIssues": "Congratulations! No issues were found", + "issuesFound": "{{minor}} minor, {{critical}} critical" + }, "message": { "archetypeApplicationCount": "{{count}} application", "archetypeApplicationCount_plural": "{{count}} applications", diff --git a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx index 882578b58e..ab7b2c9d1e 100644 --- a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx +++ b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx @@ -65,6 +65,8 @@ import { useFetchArchetypes } from "@app/queries/archetypes"; import { useFetchAssessments } from "@app/queries/assessments"; import { DecoratedApplication } from "../../applications-table/useDecoratedApplications"; import { TaskStates } from "@app/queries/tasks"; +import { useFetchIssueReports } from "@app/queries/issues"; +import { fork } from "radash"; export interface IApplicationDetailDrawerProps extends Pick { @@ -182,6 +184,18 @@ const TabDetailsContent: React.FC<{ .filter((fullArchetype) => fullArchetype?.review) .filter(Boolean); + const issueReportsQuery = useFetchIssueReports(application.id); + const { + result: { data, total: totalReportCount }, + } = issueReportsQuery; + const currentPageReports = data; + const [minor, critical] = fork(currentPageReports, (u) => u.effort <= 1).map( + (a) => a.length + ); + + const taskState = application.tasks.currentAnalyzer?.state ?? ""; + const taskSucceeded = TaskStates.Success.includes(taskState); + return ( <> @@ -194,6 +208,16 @@ const TabDetailsContent: React.FC<{ Issues + + {!taskSucceeded + ? t("terms.unassigned") + : currentPageReports.length === 0 + ? t("issues.noIssues") + : t("issues.issuesFound", { + minor: minor, + critical: critical, + })} +