From 2d37276071e978f6bfebb1dd67ed5802db581371 Mon Sep 17 00:00:00 2001 From: Pedro Gonzalez Gomez Date: Tue, 6 Feb 2024 12:40:11 +0100 Subject: [PATCH] mgr/dashboard: add hardware status summary On the landing page of the Dashboard, add the hardware status summary Fixes:https://tracker.ceph.com/issues/64329 Signed-off-by: Pedro Gonzalez Gomez --- .../mgr/dashboard/controllers/hardware.py | 21 ++++++ .../dashboard/dashboard-v3.component.html | 16 +++- .../dashboard/dashboard-v3.component.ts | 35 ++++++++- .../app/shared/api/hardware.service.spec.ts | 23 ++++++ .../src/app/shared/api/hardware.service.ts | 18 +++++ .../card-row/card-row.component.html | 64 +++++++++++++++- .../card-row/card-row.component.scss | 15 ++++ .../components/card-row/card-row.component.ts | 17 +++++ .../src/app/shared/enum/hardware.enum.ts | 8 ++ .../src/app/shared/pipes/pipes.module.ts | 7 +- .../app/shared/pipes/pluralize.pipe.spec.ts | 8 ++ .../src/app/shared/pipes/pluralize.pipe.ts | 14 ++++ src/pybind/mgr/dashboard/openapi.yaml | 39 ++++++++++ src/pybind/mgr/dashboard/services/hardware.py | 75 +++++++++++++++++++ .../mgr/dashboard/services/orchestrator.py | 8 ++ 15 files changed, 358 insertions(+), 10 deletions(-) create mode 100644 src/pybind/mgr/dashboard/controllers/hardware.py create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/api/hardware.service.spec.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/api/hardware.service.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/enum/hardware.enum.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pluralize.pipe.spec.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pluralize.pipe.ts create mode 100644 src/pybind/mgr/dashboard/services/hardware.py diff --git a/src/pybind/mgr/dashboard/controllers/hardware.py b/src/pybind/mgr/dashboard/controllers/hardware.py new file mode 100644 index 0000000000000..72550ed195f22 --- /dev/null +++ b/src/pybind/mgr/dashboard/controllers/hardware.py @@ -0,0 +1,21 @@ + +from typing import List, Optional + +from ..services.hardware import HardwareService +from . import APIDoc, APIRouter, EndpointDoc, RESTController +from ._version import APIVersion + + +@APIRouter('/hardware') +@APIDoc("Hardware management API", "Hardware") +class Hardware(RESTController): + + @RESTController.Collection('GET', version=APIVersion.EXPERIMENTAL) + @EndpointDoc("Retrieve a summary of the hardware health status") + def summary(self, categories: Optional[List[str]] = None, hostname: Optional[List[str]] = None): + """ + Get the health status of as many hardware categories, or all of them if none is given + :param categories: The hardware type, all of them by default + :param hostname: The host to retrieve from, all of them by default + """ + return HardwareService.get_summary(categories, hostname) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html index 4c290746b45b1..bad69c50122b6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html @@ -56,7 +56,9 @@ link="/hosts" title="Host" summaryType="simplified" - *ngIf="healthData.hosts != null"> + *ngIf="healthData.hosts != null" + [dropdownData]="(isHardwareEnabled$ | async) && (hardwareSummary$ | async)"> + -
+
Cluster
+ +
+
+ + Hardware +
+