From d75bc00b51e9c8db81e91e8ab28d915d7cbd4768 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 30 Oct 2019 16:30:54 -0400 Subject: [PATCH] 15736: Add uuid column to site manager page --- src/models/session.ts | 3 ++- src/services/auth-service/auth-service.ts | 6 ++++-- src/store/auth/auth-action-session.ts | 6 ++++-- src/store/auth/auth-action.ts | 5 ++++- src/views/site-manager-panel/site-manager-panel-root.tsx | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/models/session.ts b/src/models/session.ts index 9a942967..91a0d997 100644 --- a/src/models/session.ts +++ b/src/models/session.ts @@ -12,9 +12,10 @@ export interface Session { clusterId: string; remoteHost: string; baseUrl: string; - username: string; + name: string; email: string; token: string; + uuid: string; loggedIn: boolean; status: SessionStatus; active: boolean; diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts index da96f162..d5cb4ec2 100644 --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@ -176,11 +176,12 @@ export class AuthService { clusterId: cfg.uuidPrefix, remoteHost: cfg.rootUrl, baseUrl: cfg.baseUrl, - username: getUserFullname(user), + name: getUserFullname(user), email: user ? user.email : '', token: this.getApiToken(), loggedIn: true, active: true, + uuid: user ? user.uuid : '', status: SessionStatus.VALIDATED } as Session; const localSessions = this.getSessions().map(s => ({ @@ -195,11 +196,12 @@ export class AuthService { clusterId, remoteHost, baseUrl: '', - username: '', + name: '', email: '', token: '', loggedIn: false, active: false, + uuid: '', status: SessionStatus.INVALIDATED } as Session; }); diff --git a/src/store/auth/auth-action-session.ts b/src/store/auth/auth-action-session.ts index 6af72e0c..a23fb2ff 100644 --- a/src/store/auth/auth-action-session.ts +++ b/src/store/auth/auth-action-session.ts @@ -120,7 +120,8 @@ export const validateSession = (session: Session, activeSession: Session) => session.baseUrl = baseUrl; session.token = token; session.email = user.email; - session.username = getUserFullname(user); + session.uuid = user.uuid; + session.name = getUserFullname(user); session.loggedIn = true; } catch { session.loggedIn = false; @@ -163,7 +164,8 @@ export const addSession = (remoteHost: string) => status: SessionStatus.VALIDATED, active: false, email: user.email, - username: getUserFullname(user), + name: getUserFullname(user), + uuid: user.uuid, remoteHost, baseUrl, clusterId, diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index e273d18c..5bac6b19 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -67,10 +67,13 @@ export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () => const init = (config: Config) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const user = services.authService.getUser(); const token = services.authService.getApiToken(); - const homeCluster = services.authService.getHomeCluster(); + let homeCluster = services.authService.getHomeCluster(); if (token) { setAuthorizationHeader(services, token); } + if (homeCluster && !config.remoteHosts[homeCluster]) { + homeCluster = undefined; + } dispatch(authActions.CONFIG({ config })); dispatch(authActions.SET_HOME_CLUSTER(config.loginCluster || homeCluster || config.uuidPrefix)); if (token && user) { diff --git a/src/views/site-manager-panel/site-manager-panel-root.tsx b/src/views/site-manager-panel/site-manager-panel-root.tsx index e75aa1f9..a8f7439a 100644 --- a/src/views/site-manager-panel/site-manager-panel-root.tsx +++ b/src/views/site-manager-panel/site-manager-panel-root.tsx @@ -133,8 +133,8 @@ export const SiteManagerPanelRoot = compose( Cluster ID Host - Username Email + UUID Status @@ -146,8 +146,8 @@ export const SiteManagerPanelRoot = compose( : session.clusterId} {session.remoteHost} - {validating ? : session.username} {validating ? : session.email} + {validating ? : session.uuid}