[ARVADOS-WORKBENCH2] created: 1.2.0-888-gfcda82d
Git user
git at public.curoverse.com
Thu Nov 15 08:50:25 EST 2018
at fcda82dca52aa45926f8e656c45baf892acdc634 (commit)
commit fcda82dca52aa45926f8e656c45baf892acdc634
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Thu Nov 15 14:36:20 2018 +0100
Add itree picker initialization for CollectionPartialCopyDialog
Feature #14470
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/store/collections/collection-partial-copy-actions.ts b/src/store/collections/collection-partial-copy-actions.ts
index 4dac9c7..0f904c2 100644
--- a/src/store/collections/collection-partial-copy-actions.ts
+++ b/src/store/collections/collection-partial-copy-actions.ts
@@ -12,6 +12,7 @@ import { filterCollectionFilesBySelection } from '../collection-panel/collection
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
import { getCommonResourceServiceError, CommonResourceServiceError } from '~/services/common-service/common-resource-service';
import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
+import { initProjectsTreePicker } from '../tree-picker/tree-picker-actions';
export const COLLECTION_PARTIAL_COPY_FORM_NAME = 'COLLECTION_PARTIAL_COPY_DIALOG';
@@ -32,6 +33,7 @@ export const openCollectionPartialCopyDialog = () =>
};
dispatch(initialize(COLLECTION_PARTIAL_COPY_FORM_NAME, initialData));
dispatch<any>(resetPickerProjectTree());
+ dispatch<any>(initProjectsTreePicker(COLLECTION_PARTIAL_COPY_FORM_NAME));
dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME, data: {} }));
}
};
diff --git a/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx b/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx
index 7c335a3..a56ecca 100644
--- a/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx
+++ b/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx
@@ -3,6 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import * as React from "react";
+import { memoize } from "lodash/fp";
import { FormDialog } from '~/components/form-dialog/form-dialog';
import { CollectionNameField, CollectionDescriptionField, CollectionProjectPickerField } from '~/views-components/form-fields/collection-form-fields';
import { WithDialogProps } from '~/store/dialog/with-dialog';
@@ -11,16 +12,19 @@ import { CollectionPartialCopyFormData } from '~/store/collections/collection-pa
type DialogCollectionPartialCopyProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyFormData>;
-export const DialogCollectionPartialCopy = (props: DialogCollectionPartialCopyProps) =>
+export const DialogCollectionPartialCopy = (props: DialogCollectionPartialCopyProps & { pickerId: string }) =>
<FormDialog
dialogTitle='Create a collection'
- formFields={CollectionPartialCopyFields}
+ formFields={CollectionPartialCopyFields(props.pickerId)}
submitLabel='Create a collection'
{...props}
/>;
-export const CollectionPartialCopyFields = () => <div>
- <CollectionNameField />
- <CollectionDescriptionField />
- <CollectionProjectPickerField />
-</div>;
+export const CollectionPartialCopyFields = memoize(
+ (pickerId: string) =>
+ () =>
+ <div>
+ <CollectionNameField />
+ <CollectionDescriptionField />
+ <CollectionProjectPickerField {...{ pickerId }} />
+ </div>);
diff --git a/src/views-components/dialog-forms/partial-copy-collection-dialog.ts b/src/views-components/dialog-forms/partial-copy-collection-dialog.ts
index 16f8275..37d928b 100644
--- a/src/views-components/dialog-forms/partial-copy-collection-dialog.ts
+++ b/src/views-components/dialog-forms/partial-copy-collection-dialog.ts
@@ -7,6 +7,7 @@ import { reduxForm } from 'redux-form';
import { withDialog, } from '~/store/dialog/with-dialog';
import { CollectionPartialCopyFormData, copyCollectionPartial, COLLECTION_PARTIAL_COPY_FORM_NAME } from '~/store/collections/collection-partial-copy-actions';
import { DialogCollectionPartialCopy } from "~/views-components/dialog-copy/dialog-collection-partial-copy";
+import { pickerId } from "~/store/tree-picker/picker-id";
export const PartialCopyCollectionDialog = compose(
@@ -16,4 +17,6 @@ export const PartialCopyCollectionDialog = compose(
onSubmit: (data, dispatch) => {
dispatch(copyCollectionPartial(data));
}
- }))(DialogCollectionPartialCopy);
\ No newline at end of file
+ }),
+ pickerId(COLLECTION_PARTIAL_COPY_FORM_NAME),
+)(DialogCollectionPartialCopy);
\ No newline at end of file
commit fc05ea3e89e7618ea0a52d88a377533512d5ec32
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Thu Nov 15 14:35:54 2018 +0100
Use ProjectTreePickerField in CollectionProjectPickerField
Feature #14470
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/views-components/form-fields/collection-form-fields.tsx b/src/views-components/form-fields/collection-form-fields.tsx
index be5f93d..d6cbd8d 100644
--- a/src/views-components/form-fields/collection-form-fields.tsx
+++ b/src/views-components/form-fields/collection-form-fields.tsx
@@ -6,7 +6,7 @@ import * as React from "react";
import { Field, WrappedFieldProps } from "redux-form";
import { TextField } from "~/components/text-field/text-field";
import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "~/validators/validators";
-import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
+import { ProjectTreePicker, ProjectTreePickerField } from "~/views-components/project-tree-picker/project-tree-picker";
export const CollectionNameField = () =>
<Field
@@ -23,13 +23,9 @@ export const CollectionDescriptionField = () =>
validate={COLLECTION_DESCRIPTION_VALIDATION}
label="Description - optional" />;
-export const CollectionProjectPickerField = () =>
+export const CollectionProjectPickerField = (props: { pickerId: string }) =>
<Field
name="projectUuid"
- component={ProjectPicker}
+ pickerId={props.pickerId}
+ component={ProjectTreePickerField}
validate={COLLECTION_PROJECT_VALIDATION} />;
-
-const ProjectPicker = (props: WrappedFieldProps) =>
- <div style={{ height: '144px', display: 'flex', flexDirection: 'column' }}>
- <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
- </div>;
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list