[ARVADOS-WORKBENCH2] created: 1.2.0-741-g2a1d30b
Git user
git at public.curoverse.com
Thu Oct 25 16:26:13 EDT 2018
at 2a1d30b31a3d93d94ea0651dc7c8944d83a11e9e (commit)
commit 2a1d30b31a3d93d94ea0651dc7c8944d83a11e9e
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Thu Oct 25 22:26:03 2018 +0200
Create sharing dialog root
Feature #14365
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/dialog-actions/dialog-actions.tsx b/src/components/dialog-actions/dialog-actions.tsx
new file mode 100644
index 0000000..6987a10
--- /dev/null
+++ b/src/components/dialog-actions/dialog-actions.tsx
@@ -0,0 +1,18 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { DialogActions as MuiDialogActions } from '@material-ui/core/';
+import { StyleRulesCallback, withStyles } from '@material-ui/core';
+
+const styles: StyleRulesCallback<'root'> = theme => {
+ const margin = theme.spacing.unit * 3;
+ return {
+ root: {
+ marginRight: margin,
+ marginBottom: margin,
+ marginLeft: margin,
+ },
+ };
+};
+export const DialogActions = withStyles(styles)(MuiDialogActions);
diff --git a/src/store/sharing-dialog/sharing-dialog-actions.ts b/src/store/sharing-dialog/sharing-dialog-actions.ts
new file mode 100644
index 0000000..efd5329
--- /dev/null
+++ b/src/store/sharing-dialog/sharing-dialog-actions.ts
@@ -0,0 +1,16 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { dialogActions } from "~/store/dialog/dialog-actions";
+import { withDialog } from "~/store/dialog/with-dialog";
+
+export const SHARING_DIALOG_NAME = 'SHARING_DIALOG_NAME';
+
+export const openSharingDialog = (resourceUuid: string) =>
+ dialogActions.OPEN_DIALOG({ id: SHARING_DIALOG_NAME, data: resourceUuid });
+
+export const closeSharingDialog = () =>
+ dialogActions.CLOSE_DIALOG({ id: SHARING_DIALOG_NAME });
+
+export const connectSharingDialog = withDialog(SHARING_DIALOG_NAME);
diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts
index cff30fb..80b5eff 100644
--- a/src/views-components/context-menu/action-sets/collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-action-set.ts
@@ -13,6 +13,7 @@ import { openCollectionCopyDialog } from "~/store/collections/collection-copy-ac
import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
+import { openSharingDialog } from '../../../store/sharing-dialog/sharing-dialog-actions';
export const collectionActionSet: ContextMenuActionSet = [[
{
@@ -25,8 +26,8 @@ export const collectionActionSet: ContextMenuActionSet = [[
{
icon: ShareIcon,
name: "Share",
- execute: (dispatch, resource) => {
- // add code
+ execute: (dispatch, { uuid }) => {
+ dispatch(openSharingDialog(uuid));
}
},
{
diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
new file mode 100644
index 0000000..a303cbf
--- /dev/null
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -0,0 +1,59 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { Dialog, DialogTitle, Button, Grid, DialogContent } from '@material-ui/core';
+import { DialogActions } from '~/components/dialog-actions/dialog-actions';
+
+
+export interface SharingDialogDataProps {
+ open: boolean;
+ saveEnabled: boolean;
+ children: React.ReactNode;
+}
+export interface SharingDialogActionProps {
+ onClose: () => void;
+ onSave: () => void;
+ onAdvanced: () => void;
+}
+export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
+ const { children, open, saveEnabled, onAdvanced, onClose, onSave } = props;
+ return <Dialog
+ {...{ open, onClose }}
+ fullWidth
+ maxWidth='sm'>
+ <DialogTitle>
+ Sharing settings
+ </DialogTitle>
+ <DialogContent>
+ {children}
+ </DialogContent>
+ <DialogActions>
+ <Grid container spacing={8}>
+ <Grid item>
+ <Button
+ color='primary'
+ onClick={onAdvanced}>
+ Advanced
+ </Button>
+ </Grid>
+ <Grid item xs />
+ <Grid item>
+ <Button onClick={onClose}>
+ Close
+ </Button>
+ </Grid>
+ <Grid item>
+ <Button
+ variant='contained'
+ color='primary'
+ onClick={onSave}
+ disabled={!saveEnabled}>
+ Save
+ </Button>
+ </Grid>
+ </Grid>
+ </DialogActions>
+ </Dialog>;
+};
diff --git a/src/views-components/sharing-dialog/sharing-dialog.tsx b/src/views-components/sharing-dialog/sharing-dialog.tsx
new file mode 100644
index 0000000..e83885a
--- /dev/null
+++ b/src/views-components/sharing-dialog/sharing-dialog.tsx
@@ -0,0 +1,30 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose, Dispatch } from 'redux';
+import { connect } from 'react-redux';
+
+import { connectSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { RootState } from '~/store/store';
+
+import SharingDialogComponent, { SharingDialogDataProps, SharingDialogActionProps } from './sharing-dialog-component';
+
+const mapStateToProps = (_: RootState, props: WithDialogProps<string>): SharingDialogDataProps => ({
+ ...props,
+ saveEnabled: false,
+ children: null,
+});
+
+const mapDispatchToProps = (_: Dispatch, props: WithDialogProps<string>): SharingDialogActionProps => ({
+ ...props,
+ onClose: props.closeDialog,
+ onSave: () => { console.log('save'); },
+ onAdvanced: () => { console.log('advanced'); },
+});
+
+export const SharingDialog = compose(
+ connectSharingDialog,
+ connect(mapStateToProps, mapDispatchToProps)
+)(SharingDialogComponent);
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 788c96a..2e8bc19 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -48,6 +48,7 @@ import { FavoritesTreePicker } from '../../views-components/projects-tree-picker
import { ProjectsTreePicker } from '~/views-components/projects-tree-picker/projects-tree-picker';
import { Chips } from '~/components/chips/chips';
import { ChipsInput } from '../../components/chips-input/chips-input';
+import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
@@ -130,6 +131,7 @@ export const WorkbenchPanel =
<ProcessCommandDialog />
<RenameFileDialog />
<RichTextEditorDialog />
+ <SharingDialog />
<Snackbar />
<UpdateCollectionDialog />
<UpdateProcessDialog />
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list