// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; import { Card, CardContent, CircularProgress, Grid, IconButton, StyleRulesCallback, Table, TableBody, TableCell, TableHead, TableRow, Typography, WithStyles, withStyles } from '@material-ui/core'; 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 { 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' | 'statusCell'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { width: '100%', overflow: 'auto' }, link: { color: theme.palette.primary.main, textDecoration: 'none', margin: '0px 4px' }, buttonContainer: { textAlign: 'right' }, table: { marginTop: theme.spacing.unit }, tableRow: { '& td, th': { whiteSpace: 'nowrap' } }, statusCell: { minWidth: 160 }, remoteSiteInfo: { marginTop: 20 }, buttonAdd: { marginLeft: 10, marginTop: theme.spacing.unit * 3 }, buttonLoggedIn: { minHeight: theme.spacing.unit, padding: 5, color: '#fff', backgroundColor: '#009966', '&:hover': { backgroundColor: '#008450', } }, buttonLoggedOut: { minHeight: theme.spacing.unit, padding: 5, color: '#000', backgroundColor: '#FFC414', '&:hover': { backgroundColor: '#eaaf14', } } }); 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; const SITE_MANAGER_FORM_NAME = 'siteManagerForm'; const submitSession = (remoteHost: string) => (dispatch: Dispatch) => { dispatch(addSession(remoteHost, undefined, true)).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 }>({ form: SITE_MANAGER_FORM_NAME, touchOnBlur: false, onSubmit: (data, dispatch) => { dispatch(submitSession(data.remoteHost)); } }), withStyles(styles)) (({ 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. {sessions.length > 0 && Cluster ID Host Email UUID Status Actions {sessions.map((session, index) => { const validating = session.status === SessionStatus.BEING_VALIDATED; return {remoteHostsConfig[session.clusterId] ? : session.clusterId} {session.remoteHost} {validating ? : session.email} {validating ? : session.uuid} {session.clusterId !== localClusterConfig.uuidPrefix && !localClusterConfig.clusterConfig.RemoteClusters[session.clusterId] && removeSession(session)}> } ; })}
}
To add a remote Arvados site, paste the remote site's host here (see "ARVADOS_API_HOST" on the "current token" page).
);