From a74f8de1c3bc3d53dc2c9a2a264698249d0d2d13 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 13 Nov 2020 18:32:18 +0800 Subject: [PATCH] mgr/dashboard: use http://docs.ceph.com/en/${release}/ for the domain of the docs * use the URL of RTD, where the locale is encoded in it. * s/http/https/ * add test accordingly Fixes: https://tracker.ceph.com/issues/48012 Signed-off-by: Kiefer Chang Signed-off-by: Kefu Chai --- .../src/app/shared/services/doc.service.spec.ts | 10 ++++++++-- .../frontend/src/app/shared/services/doc.service.ts | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.spec.ts index 5694998ace4e..7c3bf24dd5d9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.spec.ts @@ -22,7 +22,13 @@ describe('DocService', () => { it('should return full URL', () => { expect(service.urlGenerator('iscsi', 'foo')).toBe( - 'http://docs.ceph.com/docs/foo/mgr/dashboard/#enabling-iscsi-management' + 'https://docs.ceph.com/en/foo/mgr/dashboard/#enabling-iscsi-management' + ); + }); + + it('should return latest version URL for master', () => { + expect(service.urlGenerator('orch', 'master')).toBe( + 'https://docs.ceph.com/en/latest/mgr/orchestrator' ); }); @@ -60,7 +66,7 @@ describe('DocService', () => { nextSummary('foo'); expect(result).toEqual( - 'http://docs.ceph.com/docs/foo/mgr/dashboard/#enabling-prometheus-alerting' + 'https://docs.ceph.com/en/foo/mgr/dashboard/#enabling-prometheus-alerting' ); expect(i).toBe(1); expect(subscriber.closed).toBe(true); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.ts index 09181f12b3c7..4cbb4cf185b3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.ts @@ -24,7 +24,8 @@ export class DocService { } urlGenerator(section: string, release = 'master'): string { - const domain = `http://docs.ceph.com/docs/${release}/`; + const docVersion = release === 'master' ? 'latest' : release; + const domain = `https://docs.ceph.com/en/${docVersion}/`; const domainCeph = `https://ceph.io/`; const sections = { -- 2.47.3