X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9d13b7b84e145646fe3d5e61e26a2ceead76d039..3c7e3cdc547ad5468421e1c049daa94b0d4b8bc0:/src/views/site-manager-panel/site-manager-panel-root.tsx 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 684e35b4..45f0a116 100644 --- a/src/views/site-manager-panel/site-manager-panel-root.tsx +++ b/src/views/site-manager-panel/site-manager-panel-root.tsx @@ -2,12 +2,13 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { Card, CardContent, CircularProgress, Grid, + IconButton, StyleRulesCallback, Table, TableBody, @@ -18,14 +19,17 @@ import { WithStyles, withStyles } from '@material-ui/core'; -import { ArvadosTheme } from '~/common/custom-theme'; -import { Session, SessionStatus } from "~/models/session"; +import { ArvadosTheme } from 'common/custom-theme'; +import { Session, SessionStatus } from "models/session"; import Button from "@material-ui/core/Button"; 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 { 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'; +import { TrashIcon } from "components/icon/icon"; type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' | 'remoteSiteInfo' | 'buttonAdd' | 'buttonLoggedIn' | 'buttonLoggedOut' | @@ -33,8 +37,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, @@ -84,10 +88,13 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ export interface SiteManagerPanelRootActionProps { toggleSession: (session: Session) => void; + removeSession: (session: Session) => void; } export interface SiteManagerPanelRootDataProps { sessions: Session[]; + remoteHostsConfig: { [key: string]: Config }; + localClusterConfig: Config; } type SiteManagerPanelRootProps = SiteManagerPanelRootDataProps & SiteManagerPanelRootActionProps & WithStyles & InjectedFormProps; @@ -95,7 +102,7 @@ const SITE_MANAGER_FORM_NAME = 'siteManagerForm'; const submitSession = (remoteHost: string) => (dispatch: Dispatch) => { - dispatch(addSession(remoteHost)).then(() => { + dispatch(addSession(remoteHost, undefined, true)).then(() => { dispatch(reset(SITE_MANAGER_FORM_NAME)); }).catch((e: any) => { const errors = { @@ -106,7 +113,7 @@ const submitSession = (remoteHost: string) => }; export const SiteManagerPanelRoot = compose( - reduxForm<{remoteHost: string}>({ + reduxForm<{ remoteHost: string }>({ form: SITE_MANAGER_FORM_NAME, touchOnBlur: false, onSubmit: (data, dispatch) => { @@ -114,14 +121,14 @@ export const SiteManagerPanelRoot = compose( } }), withStyles(styles)) - (({ classes, sessions, handleSubmit, toggleSession }: SiteManagerPanelRootProps) => + (({ classes, sessions, handleSubmit, toggleSession, removeSession, localClusterConfig, 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. - + @@ -129,26 +136,41 @@ export const SiteManagerPanelRoot = compose( Cluster ID - Username + Host Email + UUID Status + Actions {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.remoteHost} + {validating ? : session.email} + {validating ? : session.uuid} + + {session.clusterId !== localClusterConfig.uuidPrefix && + !localClusterConfig.clusterConfig.RemoteClusters[session.clusterId] && + removeSession(session)}> + + } + ; })} @@ -157,9 +179,9 @@ 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). - + + autoFocus />