From 77dd65444e4156547a95f762b74bc4243bddc663 Mon Sep 17 00:00:00 2001 From: Pedro Gonzalez Gomez Date: Wed, 24 Apr 2024 10:48:11 +0200 Subject: [PATCH] mgr/dashboard: fix readonly landingpage Conflicts: mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.ts mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.ts - Hardware status and multi-cluster features are not included in squid, therefore this only affects the telemetry status Fixes: https://tracker.ceph.com/issues/65643 Signed-off-by: Pedro Gonzalez Gomez (cherry picked from commit 7abae5c982ee1fd7de74653bdd5ad46dbc4ae388) --- .../mgr/dashboard/controllers/health.py | 4 ++++ .../dashboard/dashboard-v3.component.ts | 6 ++--- .../src/app/shared/api/health.service.ts | 4 ++++ src/pybind/mgr/dashboard/openapi.yaml | 22 +++++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/health.py b/src/pybind/mgr/dashboard/controllers/health.py index 633d37a327ea..3edc386b0123 100644 --- a/src/pybind/mgr/dashboard/controllers/health.py +++ b/src/pybind/mgr/dashboard/controllers/health.py @@ -300,3 +300,7 @@ class Health(BaseController): @Endpoint() def get_cluster_fsid(self): return mgr.get('config')['fsid'] + + @Endpoint() + def get_telemetry_status(self): + return mgr.get_module_option_ex('telemetry', 'enabled', False) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.ts index 3c44bd36a890..484bf08292ce 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.ts @@ -22,7 +22,6 @@ import { SummaryService } from '~/app/shared/services/summary.service'; import { PrometheusListHelper } from '~/app/shared/helpers/prometheus-list-helper'; import { PrometheusAlertService } from '~/app/shared/services/prometheus-alert.service'; import { OrchestratorService } from '~/app/shared/api/orchestrator.service'; -import { MgrModuleService } from '~/app/shared/api/mgr-module.service'; import { AlertClass } from '~/app/shared/enum/health-icon.enum'; @Component({ @@ -78,7 +77,6 @@ export class DashboardV3Component extends PrometheusListHelper implements OnInit private featureToggles: FeatureTogglesService, private healthService: HealthService, public prometheusService: PrometheusService, - private mgrModuleService: MgrModuleService, private refreshIntervalService: RefreshIntervalService, public prometheusAlertService: PrometheusAlertService ) { @@ -155,8 +153,8 @@ export class DashboardV3Component extends PrometheusListHelper implements OnInit } private getTelemetryReport() { - this.mgrModuleService.getConfig('telemetry').subscribe((resp: any) => { - this.telemetryEnabled = resp?.enabled; + this.healthService.getTelemetryStatus().subscribe((enabled: boolean) => { + this.telemetryEnabled = enabled; }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/health.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/health.service.ts index 42634a1481cf..b04a27b644d5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/health.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/health.service.ts @@ -26,4 +26,8 @@ export class HealthService { getOrchestratorName() { return this.http.get('api/health/get_orchestrator_name'); } + + getTelemetryStatus() { + return this.http.get('api/health/get_telemetry_status'); + } } diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 5810d55b329d..1b7d012eb846 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -4838,6 +4838,28 @@ paths: - jwt: [] tags: - Health + /api/health/get_telemetry_status: + get: + parameters: [] + responses: + '200': + content: + application/vnd.ceph.api.v1.0+json: + type: object + description: OK + '400': + description: Operation exception. Please check the response body for details. + '401': + description: Unauthenticated access. Please login first. + '403': + description: Unauthorized access. Please check your permissions. + '500': + description: Unexpected error. Please check the response body for the stack + trace. + security: + - jwt: [] + tags: + - Health /api/health/minimal: get: parameters: [] -- 2.47.3