From: Nizamudeen A Date: Wed, 17 Apr 2024 07:11:48 +0000 (+0530) Subject: mgr/dashboard: fix dashboard not visible on disabled anonymous access X-Git-Tag: v18.2.5~682^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F56965%2Fhead;p=ceph.git mgr/dashboard: fix dashboard not visible on disabled anonymous access When the anonymous access is disabled, the dashboards will have a password so the verification error code can be 401 (Unauthorized) Fixes: https://tracker.ceph.com/issues/65534 Signed-off-by: Nizamudeen A (cherry picked from commit f802e99c1e743675bc9b4d8c6d3399879391135f) --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts index b650f6694cf5..d3c7012bcbb3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts @@ -172,7 +172,7 @@ export class GrafanaComponent implements OnInit, OnChanges { getFrame() { this.settingsService .validateGrafanaDashboardUrl(this.uid) - .subscribe((data: any) => (this.dashboardExist = data === 200)); + .subscribe((data: any) => (this.dashboardExist = data === 200 || data === 401)); // 401 because grafana API shows unauthorized when anonymous access is disabled if (this.type === 'metrics') { this.url = `${this.baseUrl}${this.uid}/${this.grafanaPath}&refresh=2s&var-datasource=${this.datasource}${this.mode}&${this.time}`; } else {