if (isItemNotInProject(properties) || !isProjectOrRunProcessRoute(router)) {
const userUuid = getUserUuid(getState());
if (!userUuid) { return; }
- dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { userUuid }));
+ dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { ownerUuid: userUuid }));
} else {
dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { ownerUuid }));
}
if (isItemNotInProject(properties) || !isProjectOrRunProcessRoute(router)) {
const userUuid = getUserUuid(getState());
if (!userUuid) { return; }
- dispatch(initialize(PROJECT_CREATE_FORM_NAME, { userUuid }));
+ dispatch(initialize(PROJECT_CREATE_FORM_NAME, { ownerUuid: userUuid }));
} else {
dispatch(initialize(PROJECT_CREATE_FORM_NAME, { ownerUuid }));
}
import { FormDialog } from '~/components/form-dialog/form-dialog';
import { CollectionNameField, CollectionDescriptionField } from '~/views-components/form-fields/collection-form-fields';
import { FileUploaderField } from '../file-uploader/file-uploader';
-
+import { ResourceLocationField } from '../form-fields/resource-form-fields';
type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
/>;
const CollectionAddFields = () => <span>
+ <ResourceLocationField />
<CollectionNameField />
<CollectionDescriptionField />
<Field
import { ProjectNameField, ProjectDescriptionField } from '~/views-components/form-fields/project-form-fields';
import { CreateProjectPropertiesForm } from '~/views-components/project-properties/create-project-properties-form';
import { CreateProjectPropertiesList } from '~/views-components/project-properties/create-project-properties-list';
+import { ResourceLocationField } from '../form-fields/resource-form-fields';
type DialogProjectProps = WithDialogProps<{}> & InjectedFormProps<ProjectCreateFormDialogData>;
/>;
const ProjectAddFields = () => <span>
+ <ResourceLocationField />
<ProjectNameField />
<ProjectDescriptionField />
<CreateProjectPropertiesForm />
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { connect } from "react-redux";
+import { RootState } from "~/store/store";
+import { Field } from "redux-form";
+import { ResourcesState, getResource } from "~/store/resources/resources";
+import { GroupResource } from "~/models/group";
+import { TextField } from "~/components/text-field/text-field";
+import { getUserUuid } from "~/common/getuser";
+
+interface ResourceLocationFieldProps {
+ resources: ResourcesState;
+ userUuid: string|undefined;
+}
+
+export const ResourceLocationField = connect(
+ (state: RootState) => {
+ return {
+ resources: state.resources,
+ userUuid: getUserUuid(state),
+ };
+ })
+ ((props: ResourceLocationFieldProps) =>
+ <Field
+ name='ownerUuid'
+ disabled={true}
+ label='Location'
+ format={
+ (value, name) => {
+ if (value === props.userUuid) {
+ return 'Home project';
+ }
+ const rsc = getResource<GroupResource>(value)(props.resources);
+ if (rsc !== undefined) {
+ return `Project '${rsc.name}' (${rsc.uuid})`;
+ }
+ return value;
+ }
+ }
+ component={TextField} />
+ );