Skip to content

Commit

Permalink
[frontend] complete validation for user
Browse files Browse the repository at this point in the history
  • Loading branch information
helene-nguyen committed Nov 7, 2023
1 parent cc09da7 commit ae08926
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ const CreatorField: FunctionComponent<CreatorFieldProps> = ({
label: n?.node.name,
value: n?.node.id,
}));
const emptyValue = {
label: '',
value: '',
};
const templateValues = [emptyValue, ...creators, ...NewCreators];
const templateValues = [...creators, ...NewCreators];
// Keep only the unique list of options
const uniqTemplates = templateValues.filter((item, index) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ const ingestionTaxiiValidation = (t) => Yup.object().shape({
cert: Yup.string().nullable(),
key: Yup.string().nullable(),
ca: Yup.string().nullable(),
user_id: Yup.object().nullable(),
user_id: Yup.lazy((value) => {
switch (typeof value) {
case 'object':
return Yup.object().nullable(); // schema for object
case 'string':
return Yup.string().nullable();
default:
return Yup.mixed();
}
}),
added_after_start: Yup.date()
.typeError(t('The value must be a datetime (yyyy-MM-dd hh:mm (a|p)m)'))
.nullable(),
Expand Down Expand Up @@ -149,6 +158,7 @@ const IngestionTaxiiEditionContainer = ({
'added_after_start',
]),
)(ingestionTaxii);

return (
<Drawer
title={t('Update a TAXII ingester')}
Expand Down

0 comments on commit ae08926

Please sign in to comment.