]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix redirect to login page on session lost 23388/head
authorRicardo Marques <rimarques@suse.com>
Thu, 2 Aug 2018 10:41:21 +0000 (11:41 +0100)
committerRicardo Marques <rimarques@suse.com>
Tue, 7 Aug 2018 09:45:38 +0000 (10:45 +0100)
Fixes: https://tracker.ceph.com/issues/25344
Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/dashboard-help/dashboard-help.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/task-manager/task-manager.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/summary.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/summary.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts

index 4c624dd8d8e23ee831bd1d90d496e12d0bd31a76..f07f9734dd4c5636124a645f402f7018bccc60d8 100644 (file)
@@ -1,6 +1,7 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { ToastModule } from 'ng2-toastr';
 import { BsModalRef, BsModalService } from 'ngx-bootstrap';
@@ -23,7 +24,8 @@ describe('RbdSnapshotFormComponent', () => {
       HttpClientTestingModule,
       ServicesModule,
       ApiModule,
-      ToastModule.forRoot()
+      ToastModule.forRoot(),
+      RouterTestingModule
     ],
     declarations: [RbdSnapshotFormComponent],
     providers: [BsModalRef, BsModalService, AuthStorageService]
index 3e18c5490b8edeeca029fc901b25e0a2e6881d9b..e6a61bba47f045157011859d9938537c439fe656 100644 (file)
@@ -1,5 +1,6 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { configureTestBed } from '../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../shared/shared.module';
@@ -10,7 +11,7 @@ describe('DashboardHelpComponent', () => {
   let fixture: ComponentFixture<DashboardHelpComponent>;
 
   configureTestBed({
-    imports: [HttpClientTestingModule, SharedModule],
+    imports: [HttpClientTestingModule, SharedModule, RouterTestingModule],
     declarations: [DashboardHelpComponent]
   });
 
index 8b8f4a25cc869ef0d516a93b7af244685f48f79e..879af018feadca651fa1083e3190b2e124375def 100644 (file)
@@ -1,5 +1,6 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { PopoverModule } from 'ngx-bootstrap';
 
@@ -18,7 +19,7 @@ describe('TaskManagerComponent', () => {
   };
 
   configureTestBed({
-    imports: [SharedModule, PopoverModule.forRoot(), HttpClientTestingModule],
+    imports: [SharedModule, PopoverModule.forRoot(), HttpClientTestingModule, RouterTestingModule],
     declarations: [TaskManagerComponent]
   });
 
index 3a8547cf7c122692a739553ea0d51e00cfcdf3ac..4dd03110c13ff11c7d68eb233d68cc2f7160fa0e 100644 (file)
@@ -1,5 +1,6 @@
 import { HttpClient } from '@angular/common/http';
 import { fakeAsync, TestBed, tick } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { of as observableOf, Subscriber } from 'rxjs';
 
@@ -28,6 +29,7 @@ describe('SummaryService', () => {
   };
 
   configureTestBed({
+    imports: [RouterTestingModule],
     providers: [
       SummaryService,
       AuthStorageService,
index f7060361040c3af392fa3a92e48a8b403dd65537..e6f3e11ffb2bcd03dc6095870ade76fe9c49ac5d 100644 (file)
@@ -1,11 +1,11 @@
 import { HttpClient } from '@angular/common/http';
 import { Injectable, NgZone } from '@angular/core';
+import { Router } from '@angular/router';
 
 import * as _ from 'lodash';
 import { BehaviorSubject, Subscription } from 'rxjs';
 
 import { ExecutingTask } from '../models/executing-task';
-import { AuthStorageService } from './auth-storage.service';
 import { ServicesModule } from './services.module';
 
 @Injectable({
@@ -18,16 +18,12 @@ export class SummaryService {
   // Observable streams
   summaryData$ = this.summaryDataSource.asObservable();
 
-  constructor(
-    private http: HttpClient,
-    private authStorageService: AuthStorageService,
-    private ngZone: NgZone
-  ) {
+  constructor(private http: HttpClient, private router: Router, private ngZone: NgZone) {
     this.refresh();
   }
 
   refresh() {
-    if (this.authStorageService.isLoggedIn()) {
+    if (this.router.url !== '/login') {
       this.http.get('api/summary').subscribe((data) => {
         this.summaryDataSource.next(data);
       });
index acd09955e7842f8b19ec0ed6fddb2dc7e334066c..ce64d7d4c097b0c635ba8eb8a6cffb05aaa26be8 100644 (file)
@@ -1,5 +1,6 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { inject, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { ToastModule } from 'ng2-toastr';
 import { Observable } from 'rxjs/Observable';
@@ -16,7 +17,7 @@ describe('TaskWrapperService', () => {
   let service: TaskWrapperService;
 
   configureTestBed({
-    imports: [HttpClientTestingModule, ToastModule.forRoot(), SharedModule],
+    imports: [HttpClientTestingModule, ToastModule.forRoot(), SharedModule, RouterTestingModule],
     providers: [TaskWrapperService]
   });