diff --git a/backend/src/main/resources/nameid-filter.schema.json b/backend/src/main/resources/nameid-filter.schema.json index 129f543f2..bc8c33cb8 100644 --- a/backend/src/main/resources/nameid-filter.schema.json +++ b/backend/src/main/resources/nameid-filter.schema.json @@ -2,9 +2,10 @@ "type": "object", "fieldsets": [ { - "type": "group", + "type": "group-lg", "fields": [ "name", + "entityAttributesFilterTarget", "filterEnabled", "@type", "resourceId", @@ -13,7 +14,7 @@ ] }, { - "type": "group-lg", + "type": "group", "fields": [ "formats" ] @@ -35,6 +36,60 @@ "type": "boolean", "default": false }, + "entityAttributesFilterTarget": { + "title": "label.search-criteria", + "description": "tooltip.search-criteria", + "type": "object", + "widget": { + "id": "filter-target" + }, + "properties": { + "entityAttributesFilterTargetType": { + "title": "", + "type": "string", + "default": "ENTITY", + "oneOf": [ + { + "enum": [ + "ENTITY" + ], + "description": "value.entity-id" + }, + { + "enum": [ + "REGEX" + ], + "description": "value.regex" + }, + { + "enum": [ + "CONDITION_SCRIPT" + ], + "description": "value.script" + } + ] + }, + "value": { + "type": "array", + "buttons": [ + { + "id": "preview", + "label": "action.preview", + "widget": "icon-button" + } + ], + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string" + } + } + }, + "required": [ + "value", + "entityAttributesFilterTargetType" + ] + }, "@type": { "type": "string", "widget": { @@ -61,75 +116,30 @@ "default": false }, "formats": { + "$ref": "#/definitions/NameIdFormatList" + } + }, + "definitions": { + "NameIdFormatList": { + "title": "label.nameid-format-to-send", + "placeholder": "label.nameid-format", + "description": "tooltip.nameid-format", "type": "array", - "widget": { - "id": "inline-obj-list" - }, - "title": "label.nameid-formats", - "description": "tooltip.nameid-formats", + "uniqueItems": true, "items": { - "type": "object", - "title": "label.nameid-format", + "type": "string", + "minLength": 1, + "maxLength": 255, "widget": { - "id": "inline-obj" - }, - "properties": { - "format": { - "$ref": "#/definitions/NameIDFormat" - }, - "value": { - "type": "string", - "title": "label.nameid-formats-value", - "description": "tooltip.nameid-formats-value" - }, - "type": { - "type": "string", - "title": "label.nameid-formats-type", - "description": "tooltip.nameid-formats-type", - "widget": { - "id": "select" - }, - "oneOf": [ - { - "enum": [ - "ENTITY" - ], - "description": "value.entity" - }, - { - "enum": [ - "CONDITION_REF" - ], - "description": "value.condition-ref" - }, - { - "enum": [ - "CONDITION_SCRIPT" - ], - "description": "value.condition-script" - } - ] - } + "id": "datalist", + "data": [ + "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", + "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", + "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", + "urn:oasis:names:tc:SAML:2.0:nameid-format:transient" + ] } } } - }, - "definitions": { - "NameIDFormat": { - "type": "string", - "title": "label.nameid-formats-format", - "description": "tooltip.nameid-formats-format", - "minLength": 1, - "maxLength": 255, - "widget": { - "id": "datalist", - "data": [ - "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", - "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", - "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", - "urn:oasis:names:tc:SAML:2.0:nameid-format:transient" - ] - } - } } } \ No newline at end of file diff --git a/ui/src/app/metadata/filter/container/edit-filter.component.html b/ui/src/app/metadata/filter/container/edit-filter.component.html index e42137ebf..7f2908762 100644 --- a/ui/src/app/metadata/filter/container/edit-filter.component.html +++ b/ui/src/app/metadata/filter/container/edit-filter.component.html @@ -5,33 +5,45 @@
   - Edit EntityAttributesFilter + Edit Filter {{ type$ | async }}
-
- -   - +
+
+
+
+ + +
+
+
+ + +   + + +
+
+
-
diff --git a/ui/src/app/metadata/filter/container/edit-filter.component.ts b/ui/src/app/metadata/filter/container/edit-filter.component.ts index 5ffb8e58e..696de845a 100644 --- a/ui/src/app/metadata/filter/container/edit-filter.component.ts +++ b/ui/src/app/metadata/filter/container/edit-filter.component.ts @@ -32,6 +32,7 @@ export class EditFilterComponent { isSaving$: Observable; filter: MetadataFilter; isValid: boolean; + type$: Observable; validators$: Observable<{ [key: string]: any }>; @@ -80,7 +81,7 @@ export class EditFilterComponent { } }; - this.definition$.subscribe(d => console.log(d)); + this.type$ = this.model$.pipe(map(f => f['@type'])); } save(): void { diff --git a/ui/src/app/metadata/filter/reducer/index.ts b/ui/src/app/metadata/filter/reducer/index.ts index c1da3cab4..36682ad4d 100644 --- a/ui/src/app/metadata/filter/reducer/index.ts +++ b/ui/src/app/metadata/filter/reducer/index.ts @@ -84,7 +84,6 @@ export const detectFilterType = (changes) => changes.type ? changes.type : chang export const getFilterWithChanges = createSelector(getFilter, getSelectedFilter, mergeFn); export const getFilterType = createSelector(getFilter, (changes: MetadataFilter) => { const type = changes ? detectFilterType(changes) : null; - console.log(type, changes); return type; }); diff --git a/ui/src/assets/schema/filter/nameid.schema.json b/ui/src/assets/schema/filter/nameid.schema.json index 129f543f2..bc8c33cb8 100644 --- a/ui/src/assets/schema/filter/nameid.schema.json +++ b/ui/src/assets/schema/filter/nameid.schema.json @@ -2,9 +2,10 @@ "type": "object", "fieldsets": [ { - "type": "group", + "type": "group-lg", "fields": [ "name", + "entityAttributesFilterTarget", "filterEnabled", "@type", "resourceId", @@ -13,7 +14,7 @@ ] }, { - "type": "group-lg", + "type": "group", "fields": [ "formats" ] @@ -35,6 +36,60 @@ "type": "boolean", "default": false }, + "entityAttributesFilterTarget": { + "title": "label.search-criteria", + "description": "tooltip.search-criteria", + "type": "object", + "widget": { + "id": "filter-target" + }, + "properties": { + "entityAttributesFilterTargetType": { + "title": "", + "type": "string", + "default": "ENTITY", + "oneOf": [ + { + "enum": [ + "ENTITY" + ], + "description": "value.entity-id" + }, + { + "enum": [ + "REGEX" + ], + "description": "value.regex" + }, + { + "enum": [ + "CONDITION_SCRIPT" + ], + "description": "value.script" + } + ] + }, + "value": { + "type": "array", + "buttons": [ + { + "id": "preview", + "label": "action.preview", + "widget": "icon-button" + } + ], + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string" + } + } + }, + "required": [ + "value", + "entityAttributesFilterTargetType" + ] + }, "@type": { "type": "string", "widget": { @@ -61,75 +116,30 @@ "default": false }, "formats": { + "$ref": "#/definitions/NameIdFormatList" + } + }, + "definitions": { + "NameIdFormatList": { + "title": "label.nameid-format-to-send", + "placeholder": "label.nameid-format", + "description": "tooltip.nameid-format", "type": "array", - "widget": { - "id": "inline-obj-list" - }, - "title": "label.nameid-formats", - "description": "tooltip.nameid-formats", + "uniqueItems": true, "items": { - "type": "object", - "title": "label.nameid-format", + "type": "string", + "minLength": 1, + "maxLength": 255, "widget": { - "id": "inline-obj" - }, - "properties": { - "format": { - "$ref": "#/definitions/NameIDFormat" - }, - "value": { - "type": "string", - "title": "label.nameid-formats-value", - "description": "tooltip.nameid-formats-value" - }, - "type": { - "type": "string", - "title": "label.nameid-formats-type", - "description": "tooltip.nameid-formats-type", - "widget": { - "id": "select" - }, - "oneOf": [ - { - "enum": [ - "ENTITY" - ], - "description": "value.entity" - }, - { - "enum": [ - "CONDITION_REF" - ], - "description": "value.condition-ref" - }, - { - "enum": [ - "CONDITION_SCRIPT" - ], - "description": "value.condition-script" - } - ] - } + "id": "datalist", + "data": [ + "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", + "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", + "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", + "urn:oasis:names:tc:SAML:2.0:nameid-format:transient" + ] } } } - }, - "definitions": { - "NameIDFormat": { - "type": "string", - "title": "label.nameid-formats-format", - "description": "tooltip.nameid-formats-format", - "minLength": 1, - "maxLength": 255, - "widget": { - "id": "datalist", - "data": [ - "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", - "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", - "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", - "urn:oasis:names:tc:SAML:2.0:nameid-format:transient" - ] - } - } } } \ No newline at end of file