X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f9dde5c781766b8be71d43d0f031c201a0edcfbb..0ac34fb81d10d664c7b7994612504f989d1c3d29:/src/views/site-manager-panel/site-manager-panel-root.tsx?ds=sidebyside 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 3b8053e7ee..c0a64e1c40 100644 --- a/src/views/site-manager-panel/site-manager-panel-root.tsx +++ b/src/views/site-manager-panel/site-manager-panel-root.tsx @@ -21,12 +21,12 @@ import { import { ArvadosTheme } from '~/common/custom-theme'; import { Session, SessionStatus } from "~/models/session"; import Button from "@material-ui/core/Button"; -import { User } from "~/models/user"; -import { compose } from "redux"; +import { compose, Dispatch } from "redux"; import { Field, FormErrors, InjectedFormProps, reduxForm, reset, stopSubmit } from "redux-form"; 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' | @@ -34,8 +34,8 @@ type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' | const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { - width: '100%', - overflow: 'auto' + width: '100%', + overflow: 'auto' }, link: { color: theme.palette.primary.main, @@ -89,36 +89,41 @@ export interface SiteManagerPanelRootActionProps { export interface SiteManagerPanelRootDataProps { sessions: Session[]; - user: User; + remoteHostsConfig: { [key: string]: Config }; } type SiteManagerPanelRootProps = SiteManagerPanelRootDataProps & SiteManagerPanelRootActionProps & WithStyles & InjectedFormProps; const SITE_MANAGER_FORM_NAME = 'siteManagerForm'; +const submitSession = (remoteHost: string) => + (dispatch: Dispatch) => { + dispatch(addSession(remoteHost)).then(() => { + dispatch(reset(SITE_MANAGER_FORM_NAME)); + }).catch((e: any) => { + const errors = { + remoteHost: e + } as FormErrors; + dispatch(stopSubmit(SITE_MANAGER_FORM_NAME, errors)); + }); + }; + export const SiteManagerPanelRoot = compose( - reduxForm<{remoteHost: string}>({ + reduxForm<{ remoteHost: string }>({ form: SITE_MANAGER_FORM_NAME, touchOnBlur: false, onSubmit: (data, dispatch) => { - dispatch(addSession(data.remoteHost)).then(() => { - dispatch(reset(SITE_MANAGER_FORM_NAME)); - }).catch((e: any) => { - const errors = { - remoteHost: e - } as FormErrors; - dispatch(stopSubmit(SITE_MANAGER_FORM_NAME, errors)); - }); + dispatch(submitSession(data.remoteHost)); } }), 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. - + @@ -126,6 +131,7 @@ export const SiteManagerPanelRoot = compose( Cluster ID + Host Username Email Status @@ -135,9 +141,12 @@ export const SiteManagerPanelRoot = compose( {sessions.map((session, index) => { const validating = session.status === SessionStatus.BEING_VALIDATED; return - {session.clusterId} - {validating ? : session.username} - {validating ? : session.email} + {remoteHostsConfig[session.clusterId] ? + {session.clusterId} + : session.clusterId} + {session.remoteHost} + {validating ? : session.username} + {validating ? : session.email}