X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/1bda4645781ebb80f6d0db901f857abff088d749..df9197982583c61e6f142d37ca8e01a8277027d3:/src/views-components/form-fields/project-form-fields.tsx diff --git a/src/views-components/form-fields/project-form-fields.tsx b/src/views-components/form-fields/project-form-fields.tsx index 967d3e5b..48348bab 100644 --- a/src/views-components/form-fields/project-form-fields.tsx +++ b/src/views-components/form-fields/project-form-fields.tsx @@ -2,21 +2,57 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from "react"; -import { Field, WrappedFieldProps } from "redux-form"; -import { TextField } from "~/components/text-field/text-field"; -import { PROJECT_NAME_VALIDATION, PROJECT_DESCRIPTION_VALIDATION } from "~/validators/validators"; +import React from "react"; +import { Field, FieldArray, Validator, WrappedFieldArrayProps } from "redux-form"; +import { TextField, RichEditorTextField } from "components/text-field/text-field"; +import { PROJECT_NAME_VALIDATION, PROJECT_NAME_VALIDATION_ALLOW_SLASH } from "validators/validators"; +import { connect } from "react-redux"; +import { RootState } from "store/store"; +import { Participant, ParticipantSelect } from "views-components/sharing-dialog/participant-select"; -export const ProjectNameField = () => - ; +interface ProjectNameFieldProps { + validate: Validator[]; + label?: string; +} + +// Validation behavior depends on the value of ForwardSlashNameSubstitution. +// +// Redux form doesn't let you pass anonymous functions to 'validate' +// -- it fails with a very confusing recursive-update-exceeded error. +// So we can't construct the validation function on the fly. +// +// As a workaround, use ForwardSlashNameSubstitution to choose between one of two const-defined validators. + +export const ProjectNameField = connect( + (state: RootState) => { + return { + validate: (state.auth.config.clusterConfig.Collections.ForwardSlashNameSubstitution === "" ? + PROJECT_NAME_VALIDATION : PROJECT_NAME_VALIDATION_ALLOW_SLASH) + }; + })((props: ProjectNameFieldProps) => + + ); export const ProjectDescriptionField = () => ; \ No newline at end of file + component={RichEditorTextField as any} + label="Description - optional" />; + +export const UsersField = () => + ; + +export const UsersSelect = ({ fields }: WrappedFieldArrayProps) => + ;