From 589629e80967dc1f318561fbe6a4174e1da231a6 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 24 Oct 2019 09:58:23 -0400 Subject: [PATCH] 15530: Link account page has link to home cluster Site manager has links to other clusters. --- .../link-account-panel-root.tsx | 27 ++++++++++--------- .../link-account-panel/link-account-panel.tsx | 2 +- .../site-manager-panel-root.tsx | 10 ++++--- .../site-manager-panel/site-manager-panel.tsx | 3 ++- 4 files changed, 23 insertions(+), 19 deletions(-) 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 47473fa4..359f7798 100644 --- a/src/views/link-account-panel/link-account-panel-root.tsx +++ b/src/views/link-account-panel/link-account-panel-root.tsx @@ -19,6 +19,7 @@ import { UserResource } from "~/models/user"; import { LinkAccountType } from "~/models/link-account"; import { formatDate } from "~/common/formatters"; import { LinkAccountPanelStatus, LinkAccountPanelError } from "~/store/link-account-panel/link-account-panel-reducer"; +import { Config } from '~/common/config'; type CssRules = 'root'; @@ -32,7 +33,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ export interface LinkAccountPanelRootDataProps { targetUser?: UserResource; userToLink?: UserResource; - remoteHosts: { [key: string]: string }; + remoteHostsConfig: { [key: string]: Config }; hasRemoteHosts: boolean; localCluster: string; loginCluster: string; @@ -70,13 +71,13 @@ type LinkAccountPanelRootProps = LinkAccountPanelRootDataProps & LinkAccountPane export const LinkAccountPanelRoot = withStyles(styles)( ({ classes, targetUser, userToLink, status, isProcessing, error, startLinking, cancelLinking, linkAccount, - remoteHosts, hasRemoteHosts, selectedCluster, setSelectedCluster, localCluster, loginCluster }: LinkAccountPanelRootProps) => { + remoteHostsConfig, hasRemoteHosts, selectedCluster, setSelectedCluster, localCluster, loginCluster }: LinkAccountPanelRootProps) => { return {isProcessing && Loading user info. Please wait. - + @@ -89,29 +90,29 @@ export const LinkAccountPanelRoot = withStyles(styles)( 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: - @@ -129,17 +130,17 @@ export const LinkAccountPanelRoot = withStyles(styles)( {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} + : 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. - } + } } } diff --git a/src/views/link-account-panel/link-account-panel.tsx b/src/views/link-account-panel/link-account-panel.tsx index e1ec8af7..60166cda 100644 --- a/src/views/link-account-panel/link-account-panel.tsx +++ b/src/views/link-account-panel/link-account-panel.tsx @@ -15,7 +15,7 @@ import { const mapStateToProps = (state: RootState): LinkAccountPanelRootDataProps => { return { - remoteHosts: state.auth.remoteHosts, + remoteHostsConfig: state.auth.remoteHostsConfig, hasRemoteHosts: Object.keys(state.auth.remoteHosts).length > 1 && state.auth.loginCluster === "", selectedCluster: state.linkAccountPanel.selectedCluster, localCluster: state.auth.localCluster, 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 303995b8..9ba7a2d8 100644 --- a/src/views/site-manager-panel/site-manager-panel-root.tsx +++ b/src/views/site-manager-panel/site-manager-panel-root.tsx @@ -26,6 +26,7 @@ import { Field, FormErrors, InjectedFormProps, reduxForm, reset, stopSubmit } fr 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'; type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' | 'remoteSiteInfo' | 'buttonAdd' | 'buttonLoggedIn' | 'buttonLoggedOut' | @@ -88,6 +89,7 @@ export interface SiteManagerPanelRootActionProps { export interface SiteManagerPanelRootDataProps { sessions: Session[]; + remoteHostsConfig: { [key: string]: Config }; } type SiteManagerPanelRootProps = SiteManagerPanelRootDataProps & SiteManagerPanelRootActionProps & WithStyles & InjectedFormProps; @@ -114,14 +116,14 @@ export const SiteManagerPanelRoot = compose( } }), withStyles(styles)) - (({ classes, sessions, handleSubmit, toggleSession }: SiteManagerPanelRootProps) => + (({ classes, sessions, handleSubmit, toggleSession, remoteHostsConfig }: SiteManagerPanelRootProps) => 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. - + @@ -139,7 +141,7 @@ export const SiteManagerPanelRoot = compose( {sessions.map((session, index) => { const validating = session.status === SessionStatus.BEING_VALIDATED; return - {session.clusterId} + {session.clusterId} {session.remoteHost} {validating ? : session.username} {validating ? : session.email} @@ -161,7 +163,7 @@ export const SiteManagerPanelRoot = compose( To add a remote Arvados site, paste the remote site's host here (see "ARVADOS_API_HOST" on the "current token" page). - + { return { - sessions: state.auth.sessions + sessions: state.auth.sessions, + remoteHostsConfig: state.auth.remoteHostsConfig }; }; -- 2.39.5