From b7616e6c0b16a4ff09d044d223790474e8adb6de Mon Sep 17 00:00:00 2001 From: DvoraShechter1 <d0583212560@gmail.com> Date: Thu, 19 Sep 2024 18:01:50 +0300 Subject: [PATCH 1/8] add ActionsColumn to Job Functions table Signed-off-by: DvoraShechter1 <d0583212560@gmail.com> --- .../src/app/pages/controls/job-functions/job-functions.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/app/pages/controls/job-functions/job-functions.tsx b/client/src/app/pages/controls/job-functions/job-functions.tsx index d6b76d6e2f..862f62da8f 100644 --- a/client/src/app/pages/controls/job-functions/job-functions.tsx +++ b/client/src/app/pages/controls/job-functions/job-functions.tsx @@ -16,7 +16,6 @@ import { import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; import { AppPlaceholder } from "@app/components/AppPlaceholder"; -import { AppTableActionButtons } from "@app/components/AppTableActionButtons"; import { ConditionalRender } from "@app/components/ConditionalRender"; import { ConfirmDialog } from "@app/components/ConfirmDialog"; import { getAxiosErrorMessage } from "@app/utils/utils"; @@ -37,6 +36,7 @@ import { import { useLocalTableControls } from "@app/hooks/table-controls"; import { CubesIcon } from "@patternfly/react-icons"; import { RBAC, RBAC_TYPE, controlsWriteScopes } from "@app/rbac"; +import { ControlTableActionButtons } from "../ControlTableActionButtons"; export const JobFunctions: React.FC = () => { const { t } = useTranslation(); @@ -215,9 +215,9 @@ export const JobFunctions: React.FC = () => { <Td width={90} {...getTdProps({ columnKey: "name" })}> {jobFunction.name} </Td> - <AppTableActionButtons + <ControlTableActionButtons isDeleteEnabled={!!jobFunction.stakeholders} - tooltipMessage="Cannot remove a Job function associated with stakeholder(s)" + deleteTooltipMessage="Cannot remove a Job function associated with stakeholder(s)" onEdit={() => setCreateUpdateModalState(jobFunction)} onDelete={() => deleteRow(jobFunction)} /> From 278774559ea07cd2e283d8132e0ba4abc47dea41 Mon Sep 17 00:00:00 2001 From: DvoraShechter1 <d0583212560@gmail.com> Date: Mon, 23 Sep 2024 17:16:12 +0300 Subject: [PATCH 2/8] Update translations.json to include deleteTooltipMessage Signed-off-by: DvoraShechter1 <d0583212560@gmail.com> --- client/public/locales/en/translation.json | 1 + client/public/locales/es/translation.json | 1 + 2 files changed, 2 insertions(+) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 6942e06e7d..539aa7cf17 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -108,6 +108,7 @@ "message": { "applicationsBulkDelete": "The selected application(s) will be deleted.", "delete": "This action cannot be undone.", + "deleteTooltipMessage": "Cannot remove a Job function associated with stakeholder(s)", "discardAssessment": "The assessment(s) for <1>{{applicationName}}</1> will be discarded. Do you wish to continue?", "discardReview": "The review for <1>{{applicationName}}</1> will be discarded. Do you wish to continue?", "leavePage": "Are you sure you want to leave this page? Be sure to save your changes, or they will be lost.", diff --git a/client/public/locales/es/translation.json b/client/public/locales/es/translation.json index 2304a0cccb..b0efc5ab41 100644 --- a/client/public/locales/es/translation.json +++ b/client/public/locales/es/translation.json @@ -77,6 +77,7 @@ "message": { "applicationsBulkDelete": "Se eliminarán las aplicacione(s) seleccionadas.", "delete": "Esta acción no puede ser revertida.", + "deleteTooltipMessage": "No se puede eliminar una función de trabajo asociada con partes interesadas", "discardAssessment": "La evaluación para <1>{{applicationName}}</1> será descartada, también los resultados de la revisión. ¿Deseas continuar?", "leavePage": "¿Estás seguro de querer salir de esta página? Asegúrate de guardar tus cambios o estos se perderán.", "pageError": "¡Ups! Algo salió mal.", From a901283a349c108c909ab8c2eef1cc3031e0e93c Mon Sep 17 00:00:00 2001 From: DvoraShechter1 <d0583212560@gmail.com> Date: Mon, 23 Sep 2024 17:20:52 +0300 Subject: [PATCH 3/8] Update deleteTooltipMessage for internationalization Signed-off-by: DvoraShechter1 <d0583212560@gmail.com> --- client/src/app/pages/controls/job-functions/job-functions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/pages/controls/job-functions/job-functions.tsx b/client/src/app/pages/controls/job-functions/job-functions.tsx index 862f62da8f..5de6341ae1 100644 --- a/client/src/app/pages/controls/job-functions/job-functions.tsx +++ b/client/src/app/pages/controls/job-functions/job-functions.tsx @@ -217,7 +217,7 @@ export const JobFunctions: React.FC = () => { </Td> <ControlTableActionButtons isDeleteEnabled={!!jobFunction.stakeholders} - deleteTooltipMessage="Cannot remove a Job function associated with stakeholder(s)" + deleteTooltipMessage={t("deleteTooltipMessage")} onEdit={() => setCreateUpdateModalState(jobFunction)} onDelete={() => deleteRow(jobFunction)} /> From eabad8152e571d18a194d8e25efc7f5e61681b25 Mon Sep 17 00:00:00 2001 From: DvoraShechter <sh5372560@gmail.com> Date: Tue, 8 Oct 2024 12:45:24 +0300 Subject: [PATCH 4/8] add summary of issues to the ApplicationDetailDrawer Signed-off-by: DvoraShechter <sh5372560@gmail.com> --- .../application-detail-drawer.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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..d6331f6f54 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 @@ -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"; @@ -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"> { @@ -182,6 +185,18 @@ const TabDetailsContent: React.FC<{ .filter((fullArchetype) => fullArchetype?.review) .filter(Boolean); + const issueReportsQuery = useFetchIssueReports(application.id); + const { + result: { data, total: totalReportCount }, + isFetching: isFetchingReports, + fetchError: reportsFetchError, + } = issueReportsQuery; + const currentPageReports = data as ( + | AnalysisRuleReport + | AnalysisIssueReport + )[]; + const minors = 0; + return ( <> <TextContent className={`${spacing.mtMd} ${spacing.mbMd}`}> @@ -194,6 +209,12 @@ const TabDetailsContent: React.FC<{ <Link to={getIssuesSingleAppSelectedLocation(application.id)}> Issues </Link> + <Text component="small"> + {console.log(currentPageReports)} + {(application.tasks.currentAnalyzer === undefined || + application.tasks.currentAnalyzer.state === "Failed") && + t("terms.unassigned")} + </Text> </ListItem> <ListItem> <Link From 018870c5cfd6d8b6a6048f1ed51c98cb999482f5 Mon Sep 17 00:00:00 2001 From: DvoraShechter <sh5372560@gmail.com> Date: Tue, 8 Oct 2024 12:56:17 +0300 Subject: [PATCH 5/8] add summary of issues to the ApplicationDetailDrawer Signed-off-by: DvoraShechter <sh5372560@gmail.com> --- .../application-detail-drawer.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 d6331f6f54..ff07979012 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 @@ -195,7 +195,8 @@ const TabDetailsContent: React.FC<{ | AnalysisRuleReport | AnalysisIssueReport )[]; - const minors = 0; + const minor = currentPageReports.filter((u) => u.effort === 1).length; + const critical = currentPageReports.filter((u) => u.effort > 1).length; return ( <> @@ -210,10 +211,12 @@ const TabDetailsContent: React.FC<{ Issues </Link> <Text component="small"> - {console.log(currentPageReports)} - {(application.tasks.currentAnalyzer === undefined || - application.tasks.currentAnalyzer.state === "Failed") && - t("terms.unassigned")} + {application.tasks.currentAnalyzer === undefined || + application.tasks.currentAnalyzer.state === "Failed" + ? t("terms.unassigned") + : currentPageReports.length === 0 + ? "Congratulations! No issues were found" + : `${minor} minor, ${critical} critical`} </Text> </ListItem> <ListItem> From 5bad6c18d9e0783f34fc73d116aaf80528710d5e Mon Sep 17 00:00:00 2001 From: DvoraShechter <sh5372560@gmail.com> Date: Tue, 8 Oct 2024 13:48:58 +0300 Subject: [PATCH 6/8] Add internationalization for issue summary messages Signed-off-by: DvoraShechter <sh5372560@gmail.com> --- client/public/locales/en/translation.json | 4 ++++ .../application-detail-drawer.tsx | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 539aa7cf17..4bcb4f3056 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -162,6 +162,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 ff07979012..f5675a63b5 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 @@ -215,8 +215,11 @@ const TabDetailsContent: React.FC<{ application.tasks.currentAnalyzer.state === "Failed" ? t("terms.unassigned") : currentPageReports.length === 0 - ? "Congratulations! No issues were found" - : `${minor} minor, ${critical} critical`} + ? t("issues.noIssues") + : t("issues.issuesFound", { + minor: minor, + critical: critical, + })} </Text> </ListItem> <ListItem> From c93a5d72f9cac2777159675af816cd3460b38220 Mon Sep 17 00:00:00 2001 From: DvoraShechter <sh5372560@gmail.com> Date: Wed, 9 Oct 2024 12:18:58 +0300 Subject: [PATCH 7/8] Add app details: Include a list of targets the project was checked against Signed-off-by: DvoraShechter <sh5372560@gmail.com> --- .../application-detail-drawer.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 f5675a63b5..a7748755c0 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 @@ -66,7 +66,7 @@ import { Paths } from "@app/Paths"; 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 { TaskStates, useFetchTaskByID } from "@app/queries/tasks"; import { useFetchIssueReports } from "@app/queries/issues"; export interface IApplicationDetailDrawerProps @@ -198,6 +198,13 @@ const TabDetailsContent: React.FC<{ const minor = currentPageReports.filter((u) => u.effort === 1).length; const critical = currentPageReports.filter((u) => u.effort > 1).length; + const { task, isFetching, fetchError, refetch } = useFetchTaskByID( + application.tasks.currentAnalyzer?.id + ); + const targets = task?.data?.rules?.labels?.included.filter((t) => + t.startsWith("konveyor.io/target=") + ); + return ( <> <TextContent className={`${spacing.mtMd} ${spacing.mbMd}`}> @@ -330,6 +337,12 @@ const TabDetailsContent: React.FC<{ onEditClick={onEditClick} onCloseClick={onCloseClick} /> + <TextContent className={spacing.mtLg}> + <Title headingLevel="h3" size="md"> + Targets + </Title> + {targets?.map((t) => <Text component="small">{t}</Text>)} + </TextContent> </> ); }; From e0a0d29d151404760300745e1cea7860f94e2b7b Mon Sep 17 00:00:00 2001 From: sarinailinger <sn0533129699@gmail.com> Date: Mon, 14 Oct 2024 15:24:43 +0300 Subject: [PATCH 8/8] Translation support Signed-off-by: sarinailinger <sn0533129699@gmail.com> --- client/public/locales/en/translation.json | 1 + .../application-detail-drawer/application-detail-drawer.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 4bcb4f3056..9a3c606662 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -482,6 +482,7 @@ "tagsAssessment": "Assessment Tags", "tagsCriteria": "Criteria Tags", "target": "Target", + "targets": "Targets", "tagCategory": "Tag category", "tagCategoryDeleted": "Tag category deleted", "tagCategories": "Tag categories", 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 a7748755c0..34f939b98d 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 @@ -339,7 +339,7 @@ const TabDetailsContent: React.FC<{ /> <TextContent className={spacing.mtLg}> <Title headingLevel="h3" size="md"> - Targets + {t("terms.Targets")} </Title> {targets?.map((t) => <Text component="small">{t}</Text>)} </TextContent>