[ARVADOS-WORKBENCH2] updated: 1.2.0-122-gfe29752
Git user
git at public.curoverse.com
Wed Aug 22 07:18:58 EDT 2018
Summary of changes:
src/components/move-to-dialog/move-to-dialog.tsx | 48 ------------------
src/components/project-copy/project-copy.tsx | 58 ----------------------
.../project-tree-picker/project-tree-picker.tsx | 22 ++++++++
.../project-copy-project-dialog.ts | 8 ++-
.../move-to-dialog/move-to-dialog.tsx | 20 ++------
.../project-copy-dialog/project-copy-dialog.tsx | 21 ++------
.../project-copy-project-dialog.tsx | 6 +--
7 files changed, 37 insertions(+), 146 deletions(-)
delete mode 100644 src/components/move-to-dialog/move-to-dialog.tsx
delete mode 100644 src/components/project-copy/project-copy.tsx
create mode 100644 src/components/project-tree-picker/project-tree-picker.tsx
via fe297524c4e7f0e7e43a5b946ec492edf12e2f67 (commit)
from 0e9bf3f713937af55e9b8677ca8c87eeddeae4da (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit fe297524c4e7f0e7e43a5b946ec492edf12e2f67
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Wed Aug 22 13:18:42 2018 +0200
projectPickerTree moved to component
Feature #13988
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/components/move-to-dialog/move-to-dialog.tsx b/src/components/move-to-dialog/move-to-dialog.tsx
deleted file mode 100644
index 2bfc2c3..0000000
--- a/src/components/move-to-dialog/move-to-dialog.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import * as React from "react";
-import { Field, InjectedFormProps, WrappedFieldProps } from "redux-form";
-import { Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress } from "@material-ui/core";
-
-import { WithDialogProps } from "~/store/dialog/with-dialog";
-import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
-import { MOVE_TO_VALIDATION } from "~/validators/validators";
-
-export const MoveToDialog = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
- <form>
- <Dialog open={props.open}
- disableBackdropClick={true}
- disableEscapeKeyDown={true}>
- <DialogTitle>Move to</DialogTitle>
- <DialogContent>
- <Field
- name="projectUuid"
- component={Picker}
- validate={MOVE_TO_VALIDATION} />
- </DialogContent>
- <DialogActions>
- <Button
- variant='flat'
- color='primary'
- disabled={props.submitting}
- onClick={props.closeDialog}>
- Cancel
- </Button>
- <Button
- variant='contained'
- color='primary'
- type='submit'
- onClick={props.handleSubmit}
- disabled={props.pristine || props.invalid || props.submitting}>
- {props.submitting ? <CircularProgress size={20} /> : 'Move'}
- </Button>
- </DialogActions>
- </Dialog>
- </form>;
-
-const Picker = (props: WrappedFieldProps) =>
- <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
- <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
- </div>;
\ No newline at end of file
diff --git a/src/components/project-copy/project-copy.tsx b/src/components/project-copy/project-copy.tsx
deleted file mode 100644
index 34c8e6d..0000000
--- a/src/components/project-copy/project-copy.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-import * as React from "react";
-import { Field, InjectedFormProps, WrappedFieldProps } from "redux-form";
-import { Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress } from "@material-ui/core";
-import { WithDialogProps } from "~/store/dialog/with-dialog";
-import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
-import { MAKE_A_COPY_VALIDATION, COPY_NAME_VALIDATION } from "~/validators/validators";
-import { TextField } from '~/components/text-field/text-field';
-
-export interface CopyFormData {
- name: string;
- projectUuid: string;
- uuid: string;
-}
-
-export const ProjectCopy = (props: WithDialogProps<string> & InjectedFormProps<CopyFormData>) =>
- <form>
- <Dialog open={props.open}
- disableBackdropClick={true}
- disableEscapeKeyDown={true}>
- <DialogTitle>Make a copy</DialogTitle>
- <DialogContent>
- <Field
- name="name"
- component={TextField}
- validate={COPY_NAME_VALIDATION}
- label="Enter a new name for the copy" />
- <Field
- name="projectUuid"
- component={Picker}
- validate={MAKE_A_COPY_VALIDATION} />
- </DialogContent>
- <DialogActions>
- <Button
- variant='flat'
- color='primary'
- disabled={props.submitting}
- onClick={props.closeDialog}>
- Cancel
- </Button>
- <Button
- variant='contained'
- color='primary'
- type='submit'
- onClick={props.handleSubmit}
- disabled={props.pristine || props.invalid || props.submitting}>
- {props.submitting && <CircularProgress size={20} style={{position: 'absolute'}}/>}
- Copy
- </Button>
- </DialogActions>
- </Dialog>
- </form>;
-const Picker = (props: WrappedFieldProps) =>
- <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
- <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
- </div>;
\ No newline at end of file
diff --git a/src/components/project-tree-picker/project-tree-picker.tsx b/src/components/project-tree-picker/project-tree-picker.tsx
new file mode 100644
index 0000000..ce30dcd
--- /dev/null
+++ b/src/components/project-tree-picker/project-tree-picker.tsx
@@ -0,0 +1,22 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { ProjectTreePicker as ProjectPicker } from "~/views-components/project-tree-picker/project-tree-picker";
+import { WrappedFieldProps } from "redux-form";
+import { Typography } from '@material-ui/core';
+
+export const ProjectTreePicker = (props: WrappedFieldProps) =>
+ <div style={{ height: '200px', display: 'flex', flexDirection: 'column' }}>
+ <ProjectPicker onChange={handleChange(props)} />
+ {props.meta.dirty && props.meta.error &&
+ <Typography variant='caption' color='error'>
+ {props.meta.error}
+ </Typography>}
+ </div>;
+
+const handleChange = (props: WrappedFieldProps) => (value: string) =>
+ props.input.value === value
+ ? props.input.onChange('')
+ : props.input.onChange(value);
\ No newline at end of file
diff --git a/src/store/project-copy-project-dialog/project-copy-project-dialog.ts b/src/store/project-copy-project-dialog/project-copy-project-dialog.ts
index 768b25e..11cd305 100644
--- a/src/store/project-copy-project-dialog/project-copy-project-dialog.ts
+++ b/src/store/project-copy-project-dialog/project-copy-project-dialog.ts
@@ -4,7 +4,7 @@
import { Dispatch } from "redux";
import { dialogActions } from "~/store/dialog/dialog-actions";
-import { initialize } from 'redux-form';
+import { initialize, startSubmit, stopSubmit } from 'redux-form';
import { resetPickerProjectTree } from '~/store/project-tree-picker/project-tree-picker-actions';
import { ProjectCopyFormDialogData } from "~/store/project-copy-dialog/project-copy-dialog";
@@ -16,4 +16,10 @@ export const openProjectCopyDialog = (data: { projectUuid: string, name: string
const initialData: ProjectCopyFormDialogData = { name: `Copy of: ${data.name}`, projectUuid: '', uuid: data.projectUuid };
dispatch<any>(initialize(PROJECT_COPY_DIALOG, initialData));
dispatch(dialogActions.OPEN_DIALOG({ id: PROJECT_COPY_DIALOG, data: {} }));
+ };
+
+export const copyProject = (data: {}) =>
+ (dispatch: Dispatch) => {
+ dispatch(startSubmit(PROJECT_COPY_DIALOG));
+ setTimeout(() => dispatch(stopSubmit(PROJECT_COPY_DIALOG, { name: 'Invalid path' })), 2000);
};
\ No newline at end of file
diff --git a/src/views-components/move-to-dialog/move-to-dialog.tsx b/src/views-components/move-to-dialog/move-to-dialog.tsx
index 4c27722..456f3bb 100644
--- a/src/views-components/move-to-dialog/move-to-dialog.tsx
+++ b/src/views-components/move-to-dialog/move-to-dialog.tsx
@@ -3,11 +3,10 @@
// SPDX-License-Identifier: AGPL-3.0
import * as React from "react";
-import { InjectedFormProps, Field, WrappedFieldProps } from 'redux-form';
+import { InjectedFormProps, Field } from 'redux-form';
import { WithDialogProps } from '~/store/dialog/with-dialog';
import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { ProjectTreePicker } from '~/views-components/project-tree-picker/project-tree-picker';
-import { Typography } from "@material-ui/core";
+import { ProjectTreePicker } from '~/components/project-tree-picker/project-tree-picker';
import { MOVE_TO_VALIDATION } from '~/validators/validators';
import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
@@ -22,19 +21,6 @@ export const MoveToFormDialog = (props: WithDialogProps<string> & InjectedFormPr
const MoveToDialogFields = () =>
<Field
name="ownerUuid"
- component={ProjectPicker}
+ component={ProjectTreePicker}
validate={MOVE_TO_VALIDATION} />;
-const ProjectPicker = (props: WrappedFieldProps) =>
- <div style={{ height: '200px', display: 'flex', flexDirection: 'column' }}>
- <ProjectTreePicker onChange={handleChange(props)} />
- {props.meta.dirty && props.meta.error &&
- <Typography variant='caption' color='error'>
- {props.meta.error}
- </Typography>}
- </div>;
-
-const handleChange = (props: WrappedFieldProps) => (value: string) =>
- props.input.value === value
- ? props.input.onChange('')
- : props.input.onChange(value);
diff --git a/src/views-components/project-copy-dialog/project-copy-dialog.tsx b/src/views-components/project-copy-dialog/project-copy-dialog.tsx
index 5237772..dbd1733 100644
--- a/src/views-components/project-copy-dialog/project-copy-dialog.tsx
+++ b/src/views-components/project-copy-dialog/project-copy-dialog.tsx
@@ -3,11 +3,10 @@
// SPDX-License-Identifier: AGPL-3.0
import * as React from "react";
-import { InjectedFormProps, Field, WrappedFieldProps } from 'redux-form';
+import { InjectedFormProps, Field } from 'redux-form';
import { WithDialogProps } from '~/store/dialog/with-dialog';
import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { ProjectTreePicker } from '~/views-components/project-tree-picker/project-tree-picker';
-import { Typography } from "@material-ui/core";
+import { ProjectTreePicker } from '~/components/project-tree-picker/project-tree-picker';
import { COPY_NAME_VALIDATION, MAKE_A_COPY_VALIDATION } from '~/validators/validators';
import { TextField } from "~/components/text-field/text-field";
import { ProjectCopyFormDialogData } from "~/store/project-copy-dialog/project-copy-dialog";
@@ -35,19 +34,5 @@ const ProjectCopyNameField = () =>
const ProjectCopyDialogFields = () =>
<Field
name="projectUuid"
- component={ProjectPicker}
+ component={ProjectTreePicker}
validate={MAKE_A_COPY_VALIDATION} />;
-
-const ProjectPicker = (props: WrappedFieldProps) =>
- <div style={{ height: '200px', display: 'flex', flexDirection: 'column' }}>
- <ProjectTreePicker onChange={handleChange(props)} />
- {props.meta.dirty && props.meta.error &&
- <Typography variant='caption' color='error'>
- {props.meta.error}
- </Typography>}
- </div>;
-
-const handleChange = (props: WrappedFieldProps) => (value: string) =>
- props.input.value === value
- ? props.input.onChange('')
- : props.input.onChange(value);
\ No newline at end of file
diff --git a/src/views-components/project-copy-project-dialog/project-copy-project-dialog.tsx b/src/views-components/project-copy-project-dialog/project-copy-project-dialog.tsx
index 468603f..12fbab1 100644
--- a/src/views-components/project-copy-project-dialog/project-copy-project-dialog.tsx
+++ b/src/views-components/project-copy-project-dialog/project-copy-project-dialog.tsx
@@ -7,14 +7,12 @@ import { withDialog } from "~/store/dialog/with-dialog";
import { reduxForm, startSubmit, stopSubmit } from 'redux-form';
import { PROJECT_COPY_DIALOG } from '~/store/project-copy-project-dialog/project-copy-project-dialog';
import { ProjectCopyFormDialog } from "~/views-components/project-copy-dialog/project-copy-dialog";
+import { copyProject } from '../../store/project-copy-project-dialog/project-copy-project-dialog';
export const ProjectCopyDialog = compose(
withDialog(PROJECT_COPY_DIALOG),
reduxForm({
form: PROJECT_COPY_DIALOG,
- onSubmit: (data, dispatch) => {
- dispatch(startSubmit(PROJECT_COPY_DIALOG));
- setTimeout(() => dispatch(stopSubmit(PROJECT_COPY_DIALOG, { name: 'Invalid path' })), 2000);
- }
+ onSubmit: (data, dispatch) => dispatch(copyProject(data))
})
)(ProjectCopyFormDialog);
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list