From f8f33868de654c1bdded337cb2ad5c486ccf1c93 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 18 Feb 2022 18:48:08 -0300 Subject: [PATCH] 17754: Attempts to improve code layout for better readability. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../link-account-panel-root.tsx | 225 +++++++++--------- 1 file changed, 112 insertions(+), 113 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 c5c86eb2..9dc28d66 100644 --- a/src/views/link-account-panel/link-account-panel-root.tsx +++ b/src/views/link-account-panel/link-account-panel-root.tsx @@ -73,125 +73,124 @@ 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. - - - + 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. + - } - {!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: - - + + {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.substring(0, 5)}. + - - - } - : - - - - 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.substring(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.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. - } + + : 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.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)}. } - {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)}. - } - - - - - - - + + 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)}. } -
-
; + + + + + + + + +
} +
; }); -- 2.30.2