1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from "redux";
6 import { reduxForm, reset, startSubmit, stopSubmit } from "redux-form";
7 import { withDialog } from "../../store/dialog/with-dialog";
8 import { dialogActions } from "../../store/dialog/dialog-actions";
9 import { DialogCollectionCreateWithSelected } from "../dialog-create/dialog-collection-create-selected";
10 import { loadProjectTreePickerProjects } from "../project-tree-picker/project-tree-picker";
12 export const DIALOG_COLLECTION_CREATE_WITH_SELECTED = 'dialogCollectionCreateWithSelected';
14 export const createCollectionWithSelected = () =>
15 (dispatch: Dispatch) => {
16 dispatch(reset(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
17 dispatch<any>(loadProjectTreePickerProjects(''));
18 dispatch(dialogActions.OPEN_DIALOG({ id: DIALOG_COLLECTION_CREATE_WITH_SELECTED, data: {} }));
21 export const [DialogCollectionCreateWithSelectedFile] = [DialogCollectionCreateWithSelected]
22 .map(withDialog(DIALOG_COLLECTION_CREATE_WITH_SELECTED))
24 form: DIALOG_COLLECTION_CREATE_WITH_SELECTED,
25 onSubmit: (data, dispatch) => {
26 dispatch(startSubmit(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
27 setTimeout(() => dispatch(stopSubmit(DIALOG_COLLECTION_CREATE_WITH_SELECTED, { name: 'Invalid name' })), 2000);