Skip to content

Commit 1316a45

Browse files
NVSHAS-9943: Namespaced user cannot login NV UI
1 parent 057af08 commit 1316a45

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

admin/webapp/websrc/app/common/services/multi-cluster.service.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import { HttpClient } from '@angular/common/http';
55
import { PathConstant } from '@common/constants/path.constant';
66
import { Router } from '@angular/router';
77
import { SESSION_STORAGE, StorageService } from 'ngx-webstorage-service';
8-
import { BehaviorSubject, Observable, Subject } from 'rxjs';
9-
import { tap } from 'rxjs/operators';
8+
import { BehaviorSubject, Observable, Subject, of } from 'rxjs';
109
import { Cluster, ClusterData, ClusterSummary } from '@common/types';
1110
import { GlobalVariable } from '@common/variables/global.variable';
1211
import { TranslateService } from '@ngx-translate/core';
1312
import { UtilsService } from '@common/utils/app.utils';
1413
import { MultiClusterSummary } from '@common/types/scala_for_reference_only/MultiClusterSummary';
1514
import { ConfigHttpService } from '@common/api/config-http.service';
16-
import { map } from 'rxjs/operators';
15+
import { tap, map, catchError } from 'rxjs/operators';
1716
import { CommonHttpService } from '@common/api/common-http.service';
1817
import { GlobalConstant } from '@common/constants/global.constant';
1918
import { SummaryService } from './summary.service';
@@ -101,9 +100,12 @@ export class MultiClusterService {
101100
}
102101

103102
getClusters(): Observable<any> {
104-
return GlobalVariable.http
105-
.get(PathConstant.FED_MEMBER_URL)
106-
.pipe(tap(member => this.memberSubject.next(member)));
103+
return GlobalVariable.http.get(PathConstant.FED_MEMBER_URL).pipe(
104+
tap(member => this.memberSubject.next(member)),
105+
catchError(error => {
106+
return of(null);
107+
})
108+
);
107109
}
108110

109111
getRemoteSummary(id): Observable<any> {

admin/webapp/websrc/app/routes/pages/login/login.component.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -469,21 +469,23 @@ export class LoginComponent implements OnInit, OnDestroy {
469469
GlobalVariable.summary = summaryInfo.summary;
470470

471471
// Handle clusterData
472-
GlobalVariable.isMaster =
473-
clusterData.fed_role === MapConstant.FED_ROLES.MASTER;
474-
GlobalVariable.isMember =
475-
clusterData.fed_role === MapConstant.FED_ROLES.MEMBER;
476-
GlobalVariable.isStandAlone = clusterData.fed_role === '';
477-
478-
const sessionCluster = this.localStorage.get(
479-
GlobalConstant.LOCAL_STORAGE_CLUSTER
480-
);
481-
const clusterInSession = sessionCluster
482-
? JSON.parse(sessionCluster)
483-
: null;
484-
GlobalVariable.isRemote = clusterInSession
485-
? clusterInSession.isRemote
486-
: false;
472+
if (clusterData) {
473+
GlobalVariable.isMaster =
474+
clusterData.fed_role === MapConstant.FED_ROLES.MASTER;
475+
GlobalVariable.isMember =
476+
clusterData.fed_role === MapConstant.FED_ROLES.MEMBER;
477+
GlobalVariable.isStandAlone = clusterData.fed_role === '';
478+
479+
const sessionCluster = this.localStorage.get(
480+
GlobalConstant.LOCAL_STORAGE_CLUSTER
481+
);
482+
const clusterInSession = sessionCluster
483+
? JSON.parse(sessionCluster)
484+
: null;
485+
GlobalVariable.isRemote = clusterInSession
486+
? clusterInSession.isRemote
487+
: false;
488+
}
487489

488490
GlobalVariable.hasInitializedSummary = true;
489491

admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-dialog/registry-details-dialog.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,4 @@ export class RegistryDetailsDialogComponent implements OnInit, OnDestroy {
184184
ngOnDestroy() {
185185
this.filter.setValue('');
186186
}
187-
188187
}

0 commit comments

Comments
 (0)