]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: avoid using document.write() 39526/head
authorAvan Thakkar <athakkar@localhost.localdomain>
Tue, 9 Feb 2021 08:01:59 +0000 (13:31 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Wed, 17 Feb 2021 14:40:29 +0000 (20:10 +0530)
Fixes: https://tracker.ceph.com/issues/49220
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
(cherry picked from commit 36efe519b90b7508fb830f2c250e8b6956eaaf05)

 Conflicts:
src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
     - Adopt the master branch changes.

src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
src/pybind/mgr/dashboard/frontend/src/index.html

index 7b63f06b7bd1c7029e958ff65879a79000af40fd..55211e01839437388c1230e88a030dc048ea9bb0 100644 (file)
@@ -1,3 +1,4 @@
+import { APP_BASE_HREF } from '@angular/common';
 import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
 import {
   ErrorHandler,
@@ -57,6 +58,10 @@ import { environment } from '../environments/environment';
       useClass: ApiInterceptorService,
       multi: true
     },
+    {
+      provide: APP_BASE_HREF,
+      useValue: window['base-href']
+    },
     {
       provide: TRANSLATIONS,
       useFactory: (locale) => {
index 05a8f70911674c969fd215efb2964bd94b8ef53f..8d5196e35e6c766add141ea784e44bb8465d88be 100644 (file)
@@ -3,9 +3,10 @@
 <head>
   <meta charset="utf-8">
   <title>Ceph</title>
+  <base href="/">
 
   <script>
-    document.write('<base href="' + document.location+ '" />');
+    window['base-href'] = window.location.pathname;
   </script>
 
   <meta name="viewport" content="width=device-width, initial-scale=1">