]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: avoid using document.write() 39527/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:56:14 +0000 (20:26 +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
     - Adopting the master branch changes.

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

index 1f8e9bf5b16209d34d9157fd0f90afc118dbfca1..b4b902aa0b258a33cc2e8f42c35a3024ae9403fc 100644 (file)
@@ -1,3 +1,4 @@
+import { APP_BASE_HREF } from '@angular/common';
 import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
 import {
   ErrorHandler,
@@ -58,6 +59,10 @@ import { environment } from '../environments/environment';
       useClass: ApiInterceptorService,
       multi: true
     },
+    {
+      provide: APP_BASE_HREF,
+      useValue: window['base-href']
+    },
     {
       provide: TRANSLATIONS,
       useFactory: (locale: string) => {
index f314e2c53a8f5e0fa991df7576f5f7fb69283105..150e67eebcb65e33ee47fa5280dcf82c0f13cea7 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, shrink-to-fit=no">