X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/83cc752d85a910c19ffaf5c74433fbf7fa76e038..2ab43f230662c3f5d7d7ff75c08bdab0c66b22b0:/src/views-components/form-fields/collection-form-fields.tsx diff --git a/src/views-components/form-fields/collection-form-fields.tsx b/src/views-components/form-fields/collection-form-fields.tsx index f6dc5d55..7e18111a 100644 --- a/src/views-components/form-fields/collection-form-fields.tsx +++ b/src/views-components/form-fields/collection-form-fields.tsx @@ -2,25 +2,45 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from "react"; -import { Field } 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 { ProjectTreePickerField, CollectionTreePickerField } from "~/views-components/projects-tree-picker/tree-picker-field"; -import { PickerIdProp } from '~/store/tree-picker/picker-id'; - -export const CollectionNameField = () => - ; +import React from "react"; +import { Field, Validator } from "redux-form"; +import { TextField } from "components/text-field/text-field"; +import { + COLLECTION_NAME_VALIDATION, COLLECTION_NAME_VALIDATION_ALLOW_SLASH, + COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION +} from "validators/validators"; +import { ProjectTreePickerField, CollectionTreePickerField } from "views-components/projects-tree-picker/tree-picker-field"; +import { PickerIdProp } from 'store/tree-picker/picker-id'; +import { connect } from "react-redux"; +import { RootState } from "store/store"; +import { MultiCheckboxField } from "components/checkbox-field/checkbox-field"; +import { getStorageClasses } from "common/config"; + +interface CollectionNameFieldProps { + validate: Validator[]; +} + +// See implementation note on declaration of ProjectNameField + +export const CollectionNameField = connect( + (state: RootState) => { + return { + validate: (state.auth.config.clusterConfig.Collections.ForwardSlashNameSubstitution === "" ? + COLLECTION_NAME_VALIDATION : COLLECTION_NAME_VALIDATION_ALLOW_SLASH) + }; + })((props: CollectionNameFieldProps) => + + ); export const CollectionDescriptionField = () => ; @@ -37,3 +57,25 @@ export const CollectionPickerField = (props: PickerIdProp) => pickerId={props.pickerId} component={CollectionTreePickerField} validate={COLLECTION_PROJECT_VALIDATION} />; + +interface StorageClassesProps { + items: string[]; + defaultClasses?: string[]; +} + +export const CollectionStorageClassesField = connect( + (state: RootState) => { + return { + items: getStorageClasses(state.auth.config) + }; + })( + (props: StorageClassesProps) => + ); \ No newline at end of file