Skip to content

Commit 1691a96

Browse files
add summary of issues to the ApplicationDetailDrawer
Signed-off-by: DvoraShechter1 <[email protected]>
1 parent 733259b commit 1691a96

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

client/public/locales/en/translation.json

+4
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@
161161
"medium": "Medium",
162162
"small": "Small"
163163
},
164+
"issues": {
165+
"noIssues": "Congratulations! No issues were found",
166+
"issuesFound": "{{minor}} minor, {{critical}} critical"
167+
},
164168
"message": {
165169
"archetypeApplicationCount": "{{count}} application",
166170
"archetypeApplicationCount_plural": "{{count}} applications",

client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx

+27
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import {
3434
Ref,
3535
Archetype,
3636
TaskDashboard,
37+
AnalysisRuleReport,
38+
AnalysisIssueReport,
3739
} from "@app/api/models";
3840
import { COLOR_HEX_VALUES_BY_NAME } from "@app/Constants";
3941
import { useFetchFacts } from "@app/queries/facts";
@@ -65,6 +67,7 @@ import { useFetchArchetypes } from "@app/queries/archetypes";
6567
import { useFetchAssessments } from "@app/queries/assessments";
6668
import { DecoratedApplication } from "../../applications-table/useDecoratedApplications";
6769
import { TaskStates } from "@app/queries/tasks";
70+
import { useFetchIssueReports } from "@app/queries/issues";
6871

6972
export interface IApplicationDetailDrawerProps
7073
extends Pick<IPageDrawerContentProps, "onCloseClick"> {
@@ -182,6 +185,19 @@ const TabDetailsContent: React.FC<{
182185
.filter((fullArchetype) => fullArchetype?.review)
183186
.filter(Boolean);
184187

188+
const issueReportsQuery = useFetchIssueReports(application.id);
189+
const {
190+
result: { data, total: totalReportCount },
191+
isFetching: isFetchingReports,
192+
fetchError: reportsFetchError,
193+
} = issueReportsQuery;
194+
const currentPageReports = data as (
195+
| AnalysisRuleReport
196+
| AnalysisIssueReport
197+
)[];
198+
const minor = currentPageReports.filter((u) => u.effort === 1).length;
199+
const critical = currentPageReports.filter((u) => u.effort > 1).length;
200+
185201
return (
186202
<>
187203
<TextContent className={`${spacing.mtMd} ${spacing.mbMd}`}>
@@ -194,6 +210,17 @@ const TabDetailsContent: React.FC<{
194210
<Link to={getIssuesSingleAppSelectedLocation(application.id)}>
195211
Issues
196212
</Link>
213+
<Text component="small">
214+
{application.tasks.currentAnalyzer === undefined ||
215+
application.tasks.currentAnalyzer.state === "Failed"
216+
? t("terms.unassigned")
217+
: currentPageReports.length === 0
218+
? t("issues.noIssues")
219+
: t("issues.issuesFound", {
220+
minor: minor,
221+
critical: critical,
222+
})}
223+
</Text>
197224
</ListItem>
198225
<ListItem>
199226
<Link

0 commit comments

Comments
 (0)