diff --git a/ui/src/app/metadata/domain/domain.module.ts b/ui/src/app/metadata/domain/domain.module.ts index c51bbb260..43ceee433 100644 --- a/ui/src/app/metadata/domain/domain.module.ts +++ b/ui/src/app/metadata/domain/domain.module.ts @@ -13,6 +13,7 @@ import { MetadataProviderService } from './service/provider.service'; import { EntityEffects } from './effect/entity.effect'; import { PreviewDialogComponent } from './component/preview-dialog.component'; import { MetadataFilterService } from './service/filter.service'; +import { AttributesService } from './service/attributes.service'; export const COMPONENTS = [ PreviewDialogComponent @@ -44,7 +45,8 @@ export class DomainModule { ProviderStatusEmitter, ProviderValueEmitter, MetadataProviderService, - MetadataFilterService + MetadataFilterService, + AttributesService ] }; } diff --git a/ui/src/app/metadata/domain/service/list-values.service.ts b/ui/src/app/metadata/domain/service/list-values.service.ts index 644a2be7b..dff88ea7e 100644 --- a/ui/src/app/metadata/domain/service/list-values.service.ts +++ b/ui/src/app/metadata/domain/service/list-values.service.ts @@ -2,10 +2,14 @@ import { Injectable } from '@angular/core'; import { Observable, of } from 'rxjs'; import { debounceTime, distinctUntilChanged, combineLatest } from 'rxjs/operators'; +import { AttributesService } from './attributes.service'; +import { ReleaseAttribute } from '../model/properties/release-attribute'; @Injectable() export class ListValuesService { - constructor() {} + constructor( + private attributes: AttributesService + ) {} readonly nameIdFormats: Observable = of([ 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified', @@ -20,21 +24,9 @@ export class ListValuesService { 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport' ]); - readonly attributesToRelease: Observable<{ key: string, label: string }[]> = of([ - { key: 'eduPersonPrincipalName', label: 'eduPersonPrincipalName (EPPN)' }, - { key: 'uid', label: 'uid' }, - { key: 'mail', label: 'mail' }, - { key: 'surname', label: 'surname' }, - { key: 'givenName', label: 'givenName' }, - { key: 'displayName', label: 'displayName' }, - { key: 'eduPersonAffiliation', label: 'eduPersonAffiliation' }, - { key: 'eduPersonScopedAffiliation', label: 'eduPersonScopedAffiliation' }, - { key: 'eduPersonPrimaryAffiliation', label: 'eduPersonPrimaryAffiliation' }, - { key: 'eduPersonEntitlement', label: 'eduPersonEntitlement' }, - { key: 'eduPersonAssurance', label: 'eduPersonAssurance' }, - { key: 'eduPersonUniqueId', label: 'eduPersonUniqueId' }, - { key: 'employeeNumber', label: 'employeeNumber' } - ]); + get attributesToRelease(): Observable { + return this.attributes.query(); + } searchStringList = (list: Observable): Function => (text$: Observable) => diff --git a/ui/src/app/schema-form/widget/check/checklist.component.html b/ui/src/app/schema-form/widget/check/checklist.component.html index ec85c8459..9a6a7a71e 100644 --- a/ui/src/app/schema-form/widget/check/checklist.component.html +++ b/ui/src/app/schema-form/widget/check/checklist.component.html @@ -8,8 +8,8 @@ - - {{ attr.label }} + + {{ attr.label | translate }}
@@ -18,13 +18,13 @@ (change)="onCheck(attr.key)" [checked]="checked[attr.key]" id="input-{{ i }}" - [attr.name]="attr.label" - [attr.aria-label]="attr.label" + [attr.name]="attr.label | translate" + [attr.aria-label]="attr.label | translate" role="checkbox" aria-checked="false" />
diff --git a/ui/src/app/schema-form/widget/check/checklist.component.ts b/ui/src/app/schema-form/widget/check/checklist.component.ts index aca5b12b5..16dd3224a 100644 --- a/ui/src/app/schema-form/widget/check/checklist.component.ts +++ b/ui/src/app/schema-form/widget/check/checklist.component.ts @@ -1,6 +1,8 @@ import { Component, AfterViewInit } from '@angular/core'; import { ArrayWidget } from 'ngx-schema-form'; +import { AttributesService } from '../../../metadata/domain/service/attributes.service'; +import { Observable, of } from 'rxjs'; /* istanbul ignore next */ @Component({ @@ -10,6 +12,12 @@ import { ArrayWidget } from 'ngx-schema-form'; export class ChecklistComponent extends ArrayWidget implements AfterViewInit { checked: any = {}; + constructor( + private attributes: AttributesService + ) { + super(); + } + ngAfterViewInit(): void { super.ngAfterViewInit(); this.formProperty.value.forEach(val => this.checked[val] = true); @@ -19,6 +27,10 @@ export class ChecklistComponent extends ArrayWidget implements AfterViewInit { this.formProperty.setValue(Object.keys(this.checked), false); } + get data(): Observable<{ key: string, label: string }[]> { + return this.schema.widget.data ? of(this.schema.widget.data) : this.attributes.query(this.schema.widget.dataUrl); + } + onCheck(value) { if (!this.checked[value]) { this.checked[value] = true; diff --git a/ui/src/assets/schema/filter/entity-attributes.schema.json b/ui/src/assets/schema/filter/entity-attributes.schema.json index e3fdc5bde..307756c63 100644 --- a/ui/src/assets/schema/filter/entity-attributes.schema.json +++ b/ui/src/assets/schema/filter/entity-attributes.schema.json @@ -182,21 +182,7 @@ "description": "Attribute release table - select the attributes you want to release (default unchecked)", "widget": { "id": "checklist", - "data": [ - { "key": "eduPersonPrincipalName", "label": "eduPersonPrincipalName (EPPN)" }, - { "key": "uid", "label": "uid" }, - { "key": "mail", "label": "mail" }, - { "key": "surname", "label": "surname" }, - { "key": "givenName", "label": "givenName" }, - { "key": "displayName", "label": "displayName" }, - { "key": "eduPersonAffiliation", "label": "eduPersonAffiliation" }, - { "key": "eduPersonScopedAffiliation", "label": "eduPersonScopedAffiliation" }, - { "key": "eduPersonPrimaryAffiliation", "label": "eduPersonPrimaryAffiliation" }, - { "key": "eduPersonEntitlement", "label": "eduPersonEntitlement" }, - { "key": "eduPersonAssurance", "label": "eduPersonAssurance" }, - { "key": "eduPersonUniqueId", "label": "eduPersonUniqueId" }, - { "key": "employeeNumber", "label": "employeeNumber" } - ] + "dataUrl": "/customAttributes" }, "items": { "type": "string"