Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/shibui-2380' into featur…
Browse files Browse the repository at this point in the history
…e/shibui-2380
  • Loading branch information
chasegawa committed Oct 18, 2022
2 parents 279c2b7 + fb8a2f9 commit f245e5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/metadata/domain/source/component/SourceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
{onEnable && canEnable ?
<Form.Check
type="switch"
id={`enable-switch-${source.id}`}
id={`enable-switch-${idx}`}
size="lg"
aria-label={translator(source.serviceEnabled ? 'label.disable' : 'label.enable')}
onChange={({ target: { checked } }) => onEnable(source, checked)}
Expand Down
14 changes: 10 additions & 4 deletions ui/src/app/metadata/wizard/MetadataSourceProtocolSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand Down Expand Up @@ -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 ?
Expand Down Expand Up @@ -135,12 +136,17 @@ export function MetadataSourceProtocolSelector({ types = [], loading, children})
<Form.Control
id="root_entityId"
isInvalid={errors.entityId}
type="text" {...register('entityId', {required: true, validate: {
unique: v => !(sourceIds.indexOf(v) > -1)
}})} />
type="text" {...register('entityId', {
required: true,
validate: {
unique: v => !(sourceIds.indexOf(v) > -1)
},
pattern: new RegExp(group?.validationRegex)
})} />
<Form.Text className={errors.entityId ? 'text-danger' : 'text-muted'}>
{errors?.entityId?.type === 'unique' && <Translate value={`message.must-be-unique`} />}
{errors?.entityId?.type === 'required' && <Translate value={`message.service-resolver-name-required`} />}
{errors?.entityId?.type === 'pattern' && <Translate value={`message.group-pattern-fail`} params={{regex: group?.validationRegex}} />}
</Form.Text>
</Form.Group>
</Form>
Expand Down

0 comments on commit f245e5e

Please sign in to comment.