From 5adf51b5e01fdc72fd51c82ad05bf07fd55f519f Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Fri, 25 Oct 2019 15:22:29 -0400 Subject: [PATCH] 15530: Use ResourceCluster to render cluster links. --- .../data-explorer/renderers.tsx | 20 +- .../link-account-panel-root.tsx | 220 +++++++++--------- .../search-results-panel-view.tsx | 12 +- .../site-manager-panel-root.tsx | 5 +- 4 files changed, 132 insertions(+), 125 deletions(-) diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index cc311248..16389e07 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -237,15 +237,17 @@ export const ResourceCluster = (props: { uuid: string }) => { const CLUSTER_ID_LENGTH = 5; const pos = props.uuid.indexOf('-'); const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substr(0, pos) : ''; - const ci = pos >= CLUSTER_ID_LENGTH ? (props.uuid.charCodeAt(0) + props.uuid.charCodeAt(1)) % clusterColors.length : 0; - return - {clusterId} - ; + const ci = pos >= CLUSTER_ID_LENGTH ? ((((( + (props.uuid.charCodeAt(0) * props.uuid.charCodeAt(1)) + + props.uuid.charCodeAt(2)) + * props.uuid.charCodeAt(3)) + + props.uuid.charCodeAt(4))) % clusterColors.length) : 0; + return {clusterId}; }; export const ComputeNodeInfo = withResourceData('info', renderNodeInfo); diff --git a/src/views/link-account-panel/link-account-panel-root.tsx b/src/views/link-account-panel/link-account-panel-root.tsx index 359f7798..cbbeac60 100644 --- a/src/views/link-account-panel/link-account-panel-root.tsx +++ b/src/views/link-account-panel/link-account-panel-root.tsx @@ -71,117 +71,117 @@ type LinkAccountPanelRootProps = LinkAccountPanelRootDataProps & LinkAccountPane export const LinkAccountPanelRoot = withStyles(styles)( ({ classes, targetUser, userToLink, status, isProcessing, error, startLinking, cancelLinking, linkAccount, - remoteHostsConfig, hasRemoteHosts, selectedCluster, setSelectedCluster, localCluster, loginCluster }: LinkAccountPanelRootProps) => { - return - - {isProcessing && - - Loading user info. Please wait. + remoteHostsConfig, hasRemoteHosts, selectedCluster, setSelectedCluster, localCluster, loginCluster }: LinkAccountPanelRootProps) => { + return + + {isProcessing && + + Loading user info. Please wait. + + + + + } + {!isProcessing && status === LinkAccountPanelStatus.INITIAL && targetUser &&
+ {isLocalUser(targetUser.uuid, localCluster) ? + + + You are currently logged in as {displayUser(targetUser, true)} + + + You can link Arvados accounts. After linking, either login will take you to the same account. + + + + + + + + + + + {hasRemoteHosts && selectedCluster && + + You can also link {displayUser(targetUser, false)} with an account from a remote cluster. - - + + Please select the cluster that hosts the account you want to link with: + + + + + + } + : + + + + You are currently logged in as {displayUser(targetUser, true, true)} + + {targetUser.isActive ? (loginCluster === "" ? + <> + This a remote account. You can link a local Arvados account to this one. After linking, you can access the local account's data by logging into the {localCluster} cluster as user {targetUser.email} from {targetUser.uuid.substr(0, 5)}. + + + + + : Please visit cluster {loginCluster} to perform account linking. + ) + : + This an inactive remote account. An administrator must activate your account before you can proceed. After your accounts is activated, you can link a local Arvados account hosted by the {localCluster} cluster to this one. + } } - {!isProcessing && status === LinkAccountPanelStatus.INITIAL && targetUser &&
- {isLocalUser(targetUser.uuid, localCluster) ? - - - You are currently logged in as {displayUser(targetUser, true)} - - - You can link Arvados accounts. After linking, either login will take you to the same account. - - - - - - - - - - - {hasRemoteHosts && selectedCluster && - - You can also link {displayUser(targetUser, false)} with an account from a remote cluster. - - - Please select the cluster that hosts the account you want to link with: - - - - - - } - : - - - - You are currently logged in as {displayUser(targetUser, true, true)} - - {targetUser.isActive ? (loginCluster === "" ? - <> - This a remote account. You can link a local Arvados account to this one. After linking, you can access the local account's data by logging into the {localCluster} cluster as user {targetUser.email} from {targetUser.uuid.substr(0, 5)}. - - - - - : Must perform account linking on login cluster {loginCluster} - ) - : - This an inactive remote account. An administrator must activate your account before you can proceed. After your accounts is activated, you can link a local Arvados account hosted by the {localCluster} cluster to this one. - } - - } -
} - {!isProcessing && (status === LinkAccountPanelStatus.LINKING || status === LinkAccountPanelStatus.ERROR) && userToLink && targetUser && - - {status === LinkAccountPanelStatus.LINKING && - - Clicking 'Link accounts' will link {displayUser(userToLink, true, !isLocalUser(targetUser.uuid, localCluster))} to {displayUser(targetUser, true, !isLocalUser(targetUser.uuid, localCluster))}. - - {(isLocalUser(targetUser.uuid, localCluster)) && - After linking, logging in as {displayUser(userToLink)} will log you into the same account as {displayUser(targetUser)}. - } - - Any object owned by {displayUser(userToLink)} will be transfered to {displayUser(targetUser)}. - - {!isLocalUser(targetUser.uuid, localCluster) && - You can access {userToLink.email} data by logging into {localCluster} with the {targetUser.email} account. - } - } - {error === LinkAccountPanelError.NON_ADMIN && - Cannot link admin account {displayUser(userToLink)} to non-admin account {displayUser(targetUser)}. - } - {error === LinkAccountPanelError.SAME_USER && - Cannot link {displayUser(targetUser)} to the same account. - } - {error === LinkAccountPanelError.INACTIVE && - Cannot link account {displayUser(userToLink)} to inactive account {displayUser(targetUser)}. - } - - - - - - - - - } +
} + {!isProcessing && (status === LinkAccountPanelStatus.LINKING || status === LinkAccountPanelStatus.ERROR) && userToLink && targetUser && + + {status === LinkAccountPanelStatus.LINKING && + + Clicking 'Link accounts' will link {displayUser(userToLink, true, !isLocalUser(targetUser.uuid, localCluster))} to {displayUser(targetUser, true, !isLocalUser(targetUser.uuid, localCluster))}. + + {(isLocalUser(targetUser.uuid, localCluster)) && + After linking, logging in as {displayUser(userToLink)} will log you into the same account as {displayUser(targetUser)}. + } + + Any object owned by {displayUser(userToLink)} will be transfered to {displayUser(targetUser)}. + + {!isLocalUser(targetUser.uuid, localCluster) && + You can access {userToLink.email} data by logging into {localCluster} with the {targetUser.email} account. + } + } + {error === LinkAccountPanelError.NON_ADMIN && + Cannot link admin account {displayUser(userToLink)} to non-admin account {displayUser(targetUser)}. + } + {error === LinkAccountPanelError.SAME_USER && + Cannot link {displayUser(targetUser)} to the same account. + } + {error === LinkAccountPanelError.INACTIVE && + Cannot link account {displayUser(userToLink)} to inactive account {displayUser(targetUser)}. + } + + + + + + + + + }
-
; - }); +
; + }); diff --git a/src/views/search-results-panel/search-results-panel-view.tsx b/src/views/search-results-panel/search-results-panel-view.tsx index 45638b89..a834effe 100644 --- a/src/views/search-results-panel/search-results-panel-view.tsx +++ b/src/views/search-results-panel/search-results-panel-view.tsx @@ -123,10 +123,14 @@ export const SearchResultsPanelView = withStyles(styles, { withTheme: true })( contextMenuColumn={false} hideSearchInput title={ -
{(props.localCluster !== homeCluster && loggedIn.length === 1) ? - Searching local cluster {props.localCluster} only. To search multiple clusters, start from your home Workbench. : - Searching clusters: {loggedIn.map((ss) => {ss.clusterId})}} - Use Site Manager to manage which clusters will be searched. +
+ {loggedIn.length === 1 ? + Searching local cluster + : Searching clusters: {loggedIn.map((ss) => + )}} + {loggedIn.length === 1 && props.localCluster !== homeCluster ? + To search multiple clusters, start from your home Workbench. + : Use Site Manager to manage which clusters will be searched.}
} />; 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 c0a64e1c..64457f97 100644 --- a/src/views/site-manager-panel/site-manager-panel-root.tsx +++ b/src/views/site-manager-panel/site-manager-panel-root.tsx @@ -27,6 +27,7 @@ import { TextField } from "~/components/text-field/text-field"; import { addSession } from "~/store/auth/auth-action-session"; import { SITE_MANAGER_REMOTE_HOST_VALIDATION } from "~/validators/validators"; import { Config } from '~/common/config'; +import { ResourceCluster } from '~/views-components/data-explorer/renderers'; type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' | 'remoteSiteInfo' | 'buttonAdd' | 'buttonLoggedIn' | 'buttonLoggedOut' | @@ -123,7 +124,7 @@ export const SiteManagerPanelRoot = compose( You can log in to multiple Arvados sites here, then use the multi-site search page to search collections and projects on all sites at once. - + @@ -142,7 +143,7 @@ export const SiteManagerPanelRoot = compose( const validating = session.status === SessionStatus.BEING_VALIDATED; return {remoteHostsConfig[session.clusterId] ? - {session.clusterId} + : session.clusterId} {session.remoteHost} {validating ? : session.username} -- 2.30.2