children?: React.ReactNode;
onValueClick?: () => void;
linkToUuid?: string;
+ copyValue?: string;
}
type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles<CssRules> & FederationConfig & DispatchProp;
render() {
const { label, link, value, children, classes, classLabel,
classValue, lowercaseValue, onValueClick, linkToUuid,
- localCluster, remoteHostsConfig, sessions } = this.props;
+ localCluster, remoteHostsConfig, sessions, copyValue } = this.props;
let valueNode: React.ReactNode;
if (linkToUuid) {
className={classnames([classes.value, classValue, { [classes.lowercaseValue]: lowercaseValue }])}>
{valueNode}
{children}
- {linkToUuid && <Tooltip title="Copy">
+ {(linkToUuid || copyValue) && <Tooltip title="Copy to clipboard">
<span className={classes.copyIcon}>
- <CopyToClipboard text={linkToUuid || ""} onCopy={() => this.onCopy("Copied")}>
+ <CopyToClipboard text={linkToUuid || copyValue || ""} onCopy={() => this.onCopy("Copied")}>
<CopyIcon />
</CopyToClipboard>
</span>
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { RootState } from "~/store/store";
+import { ServiceRepository } from "~/services/services";
+import { dialogActions } from '~/store/dialog/dialog-actions';
+
+export const COLLECTION_WEBDAV_S3_DIALOG_NAME = 'collectionWebdavS3Dialog';
+
+export interface WebDavS3InfoDialogData {
+ uuid: string;
+ token: string;
+ downloadUrl: string;
+ homeCluster: string;
+ localCluster: string;
+ username: string;
+ activeTab: number;
+ setActiveTab: (event: any, tabNr: number) => void;
+}
+
+export const openWebDavS3InfoDialog = (uuid: string, activeTab?: number) =>
+ (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(dialogActions.OPEN_DIALOG({
+ id: COLLECTION_WEBDAV_S3_DIALOG_NAME,
+ data: {
+ title: 'Access Collection using WebDAV or S3',
+ token: getState().auth.apiToken,
+ downloadUrl: getState().auth.config.keepWebInlineServiceUrl,
+ homeCluster: getState().auth.homeCluster,
+ localCluster: getState().auth.localCluster,
+ username: getState().auth.user!.username,
+ activeTab: activeTab || 0,
+ setActiveTab: (event: any, tabNr: number) => dispatch<any>(openWebDavS3InfoDialog(uuid, tabNr)),
+ uuid
+ }
+ }));
+ };
import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions';
import { openCollectionCopyDialog } from "~/store/collections/collection-copy-actions";
+import { openWebDavS3InfoDialog } from "~/store/collections/collection-info-actions";
import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
export const readOnlyCollectionActionSet: ContextMenuActionSet = [[
...commonActionSet.reduce((prev, next) => prev.concat(next), []),
toggleFavoriteAction,
+ {
+ icon: AdvancedIcon,
+ name: "Connecting with WebDav or S3",
+ execute: (dispatch, resource) => {
+ dispatch<any>(openWebDavS3InfoDialog(resource.uuid));
+ }
+ },
]];
export const collectionActionSet: ContextMenuActionSet = [
}
},
]
-];
\ No newline at end of file
+];
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Dialog, DialogActions, Button, StyleRulesCallback, WithStyles, withStyles, CardHeader, Tab, Tabs } from '@material-ui/core';
+import { withDialog } from "~/store/dialog/with-dialog";
+import { COLLECTION_WEBDAV_S3_DIALOG_NAME, WebDavS3InfoDialogData } from '~/store/collections/collection-info-actions';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { compose } from 'redux';
+import { DetailsAttribute } from "~/components/details-attribute/details-attribute";
+
+type CssRules = 'details';
+
+const styles: StyleRulesCallback<CssRules> = theme => ({
+ details: {
+ marginLeft: theme.spacing.unit * 3,
+ marginRight: theme.spacing.unit * 3,
+ }
+});
+
+interface TabPanelData {
+ children: React.ReactElement<any>[];
+ value: number;
+ index: number;
+}
+
+function TabPanel(props: TabPanelData) {
+ const { children, value, index } = props;
+
+ return (
+ <div
+ role="tabpanel"
+ hidden={value !== index}
+ id={`simple-tabpanel-${index}`}
+ aria-labelledby={`simple-tab-${index}`}
+ >
+ {value === index && children}
+ </div>
+ );
+}
+
+export const WebDavS3InfoDialog = compose(
+ withDialog(COLLECTION_WEBDAV_S3_DIALOG_NAME),
+ withStyles(styles),
+)(
+ (props: WithDialogProps<WebDavS3InfoDialogData> & WithStyles<CssRules>) => {
+ if (!props.data.downloadUrl) { return null; }
+
+ const keepwebUrl = props.data.downloadUrl.replace(/\/\*(--[^.]+)?\./, "/");
+
+ const winDav = new URL(props.data.downloadUrl.replace("*", props.data.uuid));
+
+ const gnomeDav = new URL(keepwebUrl);
+ gnomeDav.username = props.data.username;
+ gnomeDav.pathname = `/c=${props.data.uuid}/`;
+ gnomeDav.protocol = "davs:";
+
+ const s3endpoint = new URL(keepwebUrl);
+
+ const sp = props.data.token.split("/");
+ let tokenUuid;
+ let tokenSecret;
+ if (sp.length === 3 && sp[0] === "v2" && props.data.homeCluster === props.data.localCluster) {
+ tokenUuid = sp[1];
+ tokenSecret = sp[2];
+ } else {
+ tokenUuid = props.data.token.replace(/\//g, "_");
+ tokenSecret = tokenUuid;
+ }
+
+ return <Dialog
+ open={props.open}
+ maxWidth="md"
+ onClose={props.closeDialog}
+ style={{ alignSelf: 'stretch' }}>
+ <CardHeader
+ title={`WebDAV and S3`} />
+ <div className={props.classes.details} >
+ <Tabs value={props.data.activeTab} onChange={props.data.setActiveTab}>
+ <Tab key="windows" label="Add a Network Location in Windows" />
+ <Tab key="gnome" label="Connect to Server in GNOME" />
+ <Tab key="s3" label="Using an S3 client" />
+ </Tabs>
+
+ <TabPanel index={0} value={props.data.activeTab}>
+ <ol>
+ <li>Open File Explorer</li>
+ <li>Click on "This PC", then go to Computer → Add a Network Location</li>
+ <li>Click Next, then choose "Add a custom network location", then click Next</li>
+ </ol>
+
+ <DetailsAttribute
+ label='Internet address'
+ value={winDav.toString()}
+ copyValue={winDav.toString()} />
+
+ <DetailsAttribute
+ label='Username'
+ value={props.data.username}
+ copyValue={props.data.username} />
+
+ <DetailsAttribute
+ label='Password'
+ value={props.data.token}
+ copyValue={props.data.token} />
+ </TabPanel>
+
+ <TabPanel index={1} value={props.data.activeTab}>
+ <ol>
+ <li>Open Files</li>
+ <li>Select +Other Locations</li>
+ <li>Connect to Server → Enter server address</li>
+ </ol>
+
+ <DetailsAttribute
+ label='Server address'
+ value={gnomeDav.toString()}
+ copyValue={gnomeDav.toString()} />
+
+ <DetailsAttribute
+ label='Password'
+ value={props.data.token}
+ copyValue={props.data.token} />
+ </TabPanel>
+
+ <TabPanel index={2} value={props.data.activeTab}>
+ <DetailsAttribute
+ label='Endpoint'
+ value={s3endpoint.host}
+ copyValue={s3endpoint.host} />
+
+ <DetailsAttribute
+ label='Bucket'
+ value={props.data.uuid}
+ copyValue={props.data.uuid} />
+
+ <DetailsAttribute
+ label='Access Key'
+ value={tokenUuid}
+ copyValue={tokenUuid} />
+
+ <DetailsAttribute
+ label='Secret Key'
+ value={tokenSecret}
+ copyValue={tokenSecret} />
+
+ </TabPanel>
+
+ </div>
+ <DialogActions>
+ <Button
+ variant='text'
+ color='primary'
+ onClick={props.closeDialog}>
+ Close
+ </Button>
+ </DialogActions>
+
+ </Dialog >;
+ }
+);
import { NotFoundPanel } from '../not-found-panel/not-found-panel';
import { AutoLogout } from '~/views-components/auto-logout/auto-logout';
import { RestoreCollectionVersionDialog } from '~/views-components/collections-dialog/restore-version-dialog';
+import { WebDavS3InfoDialog } from '~/views-components/webdav-s3-dialog/webdav-s3-dialog';
type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
export const WorkbenchPanel =
withStyles(styles)((props: WorkbenchPanelProps) =>
<Grid container item xs className={props.classes.root}>
- { props.sessionIdleTimeout > 0 && <AutoLogout />}
+ {props.sessionIdleTimeout > 0 && <AutoLogout />}
<Grid container item xs className={props.classes.container}>
<SplitterLayout customClassName={props.classes.splitter} percentage={true}
primaryIndex={0} primaryMinSize={10}
secondaryInitialSize={getSplitterInitialSize()} secondaryMinSize={40}
onSecondaryPaneSizeChange={saveSplitterSize}>
- { props.isUserActive && props.isNotLinking && <Grid container item xs component='aside' direction='column' className={props.classes.asidePanel}>
+ {props.isUserActive && props.isNotLinking && <Grid container item xs component='aside' direction='column' className={props.classes.asidePanel}>
<SidePanel />
- </Grid> }
+ </Grid>}
<Grid container item xs component="main" direction="column" className={props.classes.contentWrapper}>
<Grid item xs>
- { props.isNotLinking && <MainContentBar /> }
+ {props.isNotLinking && <MainContentBar />}
</Grid>
<Grid item xs className={props.classes.content}>
<Switch>
<UserManageDialog />
<VirtualMachineAttributesDialog />
<FedLogin />
+ <WebDavS3InfoDialog />
</Grid>
);