Skip to content

Commit

Permalink
Fixed Max Validity interval for required valid until filter
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 17, 2021
1 parent ae38896 commit a5eada6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
"title": "label.max-validity-interval",
"description": "tooltip.max-validity-interval",
"type": "string",
"pattern": "^(R\\d*\\/)?P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
"pattern": "^$|^(R\\d*\\/)?P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ label.provider=Metadata Provider

message.user-role-admin-group=Cannot change group for ROLE_ADMIN users.

message.duration=Requires a valid ISO 8601 duration (ex. PT2D)

message.delete-user-title=Delete User?
message.delete-user-body=You are requesting to delete a user. If you complete this process the user will be removed. This cannot be undone. Do you wish to continue?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"title": "label.max-validity-interval",
"description": "tooltip.max-validity-interval",
"type": "string",
"pattern": "^(R\\d*\\/)?P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
"pattern": "^$|^(R\\d*\\/)?P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions ui/src/app/form/component/widgets/OptionWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const OptionWidget = ({

const _onChange = (selected) => {
const sel = selected[0];

const val = typeof sel === 'object' && sel.label ? sel.label : sel;
setInputValue(val);
onChange(val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ export const BaseProviderDefinition = {
},
parser: (changes, base) => {

const baseFilters = base ? base.metadataFilters.filter(f => MetadataFilterTypes.indexOf(f['@type']) > -1) : []
const baseFilters = base ? base.metadataFilters.filter(f => MetadataFilterTypes.indexOf(f['@type']) > -1) : [];

const parsed = (changes.metadataFilters ? ({
...changes,
metadataFilters: [
...changes.metadataFilters.filter((filter, filterName) => (
Object.keys(filter).filter(k => k !== '@type').length > 0
)),
...changes.metadataFilters.filter((filter, filterName) => {

if (filter['@type'] === 'RequiredValidUntil') {
if (!filter.maxValidityInterval || filter.maxValidityInterval === "") {
return false;
}
}

return Object.keys(filter).filter(k => k !== '@type').length > 0;
}),
...baseFilters
]
}) : changes);
Expand All @@ -43,7 +50,7 @@ export const BaseProviderDefinition = {
if (!filterSchema || !changes) {
return changes;
}

const formatted = (changes.metadataFilters ? ({
...changes,
metadataFilters: Object.values(filterSchema.items).map(item => {
Expand Down

0 comments on commit a5eada6

Please sign in to comment.