From a0a4e2f7f5eab4a7ac0a21cd8af2d0bc3bd825dd Mon Sep 17 00:00:00 2001 From: Yuriy Vasilyev Date: Wed, 17 Jun 2026 18:03:57 +0200 Subject: [PATCH 01/41] feat: redesign the reports side panel on the V2 endpoint Replace the client-side aggregation of four V1 endpoints with a single useGetComplianceReport call against GET computers/report, and redesign the side panel to match the Figma: a status bar table, a time-to-patch donut with a legend table, and clickable counts that deep-link to the filtered instances list. "60+ days outstanding" is now the headline USN debt metric (previously mislabelled "60 days"). - Snapshot the selection when the panel opens; warn and offer to regenerate when the live selection changes. - Wire the CSV download form's "Report by CVE" and range controls to the request and fetch on submit; note what the legacy CSV contains. - Gate the "View report" action behind the instance-reports feature flag from the features/ endpoint, removing the VITE_REPORT_VIEW_ENABLED build-time env var. --- .changeset/reports-side-panel.md | 5 + .env.local.example | 1 - .env.production | 1 - .gitignore | 2 +- src/constants.ts | 2 - .../hooks/useInstanceSearchHelpTerms.tsx | 34 +++ .../InstancesPageActions.test.tsx | 23 +- .../InstancesPageActions.tsx | 5 +- src/features/instances/index.ts | 5 + .../instances/selectedInstancesStore.ts | 31 ++ src/features/reports/api/index.ts | 2 + .../reports/api/useGetComplianceReport.ts | 36 +++ .../MetricBarTable/MetricBarTable.module.scss | 26 ++ .../MetricBarTable/MetricBarTable.test.tsx | 70 +++++ .../MetricBarTable/MetricBarTable.tsx | 67 +++++ .../components/MetricBarTable/index.ts | 2 + .../ReportDonutChart.module.scss | 101 +++++++ .../ReportDonutChart.test.tsx | 124 ++++++++ .../ReportDonutChart/ReportDonutChart.tsx | 199 ++++++++++++ .../components/ReportDonutChart/index.ts | 2 + .../ReportForm/ReportForm.module.scss | 0 .../ReportForm/ReportForm.test.tsx | 39 +++ .../components}/ReportForm/ReportForm.tsx | 44 ++- .../reports/components}/ReportForm/index.ts | 0 .../ReportLegendTable.module.scss | 90 ++++++ .../ReportLegendTable.test.tsx | 138 +++++++++ .../ReportLegendTable/ReportLegendTable.tsx | 130 ++++++++ .../components/ReportLegendTable/index.ts | 2 + .../ReportView/ReportView.module.scss | 10 + .../components/ReportView/ReportView.test.tsx | 284 ++++++++++++++++++ .../components/ReportView/ReportView.tsx | 277 +++++++++++++++++ .../reports/components}/ReportView/index.ts | 0 src/features/reports/index.ts | 4 + src/features/reports/types.ts | 19 ++ .../components/SavedSearchForm/constants.ts | 7 + .../helpers/searchQueryLanguage.ts | 11 + .../helpers/searchQueryValidation.ts | 14 + src/hooks/useReports.ts | 80 +---- .../instances/InstancesPage/InstancesPage.tsx | 24 +- .../instances/InstancesPage/helpers.test.ts | 1 - .../ReportView/ReportView.module.scss | 15 - .../instances/ReportView/ReportView.test.tsx | 52 ---- .../instances/ReportView/ReportView.tsx | 172 ----------- .../ReportWidget/ReportWidget.module.scss | 21 -- .../ReportWidget/ReportWidget.test.tsx | 33 -- .../instances/ReportWidget/ReportWidget.tsx | 38 --- .../dashboard/instances/ReportWidget/index.ts | 1 - src/tests/mocks/features.ts | 11 + src/tests/server/handlers/features.ts | 11 +- src/tests/server/handlers/instance.ts | 8 +- src/tests/server/handlers/reports.ts | 85 ++++-- src/types/FeatureKey.ts | 1 + src/vite-env.d.ts | 1 - 53 files changed, 1893 insertions(+), 468 deletions(-) create mode 100644 .changeset/reports-side-panel.md create mode 100644 src/features/instances/selectedInstancesStore.ts create mode 100644 src/features/reports/api/index.ts create mode 100644 src/features/reports/api/useGetComplianceReport.ts create mode 100644 src/features/reports/components/MetricBarTable/MetricBarTable.module.scss create mode 100644 src/features/reports/components/MetricBarTable/MetricBarTable.test.tsx create mode 100644 src/features/reports/components/MetricBarTable/MetricBarTable.tsx create mode 100644 src/features/reports/components/MetricBarTable/index.ts create mode 100644 src/features/reports/components/ReportDonutChart/ReportDonutChart.module.scss create mode 100644 src/features/reports/components/ReportDonutChart/ReportDonutChart.test.tsx create mode 100644 src/features/reports/components/ReportDonutChart/ReportDonutChart.tsx create mode 100644 src/features/reports/components/ReportDonutChart/index.ts rename src/{pages/dashboard/instances => features/reports/components}/ReportForm/ReportForm.module.scss (100%) rename src/{pages/dashboard/instances => features/reports/components}/ReportForm/ReportForm.test.tsx (60%) rename src/{pages/dashboard/instances => features/reports/components}/ReportForm/ReportForm.tsx (58%) rename src/{pages/dashboard/instances => features/reports/components}/ReportForm/index.ts (100%) create mode 100644 src/features/reports/components/ReportLegendTable/ReportLegendTable.module.scss create mode 100644 src/features/reports/components/ReportLegendTable/ReportLegendTable.test.tsx create mode 100644 src/features/reports/components/ReportLegendTable/ReportLegendTable.tsx create mode 100644 src/features/reports/components/ReportLegendTable/index.ts create mode 100644 src/features/reports/components/ReportView/ReportView.module.scss create mode 100644 src/features/reports/components/ReportView/ReportView.test.tsx create mode 100644 src/features/reports/components/ReportView/ReportView.tsx rename src/{pages/dashboard/instances => features/reports/components}/ReportView/index.ts (100%) create mode 100644 src/features/reports/index.ts create mode 100644 src/features/reports/types.ts delete mode 100644 src/pages/dashboard/instances/ReportView/ReportView.module.scss delete mode 100644 src/pages/dashboard/instances/ReportView/ReportView.test.tsx delete mode 100644 src/pages/dashboard/instances/ReportView/ReportView.tsx delete mode 100644 src/pages/dashboard/instances/ReportWidget/ReportWidget.module.scss delete mode 100644 src/pages/dashboard/instances/ReportWidget/ReportWidget.test.tsx delete mode 100644 src/pages/dashboard/instances/ReportWidget/ReportWidget.tsx delete mode 100644 src/pages/dashboard/instances/ReportWidget/index.ts diff --git a/.changeset/reports-side-panel.md b/.changeset/reports-side-panel.md new file mode 100644 index 0000000000..a09c48841a --- /dev/null +++ b/.changeset/reports-side-panel.md @@ -0,0 +1,5 @@ +--- +"landscape-ui": minor +--- + +Redesign the instances reports side panel on a single V2 `computers/report` endpoint, with deep-linked counts and a working CSV download. Gated behind the `instance-reports` feature flag (on by default). diff --git a/.env.local.example b/.env.local.example index 11da589c46..0a23e7aa1a 100644 --- a/.env.local.example +++ b/.env.local.example @@ -3,7 +3,6 @@ VITE_API_URL_OLD= VITE_API_URL_DEB_ARCHIVE= VITE_ROOT_PATH= VITE_SELF_HOSTED_ENV= -VITE_REPORT_VIEW_ENABLED= VITE_DETAILED_UPGRADES_VIEW_ENABLED= VITE_MSW_ENABLED= VITE_MSW_ENDPOINTS_TO_INTERCEPT= diff --git a/.env.production b/.env.production index 6b801982e9..c01e42dca8 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,6 @@ VITE_API_URL=/api/v2/ VITE_API_URL_OLD=/api/ VITE_API_URL_DEB_ARCHIVE=/debarchive/v1beta1/ VITE_ROOT_PATH=/new_dashboard/ -VITE_REPORT_VIEW_ENABLED=false VITE_DETAILED_UPGRADES_VIEW_ENABLED=false VITE_MSW_ENABLED=false VITE_MSW_ENDPOINTS_TO_INTERCEPT= \ No newline at end of file diff --git a/.gitignore b/.gitignore index e030a7e585..cd15c44c85 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ dist-ssr .venv .vite-node coverage -reports +/reports src/**/*.module.scss.d.ts # Cache diff --git a/src/constants.ts b/src/constants.ts index 708151a593..106672e3a9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -16,8 +16,6 @@ export const NOT_AVAILABLE = "N/A"; export const APP_VERSION = import.meta.env.VITE_APP_VERSION; export const APP_COMMIT = import.meta.env.VITE_APP_COMMIT; export const FEEDBACK_LINK = "https://bugs.launchpad.net/landscape"; -export const REPORT_VIEW_ENABLED = - import.meta.env.VITE_REPORT_VIEW_ENABLED === "true"; export const CONTACT_SUPPORT_TEAM_MESSAGE = "Something went wrong. Please try again or contact our support team."; export const DETAILED_UPGRADES_VIEW_ENABLED = diff --git a/src/features/instances/components/InstancesHeader/hooks/useInstanceSearchHelpTerms.tsx b/src/features/instances/components/InstancesHeader/hooks/useInstanceSearchHelpTerms.tsx index 0e0f719c69..ecfa308468 100644 --- a/src/features/instances/components/InstancesHeader/hooks/useInstanceSearchHelpTerms.tsx +++ b/src/features/instances/components/InstancesHeader/hooks/useInstanceSearchHelpTerms.tsx @@ -347,6 +347,40 @@ const useInstanceSearchHelpTerms = () => { ), }, + { + term: "last-ping-minutes:", + description: ( + + Instances that were active in the last{" "} + <nr-of-minutes> minutes, where{" "} + <nr-of-minutes> is a value between 1 and 525600. + + ), + }, + { + term: "usn-outstanding:", + description: ( + + Instances with unresolved USNs released more than{" "} + <nr-of-days> days ago. + + ), + }, + { + term: "usn-applied-in:", + description: ( + + Instances which applied all recently released USNs within{" "} + <nr-of-days> days. + + ), + }, + { + term: "has:upgrade-profile", + description: ( + Instances covered by at least one upgrade profile. + ), + }, { term: "has-pro-management: