Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Added a summary of issues indicating that the analysis was successful #2139

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
Ref,
Archetype,
TaskDashboard,
AnalysisRuleReport,
AnalysisIssueReport,
} from "@app/api/models";
import { COLOR_HEX_VALUES_BY_NAME } from "@app/Constants";
import { useFetchFacts } from "@app/queries/facts";
Expand Down Expand Up @@ -65,6 +67,7 @@ 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";

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

const issueReportsQuery = useFetchIssueReports(application.id);
DvoraShechter1 marked this conversation as resolved.
Show resolved Hide resolved
const {
result: { data, total: totalReportCount },
isFetching: isFetchingReports,
fetchError: reportsFetchError,
DvoraShechter1 marked this conversation as resolved.
Show resolved Hide resolved
} = issueReportsQuery;
const currentPageReports = data as (
| AnalysisRuleReport
| AnalysisIssueReport
)[];
DvoraShechter1 marked this conversation as resolved.
Show resolved Hide resolved
const minor = currentPageReports.filter((u) => u.effort === 1).length;
const critical = currentPageReports.filter((u) => u.effort > 1).length;
DvoraShechter1 marked this conversation as resolved.
Show resolved Hide resolved

return (
<>
<TextContent className={`${spacing.mtMd} ${spacing.mbMd}`}>
Expand All @@ -194,6 +210,17 @@ const TabDetailsContent: React.FC<{
<Link to={getIssuesSingleAppSelectedLocation(application.id)}>
Issues
</Link>
<Text component="small">
{application.tasks.currentAnalyzer === undefined ||
application.tasks.currentAnalyzer.state === "Failed"
DvoraShechter1 marked this conversation as resolved.
Show resolved Hide resolved
? t("terms.unassigned")
: currentPageReports.length === 0
? t("issues.noIssues")
: t("issues.issuesFound", {
minor: minor,
critical: critical,
})}
</Text>
</ListItem>
<ListItem>
<Link
Expand Down
Loading