From 7dcb06d368753faa6da7b334ee115c756fe951f7 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Sun, 9 Jul 2023 19:06:02 +0530 Subject: [PATCH] mgr/dashboard: update the upgrade layout by introducing new items Shows Cluster Health Shows the count of mgr daemons Shows a table with all the daemon versions Display the cluster logs Fixes: https://tracker.ceph.com/issues/62016 Signed-off-by: Nizamudeen A --- .../mgr/dashboard/controllers/daemon.py | 18 +- .../frontend/src/app/app-routing.module.ts | 13 +- .../app/ceph/cluster/logs/logs.component.html | 21 +- .../app/ceph/cluster/logs/logs.component.scss | 4 + .../app/ceph/cluster/logs/logs.component.ts | 14 +- .../upgrade-start-modal.component.spec.ts | 3 +- .../cluster/upgrade/upgrade.component.html | 192 +++++++++++++----- .../cluster/upgrade/upgrade.component.spec.ts | 48 +++-- .../ceph/cluster/upgrade/upgrade.component.ts | 82 ++++++-- .../ceph/dashboard-v3/dashboard-v3.module.ts | 12 +- .../dashboard/dashboard-v3.component.spec.ts | 10 +- .../rgw-overview-dashboard.component.spec.ts | 6 +- .../src/app/shared/api/daemon.service.ts | 8 + .../src/app/shared/api/upgrade.service.ts | 15 +- .../card-row/card-row.component.html | 0 .../card-row/card-row.component.scss | 0 .../card-row/card-row.component.spec.ts | 0 .../card-row/card-row.component.ts | 0 .../components}/card/card.component.html | 0 .../components}/card/card.component.scss | 0 .../components}/card/card.component.spec.ts | 0 .../components}/card/card.component.ts | 0 .../shared/components/components.module.ts | 10 +- .../shared/datatable/table/table.component.ts | 5 +- src/pybind/mgr/dashboard/openapi.yaml | 31 +++ src/pybind/mgr/dashboard/tests/test_daemon.py | 5 + 26 files changed, 366 insertions(+), 131 deletions(-) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card-row/card-row.component.html (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card-row/card-row.component.scss (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card-row/card-row.component.spec.ts (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card-row/card-row.component.ts (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card/card.component.html (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card/card.component.scss (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card/card.component.spec.ts (100%) rename src/pybind/mgr/dashboard/frontend/src/app/{ceph/dashboard-v3 => shared/components}/card/card.component.ts (100%) diff --git a/src/pybind/mgr/dashboard/controllers/daemon.py b/src/pybind/mgr/dashboard/controllers/daemon.py index eeea5a3262555..d5c288131b92e 100644 --- a/src/pybind/mgr/dashboard/controllers/daemon.py +++ b/src/pybind/mgr/dashboard/controllers/daemon.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from typing import Optional +from typing import List, Optional from ..exceptions import DashboardException from ..security import Scope @@ -31,3 +31,19 @@ class Daemon(RESTController): orch = OrchClient.instance() res = orch.daemons.action(action=action, daemon_name=daemon_name, image=container_image) return res + + @raise_if_no_orchestrator([OrchFeature.DAEMON_LIST]) + @handle_orchestrator_error('daemon') + @RESTController.MethodMap(version=APIVersion.DEFAULT) + def list(self, daemon_types: Optional[List[str]] = None): + """List all daemons in the cluster. Also filter by the daemon types specified + + :param daemon_types: List of daemon types to filter by. + :return: Returns list of daemons. + :rtype: list + """ + orch = OrchClient.instance() + daemons = [d.to_dict() for d in orch.services.list_daemons()] + if daemon_types: + daemons = [d for d in daemons if d['daemon_type'] in daemon_types] + return daemons diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts index 98d14779ddf1f..d57fb9855a77a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts @@ -286,8 +286,19 @@ const routes: Routes = [ }, { path: 'upgrade', + canActivate: [ModuleStatusGuardService], component: UpgradeComponent, - data: { breadcrumbs: 'Cluster/Upgrade' } + data: { + moduleStatusGuardConfig: { + uiApiPath: 'orchestrator', + redirectTo: 'error', + backend: 'cephadm', + section: 'orch', + section_info: 'Orchestrator', + header: 'Orchestrator is not available' + }, + breadcrumbs: 'Cluster/Upgrade' + } }, { path: 'perf_counters/:type/:id', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html index dbf2c28b687d1..f92674e50743d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html @@ -6,7 +6,7 @@ class="nav-tabs" cdStatefulTab="logs" [cdStatefulTabDefault]="defaultTab" - [hidden]="hideNavLinks"> + [hidden]="!showNavLinks"> Cluster Logs @@ -15,19 +15,20 @@ *ngIf="clog">
+ *ngIf="clog.length && showClusterLogs"> + *ngIf="showDownloadCopyButton"> + *ngIf="showDownloadCopyButton">
-
+

{{ line.stamp | cdDate }} {{ line.priority }} @@ -45,19 +46,19 @@ i18n>Audit Logs

+ *ngIf="audit_log && showAuditLogs">
+ *ngIf="showDownloadCopyButton"> + *ngIf="showDownloadCopyButton">
@@ -77,7 +78,7 @@ Daemon Logs - +
+ *ngIf="showFilterTools">