diff --git a/ui/src/app/metadata/domain/source/component/SourceList.js b/ui/src/app/metadata/domain/source/component/SourceList.js index 671c08a0b..923f41273 100644 --- a/ui/src/app/metadata/domain/source/component/SourceList.js +++ b/ui/src/app/metadata/domain/source/component/SourceList.js @@ -68,7 +68,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup {onEnable && canEnable ? onEnable(source, checked)} diff --git a/ui/src/app/metadata/wizard/MetadataSourceProtocolSelector.js b/ui/src/app/metadata/wizard/MetadataSourceProtocolSelector.js index a9f99dab1..9256a698d 100644 --- a/ui/src/app/metadata/wizard/MetadataSourceProtocolSelector.js +++ b/ui/src/app/metadata/wizard/MetadataSourceProtocolSelector.js @@ -8,6 +8,7 @@ import Translate from '../../i18n/components/translate'; import { InfoIcon } from '../../form/component/InfoIcon'; import { useTranslator } from '../../i18n/hooks'; import { useMetadataSources } from '../hooks/api'; +import { useUserGroup } from '../../core/user/UserContext'; import Button from 'react-bootstrap/Button'; export function MetadataSourceProtocolSelector({ types = [], loading, children}) { @@ -51,7 +52,7 @@ export function MetadataSourceProtocolSelector({ types = [], loading, children}) setSourceIds(data.map(s => s.entityId)); }, [data]); - React.useState(() => console.log(sourceNames), [sourceNames]); + const group = useUserGroup(); return ( <>{showSelector ? @@ -135,12 +136,17 @@ export function MetadataSourceProtocolSelector({ types = [], loading, children}) !(sourceIds.indexOf(v) > -1) - }})} /> + type="text" {...register('entityId', { + required: true, + validate: { + unique: v => !(sourceIds.indexOf(v) > -1) + }, + pattern: new RegExp(group?.validationRegex) + })} /> {errors?.entityId?.type === 'unique' && } {errors?.entityId?.type === 'required' && } + {errors?.entityId?.type === 'pattern' && }