X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d924f14c5a81265fbd0f550ccf498fe791fc5b54..refs/heads/18881-process-runtime-status:/src/store/auth/auth-action-session.ts diff --git a/src/store/auth/auth-action-session.ts b/src/store/auth/auth-action-session.ts index f0093f9f..7e81f2d9 100644 --- a/src/store/auth/auth-action-session.ts +++ b/src/store/auth/auth-action-session.ts @@ -3,22 +3,22 @@ // SPDX-License-Identifier: AGPL-3.0 import { Dispatch } from "redux"; -import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions"; -import { RootState } from "~/store/store"; -import { ServiceRepository, createServices, setAuthorizationHeader } from "~/services/services"; -import Axios from "axios"; -import { User, getUserDisplayName } from "~/models/user"; -import { authActions } from "~/store/auth/auth-action"; +import { setBreadcrumbs } from "store/breadcrumbs/breadcrumbs-actions"; +import { RootState } from "store/store"; +import { ServiceRepository, createServices, setAuthorizationHeader } from "services/services"; +import Axios, { AxiosInstance } from "axios"; +import { User, getUserDisplayName } from "models/user"; +import { authActions } from "store/auth/auth-action"; import { Config, ClusterConfigJSON, CLUSTER_CONFIG_PATH, DISCOVERY_DOC_PATH, buildConfig, mockClusterConfigJSON -} from "~/common/config"; -import { normalizeURLPath } from "~/common/url"; -import { Session, SessionStatus } from "~/models/session"; -import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions"; -import { AuthService } from "~/services/auth-service/auth-service"; -import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions"; -import * as jsSHA from "jssha"; +} from "common/config"; +import { normalizeURLPath } from "common/url"; +import { Session, SessionStatus } from "models/session"; +import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions"; +import { AuthService } from "services/auth-service/auth-service"; +import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; +import jsSHA from "jssha"; const getClusterConfig = async (origin: string, apiClient: AxiosInstance): Promise => { let configFromDD: Config | undefined; @@ -27,6 +27,7 @@ const getClusterConfig = async (origin: string, apiClient: AxiosInstance): Promi configFromDD = { baseUrl: normalizeURLPath(dd.baseUrl), keepWebServiceUrl: dd.keepWebServiceUrl, + keepWebInlineServiceUrl: dd.keepWebInlineServiceUrl, remoteHosts: dd.remoteHosts, rootUrl: dd.rootUrl, uuidPrefix: dd.uuidPrefix, @@ -55,7 +56,7 @@ const getClusterConfig = async (origin: string, apiClient: AxiosInstance): Promi return null; }; -const getRemoteHostConfig = async (remoteHost: string, useApiClient?: AxiosInstance): Promise => { +export const getRemoteHostConfig = async (remoteHost: string, useApiClient?: AxiosInstance): Promise => { const apiClient = useApiClient || Axios.create({ headers: {} }); let url = remoteHost; @@ -98,7 +99,7 @@ export const getSaltedToken = (clusterId: string, token: string) => { throw new Error(invalidV2Token); } let salted = secret; - if (uuid.substr(0, 5) !== clusterId) { + if (uuid.substring(0, 5) !== clusterId) { shaObj.setHMACKey(secret, "TEXT"); shaObj.update(clusterId); salted = shaObj.getHMAC("HEX"); @@ -116,7 +117,7 @@ export const validateCluster = async (config: Config, useToken: string): const svc = createServices(config, { progressFn: () => { }, errorFn: () => { } }); setAuthorizationHeader(svc, saltedToken); - const user = await svc.authService.getUserDetails(); + const user = await svc.authService.getUserDetails(false); return { user, token: saltedToken, @@ -191,10 +192,11 @@ export const validateSessions = (useApiClient?: AxiosInstance) => places in Workbench2. */ await dispatch(validateSession(session, activeSession, useApiClient)); } catch (e) { - dispatch(snackbarActions.OPEN_SNACKBAR({ - message: e.message, - kind: SnackbarKind.ERROR - })); + // Don't do anything here. User may get + // spammed with multiple messages that are not + // helpful. They can see the individual + // errors by going to site manager and trying + // to toggle the session. } } } @@ -313,7 +315,7 @@ export const initSessions = (authService: AuthService, config: Config, user: Use (dispatch: Dispatch) => { const sessions = authService.buildSessions(config, user); dispatch(authActions.SET_SESSIONS(sessions)); - dispatch(validateSessions(authService.apiClient)); + dispatch(validateSessions(authService.getApiClient())); }; export const loadSiteManagerPanel = () =>