1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { InjectedFormProps } from 'redux-form';
7 import { WithDialogProps } from 'store/dialog/with-dialog';
8 import { ProjectUpdateFormDialogData } from 'store/projects/project-update-actions';
9 import { FormDialog } from 'components/form-dialog/form-dialog';
10 import { ProjectNameField, ProjectDescriptionField, UsersField } from 'views-components/form-fields/project-form-fields';
11 import { GroupClass } from 'models/group';
13 type DialogProjectProps = WithDialogProps<{sourcePanel: GroupClass, create?: boolean}> & InjectedFormProps<ProjectUpdateFormDialogData>;
15 export const DialogProjectUpdate = (props: DialogProjectProps) => {
16 let title = 'Edit Project';
17 let fields = ProjectEditFields;
18 const sourcePanel = props.data.sourcePanel || '';
19 const create = !!props.data.create;
21 if (sourcePanel === GroupClass.ROLE) {
22 title = create ? 'Create Group' : 'Edit Group';
23 fields = create ? GroupAddFields : ProjectEditFields;
34 // Also used as "Group Edit Fields"
35 const ProjectEditFields = () => <span>
37 <ProjectDescriptionField />
40 const GroupAddFields = () => <span>
43 <ProjectDescriptionField />