From: Daniel Kos Date: Tue, 18 Dec 2018 09:39:54 +0000 (+0100) Subject: Merge branch 'origin/master' into 14478-log-in-into-clusters X-Git-Tag: 1.4.0~71^2~16^2^2^2~3 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/f9dde5c781766b8be71d43d0f031c201a0edcfbb?hp=-c Merge branch 'origin/master' into 14478-log-in-into-clusters Feature #14478 # Conflicts: # src/common/config.ts # src/components/text-field/text-field.tsx # src/routes/route-change-handlers.ts # src/routes/routes.ts # src/services/auth-service/auth-service.ts # src/services/common-service/common-resource-service.ts # src/services/services.ts # src/store/auth/auth-action.ts # src/store/navigation/navigation-action.ts # src/store/workbench/workbench-actions.ts # src/validators/validators.tsx # src/views-components/main-app-bar/account-menu.tsx # src/views-components/main-content-bar/main-content-bar.tsx # src/views/workbench/workbench.tsx Arvados-DCO-1.1-Signed-off-by: Daniel Kos --- f9dde5c781766b8be71d43d0f031c201a0edcfbb diff --combined src/common/config.ts index d801c5fa,db67ed8d..3961d5aa --- a/src/common/config.ts +++ b/src/common/config.ts @@@ -35,9 -35,7 +35,9 @@@ export interface Config packageVersion: string; parameters: {}; protocol: string; - remoteHosts: string; + remoteHosts: { + [key: string]: string + }; remoteHostsViaDNS: boolean; resources: {}; revision: string; @@@ -52,7 -50,7 +52,7 @@@ websocketUrl: string; workbenchUrl: string; vocabularyUrl: string; - origin: string; + fileViewersConfigUrl: string; } export const fetchConfig = () => { @@@ -64,7 -62,12 +64,12 @@@ .get(getDiscoveryURL(config.API_HOST)) .then(response => ({ // TODO: After tests delete `|| '/vocabulary-example.json'` - config: {...response.data, vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json' }, + // TODO: After tests delete `|| '/file-viewers-example.json'` + config: { + ...response.data, + vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json', + fileViewersConfigUrl: config.FILE_VIEWERS_CONFIG_URL || '/file-viewers-example.json' + }, apiHost: config.API_HOST, }))); @@@ -99,7 -102,7 +104,7 @@@ export const mockConfig = (config: Part packageVersion: '', parameters: {}, protocol: '', - remoteHosts: '', + remoteHosts: {}, remoteHostsViaDNS: false, resources: {}, revision: '', @@@ -114,19 -117,20 +119,21 @@@ websocketUrl: '', workbenchUrl: '', vocabularyUrl: '', - origin: '', + fileViewersConfigUrl: '', ...config }); interface ConfigJSON { API_HOST: string; VOCABULARY_URL: string; + FILE_VIEWERS_CONFIG_URL: string; } const getDefaultConfig = (): ConfigJSON => ({ API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || "", VOCABULARY_URL: "", + FILE_VIEWERS_CONFIG_URL: "", }); -const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`; +export const DISCOVERY_URL = 'discovery/v1/apis/arvados/v1/rest'; +const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/${DISCOVERY_URL}`; diff --combined src/components/text-field/text-field.tsx index 0ebb46bc,627e004d..93c4080f --- a/src/components/text-field/text-field.tsx +++ b/src/components/text-field/text-field.tsx @@@ -5,15 -5,8 +5,15 @@@ import * as React from 'react'; import { WrappedFieldProps } from 'redux-form'; import { ArvadosTheme } from '~/common/custom-theme'; -import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core'; +import { + TextField as MaterialTextField, + StyleRulesCallback, + WithStyles, + withStyles, + PropTypes +} from '@material-ui/core'; import RichTextEditor from 'react-rte'; +import Margin = PropTypes.Margin; type CssRules = 'textField'; @@@ -25,14 -18,14 +25,14 @@@ const styles: StyleRulesCallback; -export const TextField = withStyles(styles)((props: TextFieldProps & { - label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode +export const TextField = withStyles(styles)((props: TextFieldProps & { - label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string ++ label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string }) => ); @@@ -87,4 -78,4 +87,4 @@@ export const DateTextField = withStyles onChange={props.input.onChange} value={props.input.value} /> - ); + ); diff --combined src/index.tsx index aaca125e,7cd4ae9a..1b7a281d --- a/src/index.tsx +++ b/src/index.tsx @@@ -5,31 -5,31 +5,31 @@@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Provider } from "react-redux"; - import { MainPanel } from './views/main-panel/main-panel'; - import './index.css'; + import { MainPanel } from '~/views/main-panel/main-panel'; + import '~/index.css'; import { Route, Switch } from 'react-router'; import createBrowserHistory from "history/createBrowserHistory"; import { History } from "history"; - import { configureStore, RootStore } from './store/store'; + import { configureStore, RootStore } from '~/store/store'; import { ConnectedRouter } from "react-router-redux"; - import { ApiToken } from "./views-components/api-token/api-token"; - import { initAuth } from "./store/auth/auth-action"; - import { createServices } from "./services/services"; + import { ApiToken } from "~/views-components/api-token/api-token"; + import { initAuth } from "~/store/auth/auth-action"; + import { createServices } from "~/services/services"; import { MuiThemeProvider } from '@material-ui/core/styles'; - import { CustomTheme } from './common/custom-theme'; - import { fetchConfig } from './common/config'; - import { addMenuActionSet, ContextMenuKind } from './views-components/context-menu/context-menu'; - import { rootProjectActionSet } from "./views-components/context-menu/action-sets/root-project-action-set"; - import { projectActionSet } from "./views-components/context-menu/action-sets/project-action-set"; - import { resourceActionSet } from './views-components/context-menu/action-sets/resource-action-set'; - import { favoriteActionSet } from "./views-components/context-menu/action-sets/favorite-action-set"; - import { collectionFilesActionSet } from './views-components/context-menu/action-sets/collection-files-action-set'; - import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set'; - import { collectionFilesNotSelectedActionSet } from './views-components/context-menu/action-sets/collection-files-not-selected-action-set'; - import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set'; - import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set'; - import { processActionSet } from './views-components/context-menu/action-sets/process-action-set'; - import { loadWorkbench } from './store/workbench/workbench-actions'; + import { CustomTheme } from '~/common/custom-theme'; + import { fetchConfig } from '~/common/config'; + import { addMenuActionSet, ContextMenuKind } from '~/views-components/context-menu/context-menu'; + import { rootProjectActionSet } from "~/views-components/context-menu/action-sets/root-project-action-set"; + import { projectActionSet } from "~/views-components/context-menu/action-sets/project-action-set"; + import { resourceActionSet } from '~/views-components/context-menu/action-sets/resource-action-set'; + import { favoriteActionSet } from "~/views-components/context-menu/action-sets/favorite-action-set"; + import { collectionFilesActionSet } from '~/views-components/context-menu/action-sets/collection-files-action-set'; + import { collectionFilesItemActionSet } from '~/views-components/context-menu/action-sets/collection-files-item-action-set'; + import { collectionFilesNotSelectedActionSet } from '~/views-components/context-menu/action-sets/collection-files-not-selected-action-set'; + import { collectionActionSet } from '~/views-components/context-menu/action-sets/collection-action-set'; + import { collectionResourceActionSet } from '~/views-components/context-menu/action-sets/collection-resource-action-set'; + import { processActionSet } from '~/views-components/context-menu/action-sets/process-action-set'; + import { loadWorkbench } from '~/store/workbench/workbench-actions'; import { Routes } from '~/routes/routes'; import { trashActionSet } from "~/views-components/context-menu/action-sets/trash-action-set"; import { ServiceRepository } from '~/services/services'; @@@ -53,7 -53,13 +53,13 @@@ import { sshKeyActionSet } from '~/view import { keepServiceActionSet } from '~/views-components/context-menu/action-sets/keep-service-action-set'; import { loadVocabulary } from '~/store/vocabulary/vocabulary-actions'; import { virtualMachineActionSet } from '~/views-components/context-menu/action-sets/virtual-machine-action-set'; + import { userActionSet } from '~/views-components/context-menu/action-sets/user-action-set'; import { computeNodeActionSet } from '~/views-components/context-menu/action-sets/compute-node-action-set'; + import { apiClientAuthorizationActionSet } from '~/views-components/context-menu/action-sets/api-client-authorization-action-set'; + import { groupActionSet } from '~/views-components/context-menu/action-sets/group-action-set'; + import { groupMemberActionSet } from '~/views-components/context-menu/action-sets/group-member-action-set'; + import { linkActionSet } from '~/views-components/context-menu/action-sets/link-action-set'; + import { loadFileViewersConfig } from '~/store/file-viewers/file-viewers-actions'; console.log(`Starting arvados [${getBuildInfo()}]`); @@@ -74,7 -80,12 +80,12 @@@ addMenuActionSet(ContextMenuKind.REPOSI addMenuActionSet(ContextMenuKind.SSH_KEY, sshKeyActionSet); addMenuActionSet(ContextMenuKind.VIRTUAL_MACHINE, virtualMachineActionSet); addMenuActionSet(ContextMenuKind.KEEP_SERVICE, keepServiceActionSet); + addMenuActionSet(ContextMenuKind.USER, userActionSet); + addMenuActionSet(ContextMenuKind.LINK, linkActionSet); addMenuActionSet(ContextMenuKind.NODE, computeNodeActionSet); + addMenuActionSet(ContextMenuKind.API_CLIENT_AUTHORIZATION, apiClientAuthorizationActionSet); + addMenuActionSet(ContextMenuKind.GROUPS, groupActionSet); + addMenuActionSet(ContextMenuKind.GROUP_MEMBER, groupMemberActionSet); fetchConfig() .then(({ config, apiHost }) => { @@@ -91,11 -102,12 +102,12 @@@ const store = configureStore(history, services); store.subscribe(initListener(history, store, services, config)); - store.dispatch(initAuth()); + store.dispatch(initAuth(config)); store.dispatch(setBuildInfo()); store.dispatch(setCurrentTokenDialogApiHost(apiHost)); store.dispatch(setUuidPrefix(config.uuidPrefix)); store.dispatch(loadVocabulary); + store.dispatch(loadFileViewersConfig); const TokenComponent = (props: any) => ; const MainPanelComponent = (props: any) => ; diff --combined src/routes/route-change-handlers.ts index 0637a384,03e2a38a..bb88f4a1 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@@ -7,6 -7,9 +7,9 @@@ import { RootStore } from '~/store/stor import * as Routes from '~/routes/routes'; import * as WorkbenchActions from '~/store/workbench/workbench-actions'; import { navigateToRootProject } from '~/store/navigation/navigation-action'; + import { dialogActions } from '~/store/dialog/dialog-actions'; + import { contextMenuActions } from '~/store/context-menu/context-menu-actions'; + import { searchBarActions } from '~/store/search-bar/search-bar-actions'; export const addRouteChangeHandlers = (history: History, store: RootStore) => { const handler = handleLocationChange(store); @@@ -26,12 -29,23 +29,24 @@@ const handleLocationChange = (store: Ro const searchResultsMatch = Routes.matchSearchResultsRoute(pathname); const sharedWithMeMatch = Routes.matchSharedWithMeRoute(pathname); const runProcessMatch = Routes.matchRunProcessRoute(pathname); - const virtualMachineMatch = Routes.matchVirtualMachineRoute(pathname); + const virtualMachineUserMatch = Routes.matchUserVirtualMachineRoute(pathname); + const virtualMachineAdminMatch = Routes.matchAdminVirtualMachineRoute(pathname); const workflowMatch = Routes.matchWorkflowRoute(pathname); - const sshKeysMatch = Routes.matchSshKeysRoute(pathname); + const sshKeysUserMatch = Routes.matchSshKeysUserRoute(pathname); + const sshKeysAdminMatch = Routes.matchSshKeysAdminRoute(pathname); + const siteManagerMatch = Routes.matchSiteManagerRoute(pathname); const keepServicesMatch = Routes.matchKeepServicesRoute(pathname); const computeNodesMatch = Routes.matchComputeNodesRoute(pathname); + const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(pathname); + const myAccountMatch = Routes.matchMyAccountRoute(pathname); + const userMatch = Routes.matchUsersRoute(pathname); + const groupsMatch = Routes.matchGroupsRoute(pathname); + const groupDetailsMatch = Routes.matchGroupDetailsRoute(pathname); + const linksMatch = Routes.matchLinksRoute(pathname); + + store.dispatch(dialogActions.CLOSE_ALL_DIALOGS()); + store.dispatch(contextMenuActions.CLOSE_CONTEXT_MENU()); + store.dispatch(searchBarActions.CLOSE_SEARCH_VIEW()); if (projectMatch) { store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id)); @@@ -55,17 -69,31 +70,33 @@@ store.dispatch(WorkbenchActions.loadWorkflow); } else if (searchResultsMatch) { store.dispatch(WorkbenchActions.loadSearchResults); - } else if (virtualMachineMatch) { + } else if (virtualMachineUserMatch) { + store.dispatch(WorkbenchActions.loadVirtualMachines); + } else if (virtualMachineAdminMatch) { store.dispatch(WorkbenchActions.loadVirtualMachines); - } else if(repositoryMatch) { + } else if (repositoryMatch) { store.dispatch(WorkbenchActions.loadRepositories); - } else if (sshKeysMatch) { + } else if (sshKeysUserMatch) { + store.dispatch(WorkbenchActions.loadSshKeys); + } else if (sshKeysAdminMatch) { store.dispatch(WorkbenchActions.loadSshKeys); + } else if (siteManagerMatch) { + store.dispatch(WorkbenchActions.loadSiteManager); } else if (keepServicesMatch) { store.dispatch(WorkbenchActions.loadKeepServices); } else if (computeNodesMatch) { store.dispatch(WorkbenchActions.loadComputeNodes); + } else if (apiClientAuthorizationsMatch) { + store.dispatch(WorkbenchActions.loadApiClientAuthorizations); + } else if (myAccountMatch) { + store.dispatch(WorkbenchActions.loadMyAccount); + } else if (userMatch) { + store.dispatch(WorkbenchActions.loadUsers); + } else if (groupsMatch) { + store.dispatch(WorkbenchActions.loadGroupsPanel); + } else if (groupDetailsMatch) { + store.dispatch(WorkbenchActions.loadGroupDetailsPanel(groupDetailsMatch.params.id)); + } else if (linksMatch) { + store.dispatch(WorkbenchActions.loadLinks); } }; diff --combined src/routes/routes.ts index b5cb0aca,661a065e..b1da9496 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@@ -19,13 -19,20 +19,21 @@@ export const Routes = REPOSITORIES: '/repositories', SHARED_WITH_ME: '/shared-with-me', RUN_PROCESS: '/run-process', - VIRTUAL_MACHINES: '/virtual-machines', + VIRTUAL_MACHINES_ADMIN: '/virtual-machines-admin', + VIRTUAL_MACHINES_USER: '/virtual-machines-user', WORKFLOWS: '/workflows', SEARCH_RESULTS: '/search-results', - SSH_KEYS: `/ssh-keys`, + SSH_KEYS_ADMIN: `/ssh-keys-admin`, + SSH_KEYS_USER: `/ssh-keys-user`, + SITE_MANAGER: `/site-manager`, + MY_ACCOUNT: '/my-account', KEEP_SERVICES: `/keep-services`, - COMPUTE_NODES: `/nodes` + COMPUTE_NODES: `/nodes`, + USERS: '/users', + API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations`, + GROUPS: '/groups', + GROUP_DETAILS: `/group/:id(${RESOURCE_UUID_PATTERN})`, + LINKS: '/links' }; export const getResourceUrl = (uuid: string) => { @@@ -46,6 -53,8 +54,8 @@@ export const getProcessUrl = (uuid: str export const getProcessLogUrl = (uuid: string) => `/process-logs/${uuid}`; + export const getGroupUrl = (uuid: string) => `/group/${uuid}`; + export interface ResourceRouteParams { id: string; } @@@ -83,20 -92,41 +93,44 @@@ export const matchWorkflowRoute = (rout export const matchSearchResultsRoute = (route: string) => matchPath(route, { path: Routes.SEARCH_RESULTS }); - export const matchVirtualMachineRoute = (route: string) => - matchPath(route, { path: Routes.VIRTUAL_MACHINES }); + export const matchUserVirtualMachineRoute = (route: string) => + matchPath(route, { path: Routes.VIRTUAL_MACHINES_USER }); + + export const matchAdminVirtualMachineRoute = (route: string) => + matchPath(route, { path: Routes.VIRTUAL_MACHINES_ADMIN }); export const matchRepositoriesRoute = (route: string) => matchPath(route, { path: Routes.REPOSITORIES }); - export const matchSshKeysRoute = (route: string) => - matchPath(route, { path: Routes.SSH_KEYS }); + export const matchSshKeysUserRoute = (route: string) => + matchPath(route, { path: Routes.SSH_KEYS_USER }); + + export const matchSshKeysAdminRoute = (route: string) => + matchPath(route, { path: Routes.SSH_KEYS_ADMIN }); +export const matchSiteManagerRoute = (route: string) => + matchPath(route, { path: Routes.SITE_MANAGER }); + + export const matchMyAccountRoute = (route: string) => + matchPath(route, { path: Routes.MY_ACCOUNT }); + export const matchKeepServicesRoute = (route: string) => matchPath(route, { path: Routes.KEEP_SERVICES }); + export const matchUsersRoute = (route: string) => + matchPath(route, { path: Routes.USERS }); + export const matchComputeNodesRoute = (route: string) => matchPath(route, { path: Routes.COMPUTE_NODES }); + + export const matchApiClientAuthorizationsRoute = (route: string) => + matchPath(route, { path: Routes.API_CLIENT_AUTHORIZATIONS }); + + export const matchGroupsRoute = (route: string) => + matchPath(route, { path: Routes.GROUPS }); + + export const matchGroupDetailsRoute = (route: string) => + matchPath(route, { path: Routes.GROUP_DETAILS }); + + export const matchLinksRoute = (route: string) => + matchPath(route, { path: Routes.LINKS }); diff --combined src/services/auth-service/auth-service.ts index 1492ef1c,22c9dcd6..8601e208 --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@@ -2,13 -2,10 +2,13 @@@ // // SPDX-License-Identifier: AGPL-3.0 - import { getUserFullname, User } from "~/models/user"; -import { User, UserPrefs } from "~/models/user"; ++import { getUserFullname, User, UserPrefs } from "~/models/user"; import { AxiosInstance } from "axios"; import { ApiActions } from "~/services/api/api-actions"; import * as uuid from "uuid/v4"; +import { Session, SessionStatus } from "~/models/session"; +import { Config } from "~/common/config"; +import { uniqBy } from "lodash"; export const API_TOKEN_KEY = 'apiToken'; export const USER_EMAIL_KEY = 'userEmail'; @@@ -17,6 -14,8 +17,8 @@@ export const USER_LAST_NAME_KEY = 'user export const USER_UUID_KEY = 'userUuid'; export const USER_OWNER_UUID_KEY = 'userOwnerUuid'; export const USER_IS_ADMIN = 'isAdmin'; + export const USER_IDENTITY_URL = 'identityUrl'; + export const USER_PREFS = 'prefs'; export interface UserDetailsResponse { email: string; @@@ -25,6 -24,8 +27,8 @@@ uuid: string; owner_uuid: string; is_admin: boolean; + identity_url: string; + prefs: UserPrefs; } export class AuthService { @@@ -65,9 -66,11 +69,11 @@@ const uuid = this.getUuid(); const ownerUuid = this.getOwnerUuid(); const isAdmin = this.getIsAdmin(); + const identityUrl = localStorage.getItem(USER_IDENTITY_URL); + const prefs = JSON.parse(localStorage.getItem(USER_PREFS) || '{"profile": {}}'); - return email && firstName && lastName && uuid && ownerUuid - ? { email, firstName, lastName, uuid, ownerUuid, isAdmin } + return email && firstName && lastName && uuid && ownerUuid && identityUrl && prefs + ? { email, firstName, lastName, uuid, ownerUuid, isAdmin, identityUrl, prefs } : undefined; } @@@ -78,6 -81,8 +84,8 @@@ localStorage.setItem(USER_UUID_KEY, user.uuid); localStorage.setItem(USER_OWNER_UUID_KEY, user.ownerUuid); localStorage.setItem(USER_IS_ADMIN, JSON.stringify(user.isAdmin)); + localStorage.setItem(USER_IDENTITY_URL, user.identityUrl); + localStorage.setItem(USER_PREFS, JSON.stringify(user.prefs)); } public removeUser() { @@@ -87,6 -92,8 +95,8 @@@ localStorage.removeItem(USER_UUID_KEY); localStorage.removeItem(USER_OWNER_UUID_KEY); localStorage.removeItem(USER_IS_ADMIN); + localStorage.removeItem(USER_IDENTITY_URL); + localStorage.removeItem(USER_PREFS); } public login() { @@@ -106,13 -113,16 +116,16 @@@ .get('/users/current') .then(resp => { this.actions.progressFn(reqId, false); + const prefs = resp.data.prefs.profile ? resp.data.prefs : { profile: {}}; return { email: resp.data.email, firstName: resp.data.first_name, lastName: resp.data.last_name, uuid: resp.data.uuid, ownerUuid: resp.data.owner_uuid, - isAdmin: resp.data.is_admin + isAdmin: resp.data.is_admin, + identityUrl: resp.data.identity_url, + prefs }; }) .catch(e => { @@@ -127,53 -137,4 +140,53 @@@ const uuidParts = uuid ? uuid.split('-') : []; return uuidParts.length > 1 ? `${uuidParts[0]}-${uuidParts[1]}` : undefined; } + + public getSessions(): Session[] { + try { + const sessions = JSON.parse(localStorage.getItem("sessions") || ''); + return sessions; + } catch { + return []; + } + } + + public saveSessions(sessions: Session[]) { + localStorage.setItem("sessions", JSON.stringify(sessions)); + } + + public buildSessions(cfg: Config, user?: User) { + const currentSession = { + clusterId: cfg.uuidPrefix, + remoteHost: cfg.rootUrl, + baseUrl: cfg.baseUrl, + username: getUserFullname(user), + email: user ? user.email : '', + token: this.getApiToken(), + loggedIn: true, + active: true, + status: SessionStatus.VALIDATED + } as Session; + const localSessions = this.getSessions(); + const cfgSessions = Object.keys(cfg.remoteHosts).map(clusterId => { + const remoteHost = cfg.remoteHosts[clusterId]; + return { + clusterId, + remoteHost, + baseUrl: '', + username: '', + email: '', + token: '', + loggedIn: false, + active: false, + status: SessionStatus.INVALIDATED + } as Session; + }); + const sessions = [currentSession] + .concat(localSessions) + .concat(cfgSessions); + + const uniqSessions = uniqBy(sessions, 'clusterId'); + + return uniqSessions; + } } diff --combined src/store/auth/auth-action-session.ts index 4a6f56f9,00000000..83e98e96 mode 100644,000000..100644 --- a/src/store/auth/auth-action-session.ts +++ b/src/store/auth/auth-action-session.ts @@@ -1,206 -1,0 +1,208 @@@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { Dispatch } from "redux"; +import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions"; +import { RootState } from "~/store/store"; +import { ServiceRepository } from "~/services/services"; +import Axios from "axios"; +import { getUserFullname, User } from "~/models/user"; +import { authActions } from "~/store/auth/auth-action"; +import { Config, DISCOVERY_URL } from "~/common/config"; +import { Session, SessionStatus } from "~/models/session"; +import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions"; +import { UserDetailsResponse } from "~/services/auth-service/auth-service"; +import * as jsSHA from "jssha"; + +const getRemoteHostBaseUrl = async (remoteHost: string): Promise => { + let url = remoteHost; + if (url.indexOf('://') < 0) { + url = 'https://' + url; + } + const origin = new URL(url).origin; + let baseUrl: string | null = null; + + try { + const resp = await Axios.get(`${origin}/${DISCOVERY_URL}`); + baseUrl = resp.data.baseUrl; + } catch (err) { + try { + const resp = await Axios.get(`${origin}/status.json`); + baseUrl = resp.data.apiBaseURL; + } catch (err) { + } + } + + if (baseUrl && baseUrl[baseUrl.length - 1] === '/') { + baseUrl = baseUrl.substr(0, baseUrl.length - 1); + } + + return baseUrl; +}; + +const getUserDetails = async (baseUrl: string, token: string): Promise => { + const resp = await Axios.get(`${baseUrl}/users/current`, { + headers: { + Authorization: `OAuth2 ${token}` + } + }); + return resp.data; +}; + +const getTokenUuid = async (baseUrl: string, token: string): Promise => { + if (token.startsWith("v2/")) { + const uuid = token.split("/")[1]; + return Promise.resolve(uuid); + } + + const resp = await Axios.get(`${baseUrl}/api_client_authorizations`, { + headers: { + Authorization: `OAuth2 ${token}` + }, + data: { + filters: JSON.stringify([['api_token', '=', token]]) + } + }); + + return resp.data.items[0].uuid; +}; + +const getSaltedToken = (clusterId: string, tokenUuid: string, token: string) => { + const shaObj = new jsSHA("SHA-1", "TEXT"); + let secret = token; + if (token.startsWith("v2/")) { + secret = token.split("/")[2]; + } + shaObj.setHMACKey(secret, "TEXT"); + shaObj.update(clusterId); + const hmac = shaObj.getHMAC("HEX"); + return `v2/${tokenUuid}/${hmac}`; +}; + +const clusterLogin = async (clusterId: string, baseUrl: string, activeSession: Session): Promise<{user: User, token: string}> => { + const tokenUuid = await getTokenUuid(activeSession.baseUrl, activeSession.token); + const saltedToken = getSaltedToken(clusterId, tokenUuid, activeSession.token); + const user = await getUserDetails(baseUrl, saltedToken); + return { + user: { + firstName: user.first_name, + lastName: user.last_name, + uuid: user.uuid, + ownerUuid: user.owner_uuid, + email: user.email, - isAdmin: user.is_admin ++ isAdmin: user.is_admin, ++ identityUrl: user.identity_url, ++ prefs: user.prefs + }, + token: saltedToken + }; +}; + +const getActiveSession = (sessions: Session[]): Session | undefined => sessions.find(s => s.active); + +export const validateCluster = async (remoteHost: string, clusterId: string, activeSession: Session): Promise<{ user: User; token: string, baseUrl: string }> => { + const baseUrl = await getRemoteHostBaseUrl(remoteHost); + if (!baseUrl) { + return Promise.reject(`Could not find base url for ${remoteHost}`); + } + const { user, token } = await clusterLogin(clusterId, baseUrl, activeSession); + return { baseUrl, user, token }; +}; + +export const validateSession = (session: Session, activeSession: Session) => + async (dispatch: Dispatch): Promise => { + dispatch(authActions.UPDATE_SESSION({ ...session, status: SessionStatus.BEING_VALIDATED })); + session.loggedIn = false; + try { + const { baseUrl, user, token } = await validateCluster(session.remoteHost, session.clusterId, activeSession); + session.baseUrl = baseUrl; + session.token = token; + session.email = user.email; + session.username = getUserFullname(user); + session.loggedIn = true; + } catch { + session.loggedIn = false; + } finally { + session.status = SessionStatus.VALIDATED; + dispatch(authActions.UPDATE_SESSION(session)); + } + return session; + }; + +export const validateSessions = () => + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const sessions = getState().auth.sessions; + const activeSession = getActiveSession(sessions); + if (activeSession) { + dispatch(progressIndicatorActions.START_WORKING("sessionsValidation")); + for (const session of sessions) { + if (session.status === SessionStatus.INVALIDATED) { + await dispatch(validateSession(session, activeSession)); + } + } + services.authService.saveSessions(sessions); + dispatch(progressIndicatorActions.STOP_WORKING("sessionsValidation")); + } + }; + +export const addSession = (remoteHost: string) => + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const sessions = getState().auth.sessions; + const activeSession = getActiveSession(sessions); + if (activeSession) { + const clusterId = remoteHost.match(/^(\w+)\./)![1]; + if (sessions.find(s => s.clusterId === clusterId)) { + return Promise.reject("Cluster already exists"); + } + try { + const { baseUrl, user, token } = await validateCluster(remoteHost, clusterId, activeSession); + const session = { + loggedIn: true, + status: SessionStatus.VALIDATED, + active: false, + email: user.email, + username: getUserFullname(user), + remoteHost, + baseUrl, + clusterId, + token + }; + + dispatch(authActions.ADD_SESSION(session)); + services.authService.saveSessions(getState().auth.sessions); + + return session; + } catch (e) { + } + } + return Promise.reject("Could not validate cluster"); + }; + +export const toggleSession = (session: Session) => + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + let s = { ...session }; + + if (session.loggedIn) { + s.loggedIn = false; + } else { + const sessions = getState().auth.sessions; + const activeSession = getActiveSession(sessions); + if (activeSession) { + s = await dispatch(validateSession(s, activeSession)) as Session; + } + } + + dispatch(authActions.UPDATE_SESSION(s)); + services.authService.saveSessions(getState().auth.sessions); + }; + +export const loadSiteManagerPanel = () => + async (dispatch: Dispatch) => { + try { + dispatch(setBreadcrumbs([{ label: 'Site Manager'}])); + dispatch(validateSessions()); + } catch (e) { + return; + } + }; diff --combined src/store/auth/auth-action.test.ts index 6d28eb47,ed223795..d58c9159 --- a/src/store/auth/auth-action.test.ts +++ b/src/store/auth/auth-action.test.ts @@@ -11,14 -11,14 +11,14 @@@ import USER_LAST_NAME_KEY, USER_OWNER_UUID_KEY, USER_UUID_KEY, - USER_IS_ADMIN + USER_IS_ADMIN, USER_IDENTITY_URL, USER_PREFS } from "~/services/auth-service/auth-service"; import 'jest-localstorage-mock'; import { createServices } from "~/services/services"; import { configureStore, RootStore } from "../store"; import createBrowserHistory from "history/createBrowserHistory"; -import { mockConfig } from '~/common/config'; +import { Config, mockConfig } from '~/common/config'; import { ApiActions } from "~/services/api/api-actions"; describe('auth-actions', () => { @@@ -42,14 -42,12 +42,16 @@@ localStorage.setItem(USER_FIRST_NAME_KEY, "John"); localStorage.setItem(USER_LAST_NAME_KEY, "Doe"); localStorage.setItem(USER_UUID_KEY, "uuid"); + localStorage.setItem(USER_IDENTITY_URL, "identityUrl"); + localStorage.setItem(USER_PREFS, JSON.stringify({})); localStorage.setItem(USER_OWNER_UUID_KEY, "ownerUuid"); localStorage.setItem(USER_IS_ADMIN, JSON.stringify("false")); - store.dispatch(initAuth()); + const config: any = { + remoteHosts: { "xc59": "xc59.api.arvados.com" } + }; + + store.dispatch(initAuth(config)); expect(store.getState().auth).toEqual({ apiToken: "token", @@@ -60,6 -58,8 +62,8 @@@ lastName: "Doe", uuid: "uuid", ownerUuid: "ownerUuid", + identityUrl: "identityUrl", + prefs: {}, isAdmin: false } }); diff --combined src/store/navigation/navigation-action.ts index 8e3929d9,c53c55e8..f610eb5e --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@@ -8,9 -8,10 +8,10 @@@ import { ResourceKind, extractUuidKind import { getCollectionUrl } from "~/models/collection"; import { getProjectUrl } from "~/models/project"; import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions'; - import { Routes, getProcessUrl, getProcessLogUrl } from '~/routes/routes'; + import { Routes, getProcessUrl, getProcessLogUrl, getGroupUrl } from '~/routes/routes'; import { RootState } from '~/store/store'; import { ServiceRepository } from '~/services/services'; + import { GROUPS_PANEL_LABEL } from '~/store/breadcrumbs/breadcrumbs-actions'; export const navigateTo = (uuid: string) => async (dispatch: Dispatch) => { @@@ -21,6 -22,8 +22,8 @@@ dispatch(navigateToCollection(uuid)); } else if (kind === ResourceKind.CONTAINER_REQUEST) { dispatch(navigateToProcess(uuid)); + } else if (kind === ResourceKind.VIRTUAL_MACHINE) { + dispatch(navigateToAdminVirtualMachines); } if (uuid === SidePanelTreeCategory.FAVORITES) { dispatch(navigateToFavorites); @@@ -30,6 -33,8 +33,8 @@@ dispatch(navigateToWorkflows); } else if (uuid === SidePanelTreeCategory.TRASH) { dispatch(navigateToTrash); + } else if (uuid === GROUPS_PANEL_LABEL) { + dispatch(navigateToGroups); } }; @@@ -62,14 -67,28 +67,30 @@@ export const navigateToRunProcess = pus export const navigateToSearchResults = push(Routes.SEARCH_RESULTS); - export const navigateToVirtualMachines = push(Routes.VIRTUAL_MACHINES); + export const navigateToUserVirtualMachines = push(Routes.VIRTUAL_MACHINES_USER); + + export const navigateToAdminVirtualMachines = push(Routes.VIRTUAL_MACHINES_ADMIN); export const navigateToRepositories = push(Routes.REPOSITORIES); - export const navigateToSshKeys= push(Routes.SSH_KEYS); + export const navigateToSshKeysAdmin= push(Routes.SSH_KEYS_ADMIN); + + export const navigateToSshKeysUser= push(Routes.SSH_KEYS_USER); +export const navigateToSiteManager= push(Routes.SITE_MANAGER); + + export const navigateToMyAccount = push(Routes.MY_ACCOUNT); + export const navigateToKeepServices = push(Routes.KEEP_SERVICES); export const navigateToComputeNodes = push(Routes.COMPUTE_NODES); + + export const navigateToUsers = push(Routes.USERS); + + export const navigateToApiClientAuthorizations = push(Routes.API_CLIENT_AUTHORIZATIONS); + + export const navigateToGroups = push(Routes.GROUPS); + + export const navigateToGroupDetails = compose(push, getGroupUrl); + + export const navigateToLinks = push(Routes.LINKS); diff --combined src/store/workbench/workbench-actions.ts index fdef38c4,5e9dc285..46ab1f59 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@@ -14,7 -14,7 +14,7 @@@ import { favoritePanelActions } from '~ import { projectPanelColumns } from '~/views/project-panel/project-panel'; import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel'; import { matchRootRoute } from '~/routes/routes'; - import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs, setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions'; + import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs, setBreadcrumbs, setGroupDetailsBreadcrumbs, setGroupsBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions'; import { navigateToProject } from '~/store/navigation/navigation-action'; import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog'; import { ServiceRepository } from '~/services/services'; @@@ -39,8 -39,8 +39,9 @@@ import { sharedWithMePanelActions } fro import { loadSharedWithMePanel } from '~/store/shared-with-me-panel/shared-with-me-panel-actions'; import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog'; import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions'; -import { loadSshKeysPanel } from '~/store/auth/auth-action'; +import { loadSshKeysPanel } from '~/store/auth/auth-action-ssh'; + import { loadMyAccountPanel } from '~/store/my-account/my-account-panel-actions'; +import { loadSiteManagerPanel } from '~/store/auth/auth-action-session'; import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view'; import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions'; import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer'; @@@ -58,7 -58,17 +59,17 @@@ import { searchResultsPanelColumns } fr import { loadVirtualMachinesPanel } from '~/store/virtual-machines/virtual-machines-actions'; import { loadRepositoriesPanel } from '~/store/repositories/repositories-actions'; import { loadKeepServicesPanel } from '~/store/keep-services/keep-services-actions'; - import { loadComputeNodesPanel } from '~/store/compute-nodes/compute-nodes-actions'; + import { loadUsersPanel, userBindedActions } from '~/store/users/users-actions'; + import { loadLinkPanel, linkPanelActions } from '~/store/link-panel/link-panel-actions'; + import { loadComputeNodesPanel, computeNodesActions } from '~/store/compute-nodes/compute-nodes-actions'; + import { linkPanelColumns } from '~/views/link-panel/link-panel-root'; + import { userPanelColumns } from '~/views/user-panel/user-panel'; + import { computeNodePanelColumns } from '~/views/compute-node-panel/compute-node-panel-root'; + import { loadApiClientAuthorizationsPanel } from '~/store/api-client-authorizations/api-client-authorizations-actions'; + import * as groupPanelActions from '~/store/groups-panel/groups-panel-actions'; + import { groupsPanelColumns } from '~/views/groups-panel/groups-panel'; + import * as groupDetailsPanelActions from '~/store/group-details-panel/group-details-panel-actions'; + import { groupDetailsPanelColumns } from '~/views/group-details-panel/group-details-panel'; export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen'; @@@ -78,7 -88,6 +89,6 @@@ const handleFirstTimeLoad = (action: an } }; - export const loadWorkbench = () => async (dispatch: Dispatch, getState: () => RootState) => { dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN)); @@@ -93,6 -102,11 +103,11 @@@ dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns })); dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns })); dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns })); + dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns })); + dispatch(groupPanelActions.GroupsPanelActions.SET_COLUMNS({ columns: groupsPanelColumns })); + dispatch(groupDetailsPanelActions.GroupDetailsPanelActions.SET_COLUMNS({columns: groupDetailsPanelColumns})); + dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns })); + dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns })); dispatch(initSidePanelTree()); if (router.location) { const match = matchRootRoute(router.location.pathname); @@@ -130,7 -144,10 +145,10 @@@ export const loadProject = (uuid: strin const userUuid = services.authService.getUuid(); dispatch(setIsProjectPanelTrashed(false)); if (userUuid) { - if (userUuid !== uuid) { + if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) { + // Load another users home projects + dispatch(finishLoadingProject(uuid)); + } else if (userUuid !== uuid) { const match = await loadGroupContentsResource({ uuid, userUuid, services }); match({ OWNED: async project => { @@@ -396,6 -413,11 +414,11 @@@ export const loadSearchResults = handle await dispatch(loadSearchResultsPanel()); }); + export const loadLinks = handleFirstTimeLoad( + async (dispatch: Dispatch) => { + await dispatch(loadLinkPanel()); + }); + export const loadVirtualMachines = handleFirstTimeLoad( async (dispatch: Dispatch) => { await dispatch(loadVirtualMachinesPanel()); @@@ -413,9 -435,9 +436,14 @@@ export const loadSshKeys = handleFirstT await dispatch(loadSshKeysPanel()); }); +export const loadSiteManager = handleFirstTimeLoad( - async (dispatch: Dispatch) => { - await dispatch(loadSiteManagerPanel()); ++async (dispatch: Dispatch) => { ++ await dispatch(loadSiteManagerPanel()); ++}); ++ + export const loadMyAccount = handleFirstTimeLoad( + (dispatch: Dispatch) => { + dispatch(loadMyAccountPanel()); }); export const loadKeepServices = handleFirstTimeLoad( @@@ -423,11 -445,36 +451,36 @@@ await dispatch(loadKeepServicesPanel()); }); + export const loadUsers = handleFirstTimeLoad( + async (dispatch: Dispatch) => { + await dispatch(loadUsersPanel()); + dispatch(setBreadcrumbs([{ label: 'Users' }])); + }); + export const loadComputeNodes = handleFirstTimeLoad( async (dispatch: Dispatch) => { await dispatch(loadComputeNodesPanel()); }); + export const loadApiClientAuthorizations = handleFirstTimeLoad( + async (dispatch: Dispatch) => { + await dispatch(loadApiClientAuthorizationsPanel()); + }); + + export const loadGroupsPanel = handleFirstTimeLoad( + (dispatch: Dispatch) => { + dispatch(setGroupsBreadcrumbs()); + dispatch(groupPanelActions.loadGroupsPanel()); + }); + + + export const loadGroupDetailsPanel = (groupUuid: string) => + handleFirstTimeLoad( + (dispatch: Dispatch) => { + dispatch(setGroupDetailsBreadcrumbs(groupUuid)); + dispatch(groupDetailsPanelActions.loadGroupDetailsPanel(groupUuid)); + }); + const finishLoadingProject = (project: GroupContentsResource | string) => async (dispatch: Dispatch) => { const uuid = typeof project === 'string' ? project : project.uuid; diff --combined src/validators/validators.tsx index 06f46219,9bc76419..acef9744 --- a/src/validators/validators.tsx +++ b/src/validators/validators.tsx @@@ -5,7 -5,6 +5,7 @@@ import { require } from './require'; import { maxLength } from './max-length'; import { isRsaKey } from './is-rsa-key'; +import { isRemoteHost } from "./is-remote-host"; export const TAG_KEY_VALIDATION = [require, maxLength(255)]; export const TAG_VALUE_VALIDATION = [require, maxLength(255)]; @@@ -22,10 -21,14 +22,16 @@@ export const COPY_FILE_VALIDATION = [re export const MOVE_TO_VALIDATION = [require]; export const PROCESS_NAME_VALIDATION = [require, maxLength(255)]; + export const PROCESS_DESCRIPTION_VALIDATION = [maxLength(255)]; export const REPOSITORY_NAME_VALIDATION = [require, maxLength(255)]; + export const USER_EMAIL_VALIDATION = [require, maxLength(255)]; + export const USER_LENGTH_VALIDATION = [maxLength(255)]; + export const SSH_KEY_PUBLIC_VALIDATION = [require, isRsaKey, maxLength(1024)]; export const SSH_KEY_NAME_VALIDATION = [require, maxLength(255)]; +export const SITE_MANAGER_REMOTE_HOST_VALIDATION = [require, isRemoteHost, maxLength(255)]; ++ + export const MY_ACCOUNT_VALIDATION = [require]; diff --combined src/views-components/main-app-bar/account-menu.tsx index b71c92cb,53a5753d..6c1e46c5 --- a/src/views-components/main-app-bar/account-menu.tsx +++ b/src/views-components/main-app-bar/account-menu.tsx @@@ -11,41 -11,36 +11,41 @@@ import { DispatchProp, connect } from ' import { logout } from '~/store/auth/auth-action'; import { RootState } from "~/store/store"; import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions'; -import { navigateToSshKeysUser, navigateToMyAccount } from '~/store/navigation/navigation-action'; +import { openRepositoriesPanel } from "~/store/repositories/repositories-actions"; +import { - navigateToSshKeys, - navigateToKeepServices, - navigateToComputeNodes, - navigateToSiteManager ++ navigateToSiteManager, ++ navigateToSshKeysUser, ++ navigateToMyAccount +} from '~/store/navigation/navigation-action'; - import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions"; + import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions"; -import { openRepositoriesPanel } from '~/store/repositories/repositories-actions'; interface AccountMenuProps { user?: User; + currentRoute: string; } const mapStateToProps = (state: RootState): AccountMenuProps => ({ - user: state.auth.user + user: state.auth.user, + currentRoute: state.router.location ? state.router.location.pathname : '' }); export const AccountMenu = connect(mapStateToProps)( - ({ user, dispatch }: AccountMenuProps & DispatchProp) => + ({ user, dispatch, currentRoute }: AccountMenuProps & DispatchProp) => user ? } id="account-menu" - title="Account Management"> + title="Account Management" + key={currentRoute}> {getUserFullname(user)} - dispatch(openVirtualMachines())}>Virtual Machines - dispatch(openRepositoriesPanel())}>Repositories + dispatch(openUserVirtualMachines())}>Virtual Machines + {!user.isAdmin && dispatch(openRepositoriesPanel())}>Repositories} dispatch(openCurrentTokenDialog)}>Current token - dispatch(navigateToSshKeys)}>Ssh Keys + dispatch(navigateToSshKeysUser)}>Ssh Keys + dispatch(navigateToSiteManager)}>Site Manager - { user.isAdmin && dispatch(navigateToKeepServices)}>Keep Services } - { user.isAdmin && dispatch(navigateToComputeNodes)}>Compute Nodes } - My account + dispatch(navigateToMyAccount)}>My account dispatch(logout())}>Logout : null); diff --combined src/views-components/main-content-bar/main-content-bar.tsx index 8b8f9891,3806b524..c0014d00 --- a/src/views-components/main-content-bar/main-content-bar.tsx +++ b/src/views-components/main-content-bar/main-content-bar.tsx @@@ -18,10 -18,12 +18,13 @@@ interface MainContentBarProps const isButtonVisible = ({ router }: RootState) => { const pathname = router.location ? router.location.pathname : ''; - return !Routes.matchWorkflowRoute(pathname) && !Routes.matchVirtualMachineRoute(pathname) && - !Routes.matchRepositoriesRoute(pathname) && !Routes.matchSshKeysRoute(pathname) && + return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) && + !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) && + !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) && ++ !Routes.matchSiteManagerRoute(pathname) && !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) && - !Routes.matchSiteManagerRoute(pathname); + !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) && + !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname); }; export const MainContentBar = connect((state: RootState) => ({ diff --combined src/views/workbench/workbench.tsx index af2325bf,bff328e8..90b2dad0 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@@ -45,29 -45,48 +45,49 @@@ import SplitterLayout from 'react-split import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel'; import { SearchResultsPanel } from '~/views/search-results-panel/search-results-panel'; import { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel'; +import { SiteManagerPanel } from "~/views/site-manager-panel/site-manager-panel"; + import { MyAccountPanel } from '~/views/my-account-panel/my-account-panel'; import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog'; import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog'; import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog'; - import { VirtualMachinePanel } from '~/views/virtual-machine-panel/virtual-machine-panel'; + import { VirtualMachineUserPanel } from '~/views/virtual-machine-panel/virtual-machine-user-panel'; + import { VirtualMachineAdminPanel } from '~/views/virtual-machine-panel/virtual-machine-admin-panel'; import { ProjectPropertiesDialog } from '~/views-components/project-properties-dialog/project-properties-dialog'; import { RepositoriesPanel } from '~/views/repositories-panel/repositories-panel'; import { KeepServicePanel } from '~/views/keep-service-panel/keep-service-panel'; import { ComputeNodePanel } from '~/views/compute-node-panel/compute-node-panel'; + import { ApiClientAuthorizationPanel } from '~/views/api-client-authorization-panel/api-client-authorization-panel'; + import { LinkPanel } from '~/views/link-panel/link-panel'; import { RepositoriesSampleGitDialog } from '~/views-components/repositories-sample-git-dialog/repositories-sample-git-dialog'; import { RepositoryAttributesDialog } from '~/views-components/repository-attributes-dialog/repository-attributes-dialog'; import { CreateRepositoryDialog } from '~/views-components/dialog-forms/create-repository-dialog'; import { RemoveRepositoryDialog } from '~/views-components/repository-remove-dialog/repository-remove-dialog'; import { CreateSshKeyDialog } from '~/views-components/dialog-forms/create-ssh-key-dialog'; import { PublicKeyDialog } from '~/views-components/ssh-keys-dialog/public-key-dialog'; + import { RemoveApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/remove-dialog'; import { RemoveComputeNodeDialog } from '~/views-components/compute-nodes-dialog/remove-dialog'; import { RemoveKeepServiceDialog } from '~/views-components/keep-services-dialog/remove-dialog'; + import { RemoveLinkDialog } from '~/views-components/links-dialog/remove-dialog'; import { RemoveSshKeyDialog } from '~/views-components/ssh-keys-dialog/remove-dialog'; import { RemoveVirtualMachineDialog } from '~/views-components/virtual-machines-dialog/remove-dialog'; + import { AttributesApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/attributes-dialog'; import { AttributesComputeNodeDialog } from '~/views-components/compute-nodes-dialog/attributes-dialog'; import { AttributesKeepServiceDialog } from '~/views-components/keep-services-dialog/attributes-dialog'; + import { AttributesLinkDialog } from '~/views-components/links-dialog/attributes-dialog'; import { AttributesSshKeyDialog } from '~/views-components/ssh-keys-dialog/attributes-dialog'; import { VirtualMachineAttributesDialog } from '~/views-components/virtual-machines-dialog/attributes-dialog'; + import { UserPanel } from '~/views/user-panel/user-panel'; + import { UserAttributesDialog } from '~/views-components/user-dialog/attributes-dialog'; + import { CreateUserDialog } from '~/views-components/dialog-forms/create-user-dialog'; + import { HelpApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/help-dialog'; + import { GroupsPanel } from '~/views/groups-panel/groups-panel'; + import { CreateGroupDialog } from '~/views-components/dialog-forms/create-group-dialog'; + import { RemoveGroupDialog } from '~/views-components/groups-dialog/remove-dialog'; + import { GroupAttributesDialog } from '~/views-components/groups-dialog/attributes-dialog'; + import { GroupDetailsPanel } from '~/views/group-details-panel/group-details-panel'; + import { RemoveGroupMemberDialog } from '~/views-components/groups-dialog/member-remove-dialog'; + import { GroupMemberAttributesDialog } from '~/views-components/groups-dialog/member-attributes-dialog'; + import { AddGroupMembersDialog } from '~/views-components/dialog-forms/add-group-member-dialog'; type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content'; @@@ -137,12 -156,19 +157,20 @@@ export const WorkbenchPanel - + + - + + + + + + + + + @@@ -151,21 -177,29 +179,29 @@@ + + + + + + + + @@@ -175,8 -209,12 +211,12 @@@ + + + + @@@ -190,6 -228,7 +230,7 @@@ + - ); + );