]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard_v2: Add support for $PREFIX config
authorRicardo Marques <rimarques@suse.com>
Fri, 23 Feb 2018 16:09:29 +0000 (16:09 +0000)
committerRicardo Dias <rdias@suse.com>
Mon, 5 Mar 2018 13:07:16 +0000 (13:07 +0000)
Signed-off-by: Ricardo Marques <rimarques@suse.com>
14 files changed:
src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cephfs/cephfs.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/monitor.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/dashboard/dashboard.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/rgw/services/rgw-daemon.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/auth.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/configuration.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/host.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/pool.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/rbd-mirroring.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/summary.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/app/shared/services/tcmu-iscsi.service.ts
src/pybind/mgr/dashboard_v2/frontend/src/index.html
src/pybind/mgr/dashboard_v2/module.py

index 27ff31bb7828d3242ca83b3c7a98a8b21193cadc..a5c4994da451a1cf0ec86d81762ebf44477051f4 100644 (file)
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
 
 @Injectable()
 export class CephfsService {
-  baseURL = '/api/cephfs';
+  baseURL = 'api/cephfs';
 
   constructor(private http: HttpClient) {}
 
index 5a61870660ca7afa76765069348ee520ca9531d5..32057f3b6ea11fce90db950d3f95e853efae3a33 100644 (file)
@@ -6,6 +6,6 @@ export class MonitorService {
   constructor(private http: HttpClient) {}
 
   getMonitor() {
-    return this.http.get('/api/monitor');
+    return this.http.get('api/monitor');
   }
 }
index 807983cb25e143cfbf654f902be30bc57ae02131..cb51cb4d71b0c10d267cb76e19d668d161c5d4fa 100644 (file)
@@ -6,6 +6,6 @@ export class DashboardService {
   constructor(private http: HttpClient) {}
 
   getHealth() {
-    return this.http.get('/api/dashboard/health');
+    return this.http.get('api/dashboard/health');
   }
 }
index 45a80ff0ce825d5294bdc549e10026c63241e87e..b6ac5d5fe3e67ef6b29c7e3da79cf9158fb9654a 100644 (file)
@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core';
 @Injectable()
 export class TablePerformanceCounterService {
 
-  private url = '/api/perf_counters';
+  private url = 'api/perf_counters';
 
   constructor(private http: HttpClient) { }
 
index 728452b995778370c1b82b45e17703e0954643ce..907537ef2d9e51a38b10a3a468165da93a70c5f0 100644 (file)
@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core';
 @Injectable()
 export class RgwDaemonService {
 
-  private url = '/api/rgw/daemon';
+  private url = 'api/rgw/daemon';
 
   constructor(private http: HttpClient) { }
 
index d5001157fedd946605073fa74974ba5c7bbae850..88a7136289e3327c01ae9ce2664daa1a5514a723 100644 (file)
@@ -12,13 +12,13 @@ export class AuthService {
   }
 
   login(credentials: Credentials) {
-    return this.http.post('/api/auth', credentials).toPromise().then((resp: Credentials) => {
+    return this.http.post('api/auth', credentials).toPromise().then((resp: Credentials) => {
       this.authStorageService.set(resp.username);
     });
   }
 
   logout() {
-    return this.http.delete('/api/auth').toPromise().then(() => {
+    return this.http.delete('api/auth').toPromise().then(() => {
       this.authStorageService.remove();
     });
   }
index 80b04aa50b11fbd9c572597971e33b27e7fcf132..41ac7bb5196ad3c5e08ac960999599e94d052d3b 100644 (file)
@@ -6,6 +6,6 @@ export class ConfigurationService {
   constructor(private http: HttpClient) {}
 
   getConfigData() {
-    return this.http.get('/api/cluster_conf/');
+    return this.http.get('api/cluster_conf/');
   }
 }
index 73bedce613697ba52b957d6d49d7b63b9085f7fc..3d28cd78926a3c31162cce8daca56c7a777c837a 100644 (file)
@@ -8,7 +8,7 @@ export class HostService {
   }
 
   list() {
-    return this.http.get('/api/host').toPromise().then((resp: any) => {
+    return this.http.get('api/host').toPromise().then((resp: any) => {
       return resp;
     });
   }
index f92ed166da8a3070902885146e659748cbdad83b..8ac6de9d5b4e3ae4f0a6ce7b9287fddf55dc26fc 100644 (file)
@@ -8,7 +8,7 @@ export class PoolService {
   }
 
   rbdPoolImages(pool) {
-    return this.http.get(`/api/rbd/${pool}`).toPromise().then((resp: any) => {
+    return this.http.get(`api/rbd/${pool}`).toPromise().then((resp: any) => {
       return resp;
     });
   }
index cec38d1a1a1fa5a479eb2a13d45a442e13670325..b840b3053a05e79847b1db79e42885985647d49a 100644 (file)
@@ -6,6 +6,6 @@ export class RbdMirroringService {
   constructor(private http: HttpClient) {}
 
   get() {
-    return this.http.get('/api/rbdmirror');
+    return this.http.get('api/rbdmirror');
   }
 }
index 0bc4566b43d4f77c5a8a88d6fe8586bf8ac4a220..9556930ebd4223da21035a618915766afe43123a 100644 (file)
@@ -19,7 +19,7 @@ export class SummaryService {
 
   refresh() {
     if (this.authStorageService.isLoggedIn()) {
-      this.http.get('/api/summary').subscribe(data => {
+      this.http.get('api/summary').subscribe(data => {
         this.summaryDataSource.next(data);
       });
     }
index 2976404fc1b962552b4d7375fc18c51b1e15184a..2f36bb81813b9cd142008d5a1ed77456037514b7 100644 (file)
@@ -8,7 +8,7 @@ export class TcmuIscsiService {
   }
 
   tcmuiscsi() {
-    return this.http.get('/api/tcmuiscsi').toPromise().then((resp: any) => {
+    return this.http.get('api/tcmuiscsi').toPromise().then((resp: any) => {
       return resp;
     });
   }
index 36dcf4def26a532125273e0cb25be5c22776938f..05a8f70911674c969fd215efb2964bd94b8ef53f 100644 (file)
@@ -3,7 +3,10 @@
 <head>
   <meta charset="utf-8">
   <title>Ceph</title>
-  <base href="/">
+
+  <script>
+    document.write('<base href="' + document.location+ '" />');
+  </script>
 
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="favicon.ico">
index ff6ee5e8b68396ad18c011aab23609816beb305b..f271f8e7c5f70af3182d941a0fb90d4729b80f41 100644 (file)
@@ -37,6 +37,14 @@ def os_exit_noop(*args):
 os._exit = os_exit_noop
 
 
+def prepare_url_prefix(url_prefix):
+    """
+    return '' if no prefix, or '/prefix' without slash in the end.
+    """
+    url_prefix = urljoin('/', url_prefix)
+    return url_prefix.rstrip('/')
+
+
 class Module(MgrModule):
     """
     dashboard module entrypoint
@@ -80,13 +88,6 @@ class Module(MgrModule):
         self.log.info('server_addr: %s server_port: %s', server_addr,
                       server_port)
 
-        def prepare_url_prefix(url_prefix):
-            """
-            return '' if no prefix, or '/prefix' without slash in the end.
-            """
-            url_prefix = urljoin('/', url_prefix)
-            return url_prefix.rstrip('/')
-
         self._url_prefix = prepare_url_prefix(self.get_config('url_prefix',
                                                               default=''))
 
@@ -121,8 +122,8 @@ class Module(MgrModule):
             self.url_prefix
         ))
 
-        cherrypy.tree.mount(Module.ApiRoot(self), '/api')
-        cherrypy.tree.mount(Module.StaticRoot(), '/', config=config)
+        cherrypy.tree.mount(Module.ApiRoot(self), '{}/api'.format(self.url_prefix))
+        cherrypy.tree.mount(Module.StaticRoot(), '{}/'.format(self.url_prefix), config=config)
 
     def serve(self):
         if 'COVERAGE_ENABLED' in os.environ:
@@ -253,7 +254,9 @@ class StandbyModule(MgrStandbyModule):
                     """
                     return template.format(delay=5)
 
-        cherrypy.tree.mount(Root(), "/", {})
+        url_prefix = prepare_url_prefix(self.get_config('url_prefix',
+                                                        default=''))
+        cherrypy.tree.mount(Root(), "{}/".format(url_prefix), {})
         self.log.info("Starting engine...")
         cherrypy.engine.start()
         self.log.info("Waiting for engine...")