From 92e36095cc71eea942a9f9336d61bc98d2d87191 Mon Sep 17 00:00:00 2001 From: Karishma Punwatkar Date: Sun, 14 Apr 2024 17:39:54 +0530 Subject: [PATCH 1/4] minor_update Signed-off-by: Karishma Punwatkar --- client/public/locales/en/translation.json | 1 + .../applications-table/applications-table.tsx | 32 +++++++++++++++-- .../affected-applications.tsx | 34 +++++++++++++++++-- client/src/app/pages/issues/issues-table.tsx | 27 ++++++++++++++- 4 files changed, 89 insertions(+), 5 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index a4de299d5a..6244961e03 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -326,6 +326,7 @@ "details": "Details", "displayName": "Display name", "effort": "Effort", + "totalEffort": "Total Effort", "effortEstimate": "Effort estimate", "email": "Email", "error": "Error", 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 51f2cefe11..00d8e4caf0 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -15,6 +15,7 @@ import { DropdownItem, Modal, Tooltip, + Text, } from "@patternfly/react-core"; import { PencilAltIcon, TagIcon } from "@patternfly/react-icons"; import { @@ -109,6 +110,9 @@ import { useFetchArchetypes } from "@app/queries/archetypes"; import { ApplicationFormModal } from "../components/application-form"; import { ManageColumnsToolbar } from "./components/manage-columns-toolbar"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; +import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; + export const ApplicationsTable: React.FC = () => { const { t } = useTranslation(); const history = useHistory(); @@ -845,9 +849,33 @@ export const ApplicationsTable: React.FC = () => { )} {getColumnVisibility("effort") && ( - + +
+
+ Effort +
+ + + This column shows the total application effort. + + + } + position="right" + > +
+ +
+
+
+ )} - diff --git a/client/src/app/pages/issues/affected-applications/affected-applications.tsx b/client/src/app/pages/issues/affected-applications/affected-applications.tsx index c0db18e0fd..76b90cacbe 100644 --- a/client/src/app/pages/issues/affected-applications/affected-applications.tsx +++ b/client/src/app/pages/issues/affected-applications/affected-applications.tsx @@ -9,6 +9,7 @@ import { Toolbar, ToolbarContent, ToolbarItem, + Tooltip, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; @@ -36,6 +37,8 @@ import { } from "../helpers"; import { IssueDetailDrawer } from "../issue-detail-drawer"; import { TablePersistenceKeyPrefix } from "@app/Constants"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; +import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; interface IAffectedApplicationsRouteParams { ruleset: string; @@ -60,7 +63,7 @@ export const AffectedApplications: React.FC = () => { name: "Name", description: "Description", businessService: "Business service", - effort: "Total Effort", + effort: "Effort", incidents: "Incidents", }, isFilterEnabled: true, @@ -181,7 +184,34 @@ export const AffectedApplications: React.FC = () => { - + +
+
+ Effort +
+ + + This column shows the total calculated effort + for all incidents related to this file. + + + } + position="right" + > +
+ +
+
+
+ diff --git a/client/src/app/pages/issues/issues-table.tsx b/client/src/app/pages/issues/issues-table.tsx index 9e831c3e3a..c86fa6fff5 100644 --- a/client/src/app/pages/issues/issues-table.tsx +++ b/client/src/app/pages/issues/issues-table.tsx @@ -70,6 +70,7 @@ import { AffectedAppsLink } from "./affected-apps-link"; import { ConditionalTooltip } from "@app/components/ConditionalTooltip"; import { IssueDetailDrawer } from "./issue-detail-drawer"; import { IssueDescriptionAndLinks } from "./components/issue-description-and-links"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; export interface IIssuesTableProps { mode: "allIssues" | "singleApp"; @@ -328,7 +329,31 @@ export const IssuesTable: React.FC = ({ mode }) => { - + +
+
+ Effort +
+ + + This column shows the effort weight for a single issue + incident. + + + } + position="right" + > +
+ +
+
+
+ From 55c8fa628f12f859029b8bea17eaec2e21e4a6c5 Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Mon, 22 Apr 2024 14:12:22 +0200 Subject: [PATCH 2/4] :bug: Re-enable fetching applications after application import (#1856) After successful import re-enable useFetchApplications() hook for the next 15 seconds. Resolves: https://issues.redhat.com/browse/MTA-2451 Signed-off-by: Radoslaw Szwajkowski --- client/public/locales/en/translation.json | 3 + .../applications-table/applications-table.tsx | 63 +++++++++++-------- .../affected-applications.tsx | 30 ++++++++- client/src/app/pages/issues/issues-table.tsx | 22 ++++++- client/src/app/queries/applications.ts | 6 +- 5 files changed, 92 insertions(+), 32 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index a4de299d5a..25ee41aac4 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -172,6 +172,9 @@ "autoSelectTooltip": "Automatically select this answer based on tags associated with the application(s) or archetype.", "autoTagTooltip": "Automatically tag this application or archetype with these tags based on this answer to the questionnaire.", "assessmentStakeholderHeader": "Select the stakeholder(s) or stakeholder group(s) associated with this assessment.", + "allIssuesEffortTooltip": "This column shows the effort weight for a single issue incident.", + "applicationEffortTooltip": "This column shows the total application effort.", + "affectedAppEffortTooltip": "This column shows the total calculated effort for all incidents related to this file.", "binaryPackaging": "Packaging will default to JAR if left empty.", "blockedDeleteTracker": "Cannot delete {{what}} because it is associated with a tracker.", "blockedDeleteApplication": "Cannot delete {{what}} because it is associated with an application.", 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 0e2afe6cd0..8e51c3c2f9 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -15,8 +15,14 @@ import { DropdownItem, Modal, Tooltip, + Flex, + FlexItem, } from "@patternfly/react-core"; -import { PencilAltIcon, TagIcon } from "@patternfly/react-icons"; +import { + PencilAltIcon, + QuestionCircleIcon, + TagIcon, +} from "@patternfly/react-icons"; import { Table, Thead, @@ -66,7 +72,6 @@ import { checkAccess } from "@app/utils/rbac-utils"; import WarningTriangleIcon from "@patternfly/react-icons/dist/esm/icons/warning-triangle-icon"; // Hooks -import { useQueryClient } from "@tanstack/react-query"; import { deserializeFilterUrlParams, useLocalTableControls, @@ -108,6 +113,7 @@ import { KebabDropdown } from "@app/components/KebabDropdown"; import { useFetchArchetypes } from "@app/queries/archetypes"; import { ApplicationFormModal } from "../components/application-form"; import { ManageColumnsToolbar } from "./components/manage-columns-toolbar"; +import dayjs from "dayjs"; export const ApplicationsTable: React.FC = () => { const { t } = useTranslation(); @@ -207,12 +213,17 @@ export const ApplicationsTable: React.FC = () => { const [reviewToDiscard, setReviewToDiscard] = React.useState(null); + const [endOfAppImportPeriod, setEndOfAppImportPeriod] = useState( + dayjs() + ); + const { data: applications, isFetching: isFetchingApplications, error: applicationsFetchError, - refetch: fetchApplications, - } = useFetchApplications(!hasActiveTasks); + } = useFetchApplications(() => + hasActiveTasks || dayjs().isBefore(endOfAppImportPeriod) ? 5000 : false + ); const { assessments, isFetching: isFetchingAssessments } = useFetchAssessments(); @@ -498,8 +509,6 @@ export const ApplicationsTable: React.FC = () => { isSelectionEnabled: true, }); - const queryClient = useQueryClient(); - const { currentPageItems, numRenderedColumns, @@ -559,10 +568,6 @@ export const ApplicationsTable: React.FC = () => { tasksWriteAccess = checkAccess(userScopes, tasksWriteScopes), reviewsWriteAccess = checkAccess(userScopes, reviewsWriteScopes); - const areAppsInWaves = selectedRows.some( - (application) => application.migrationWave !== null - ); - const importDropdownItems = importWriteAccess ? [ { {getColumnVisibility("tags") && ( )} - {getColumnVisibility("effort") && ( - - )} + + + + {t("effort")} + + + + + + + + + + @@ -1131,19 +1153,6 @@ export const ApplicationsTable: React.FC = () => { documentId={taskToView?.task} onClose={() => setTaskToView(undefined)} /> - setIsApplicationImportModalOpen((current) => !current)} - > - { - setIsApplicationImportModalOpen(false); - fetchApplications(); - }} - /> - { { setIsApplicationImportModalOpen(false); - fetchApplications(); + setEndOfAppImportPeriod(dayjs().add(15, "s")); }} /> diff --git a/client/src/app/pages/issues/affected-applications/affected-applications.tsx b/client/src/app/pages/issues/affected-applications/affected-applications.tsx index c0db18e0fd..4eb326c7fd 100644 --- a/client/src/app/pages/issues/affected-applications/affected-applications.tsx +++ b/client/src/app/pages/issues/affected-applications/affected-applications.tsx @@ -2,6 +2,8 @@ import * as React from "react"; import { Breadcrumb, BreadcrumbItem, + Flex, + FlexItem, PageSection, PageSectionVariants, Text, @@ -9,6 +11,7 @@ import { Toolbar, ToolbarContent, ToolbarItem, + Tooltip, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; @@ -36,6 +39,7 @@ import { } from "../helpers"; import { IssueDetailDrawer } from "../issue-detail-drawer"; import { TablePersistenceKeyPrefix } from "@app/Constants"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; interface IAffectedApplicationsRouteParams { ruleset: string; @@ -60,7 +64,7 @@ export const AffectedApplications: React.FC = () => { name: "Name", description: "Description", businessService: "Business service", - effort: "Total Effort", + effort: "Effort", incidents: "Incidents", }, isFilterEnabled: true, @@ -181,7 +185,29 @@ export const AffectedApplications: React.FC = () => { - + + + + {t("effort")} + + + + + + + + + + diff --git a/client/src/app/pages/issues/issues-table.tsx b/client/src/app/pages/issues/issues-table.tsx index 9e831c3e3a..7d2e80221e 100644 --- a/client/src/app/pages/issues/issues-table.tsx +++ b/client/src/app/pages/issues/issues-table.tsx @@ -70,6 +70,7 @@ import { AffectedAppsLink } from "./affected-apps-link"; import { ConditionalTooltip } from "@app/components/ConditionalTooltip"; import { IssueDetailDrawer } from "./issue-detail-drawer"; import { IssueDescriptionAndLinks } from "./components/issue-description-and-links"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; export interface IIssuesTableProps { mode: "allIssues" | "singleApp"; @@ -328,7 +329,26 @@ export const IssuesTable: React.FC = ({ mode }) => { - + + + + {t("effort")} + + + + + + + + + + diff --git a/client/src/app/queries/applications.ts b/client/src/app/queries/applications.ts index 12639b102e..153a13d013 100644 --- a/client/src/app/queries/applications.ts +++ b/client/src/app/queries/applications.ts @@ -32,13 +32,15 @@ interface DownloadOptions { mimeType: MimeType; } -export const useFetchApplications = (refetchDisabled: boolean = false) => { +export const useFetchApplications = ( + refetchInterval: number | false | (() => number | false) = 5000 +) => { const queryClient = useQueryClient(); const { isLoading, error, refetch, data } = useQuery({ initialData: [], queryKey: [ApplicationsQueryKey], queryFn: getApplications, - refetchInterval: !refetchDisabled ? 5000 : false, + refetchInterval: refetchInterval, onSuccess: () => { queryClient.invalidateQueries([assessmentsByItemIdQueryKey]); }, From 5679deb9b55c1a0e83eaed6c747ca75e5c23c76d Mon Sep 17 00:00:00 2001 From: kpunwatk Date: Wed, 24 Apr 2024 23:01:30 +0530 Subject: [PATCH 3/4] Update client/src/app/pages/applications/applications-table/applications-table.tsx Co-authored-by: Ian Bolton Signed-off-by: kpunwatk --- .../pages/applications/applications-table/applications-table.tsx | 1 + 1 file changed, 1 insertion(+) 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 e2cd146cb9..d5bb72e07d 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -853,6 +853,7 @@ export const ApplicationsTable: React.FC = () => { {t("terms.effort")} From 1995da2773f756ff1e6dc42eae4d4ad7a1a2fa0f Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Mon, 22 Apr 2024 14:12:22 +0200 Subject: [PATCH 4/4] :bug: Re-enable fetching applications after application import (#1856) After successful import re-enable useFetchApplications() hook for the next 15 seconds. Resolves: https://issues.redhat.com/browse/MTA-2451 Signed-off-by: Radoslaw Szwajkowski --- client/public/locales/en/translation.json | 3 ++ .../applications-table/applications-table.tsx | 31 ++++++++++++++++--- .../affected-applications.tsx | 30 ++++++++++++++++-- client/src/app/pages/issues/issues-table.tsx | 22 ++++++++++++- 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index a4de299d5a..25ee41aac4 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -172,6 +172,9 @@ "autoSelectTooltip": "Automatically select this answer based on tags associated with the application(s) or archetype.", "autoTagTooltip": "Automatically tag this application or archetype with these tags based on this answer to the questionnaire.", "assessmentStakeholderHeader": "Select the stakeholder(s) or stakeholder group(s) associated with this assessment.", + "allIssuesEffortTooltip": "This column shows the effort weight for a single issue incident.", + "applicationEffortTooltip": "This column shows the total application effort.", + "affectedAppEffortTooltip": "This column shows the total calculated effort for all incidents related to this file.", "binaryPackaging": "Packaging will default to JAR if left empty.", "blockedDeleteTracker": "Cannot delete {{what}} because it is associated with a tracker.", "blockedDeleteApplication": "Cannot delete {{what}} because it is associated with an application.", 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 61942abc7f..8e51c3c2f9 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -15,8 +15,14 @@ import { DropdownItem, Modal, Tooltip, + Flex, + FlexItem, } from "@patternfly/react-core"; -import { PencilAltIcon, TagIcon } from "@patternfly/react-icons"; +import { + PencilAltIcon, + QuestionCircleIcon, + TagIcon, +} from "@patternfly/react-icons"; import { Table, Thead, @@ -843,9 +849,26 @@ export const ApplicationsTable: React.FC = () => { {getColumnVisibility("tags") && ( )} - {getColumnVisibility("effort") && ( - - )} + + + + {t("effort")} + + + + + + + + + + diff --git a/client/src/app/pages/issues/affected-applications/affected-applications.tsx b/client/src/app/pages/issues/affected-applications/affected-applications.tsx index c0db18e0fd..4eb326c7fd 100644 --- a/client/src/app/pages/issues/affected-applications/affected-applications.tsx +++ b/client/src/app/pages/issues/affected-applications/affected-applications.tsx @@ -2,6 +2,8 @@ import * as React from "react"; import { Breadcrumb, BreadcrumbItem, + Flex, + FlexItem, PageSection, PageSectionVariants, Text, @@ -9,6 +11,7 @@ import { Toolbar, ToolbarContent, ToolbarItem, + Tooltip, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; @@ -36,6 +39,7 @@ import { } from "../helpers"; import { IssueDetailDrawer } from "../issue-detail-drawer"; import { TablePersistenceKeyPrefix } from "@app/Constants"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; interface IAffectedApplicationsRouteParams { ruleset: string; @@ -60,7 +64,7 @@ export const AffectedApplications: React.FC = () => { name: "Name", description: "Description", businessService: "Business service", - effort: "Total Effort", + effort: "Effort", incidents: "Incidents", }, isFilterEnabled: true, @@ -181,7 +185,29 @@ export const AffectedApplications: React.FC = () => { - + + + + {t("effort")} + + + + + + + + + + diff --git a/client/src/app/pages/issues/issues-table.tsx b/client/src/app/pages/issues/issues-table.tsx index 9e831c3e3a..7d2e80221e 100644 --- a/client/src/app/pages/issues/issues-table.tsx +++ b/client/src/app/pages/issues/issues-table.tsx @@ -70,6 +70,7 @@ import { AffectedAppsLink } from "./affected-apps-link"; import { ConditionalTooltip } from "@app/components/ConditionalTooltip"; import { IssueDetailDrawer } from "./issue-detail-drawer"; import { IssueDescriptionAndLinks } from "./components/issue-description-and-links"; +import { QuestionCircleIcon } from "@patternfly/react-icons"; export interface IIssuesTableProps { mode: "allIssues" | "singleApp"; @@ -328,7 +329,26 @@ export const IssuesTable: React.FC = ({ mode }) => { - + + + + {t("effort")} + + + + + + + + + +