Skip to content

Commit

Permalink
SHIBUI-812 Integrated attribute release into backend
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 24, 2018
1 parent 0dcc1c2 commit e7c339f
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 16 deletions.
24 changes: 12 additions & 12 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ custom:
attributes:
# Default attributes
- name: eduPersonPrincipalName
displayName: eduPersonPrincipalName (EPPN)
displayName: label.attribute-eduPersonPrincipalName
- name: uid
displayName: uid
displayName: label.attribute-uid
- name: mail
displayName: mail
displayName: label.attribute-mail
- name: surname
displayName: surname
displayName: label.attribute-surname
- name: givenName
displayName: givenName
displayName: label.attribute-givenName
- name: eduPersonAffiliation
displayName: eduPersonAffiliation
displayName: label.attribute-eduPersonAffiliation
- name: eduPersonScopedAffiliation
displayName: eduPersonScopedAffiliation
displayName: label.attribute-eduPersonScopedAffiliation
- name: eduPersonPrimaryAffiliation
displayName: eduPersonPrimaryAffiliation
displayName: label.attribute-eduPersonPrimaryAffiliation
- name: eduPersonEntitlement
displayName: eduPersonEntitlement
displayName: label.attribute-eduPersonEntitlement
- name: eduPersonAssurance
displayName: eduPersonAssurance
displayName: label.attribute-eduPersonAssurance
- name: eduPersonUniqueId
displayName: eduPersonUniqueId
displayName: label.attribute-eduPersonUniqueId
- name: employeeNumber
displayName: employeeNumber
displayName: label.attribute-employeeNumber
# Custom attributes
15 changes: 14 additions & 1 deletion backend/src/main/resources/i18n/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ action.clear=Clear
action.delete=Delete
action.remove=Remove
action.save=Save
action.toggle=Toggle { label }
action.toggle=Toggle
action.add-contact=Add Contact
action.add-contacts=Add Contacts
action.use-mine=Use My Changes
Expand Down Expand Up @@ -284,6 +284,19 @@ label.retained-roles=Retained Roles
label.remove-roleless-entity-descriptors=Remove Roleless Entity Descriptors?
label.remove-empty-entities-descriptors=Remove Empty Entities Descriptors?

label.attribute-eduPersonPrincipalName=eduPersonPrincipalName (EPPN)
label.attribute-uid=uid
label.attribute-mail=mail
label.attribute-surname=surname
label.attribute-givenName=givenName
label.attribute-eduPersonAffiliation=eduPersonAffiliation
label.attribute-eduPersonScopedAffiliation=eduPersonScopedAffiliation
label.attribute-eduPersonPrimaryAffiliation=eduPersonPrimaryAffiliation
label.attribute-eduPersonEntitlement=eduPersonEntitlement
label.attribute-eduPersonAssurance=eduPersonAssurance
label.attribute-eduPersonUniqueId=eduPersonUniqueId
label.attribute-employeeNumber=employeeNumber

message.must-be-unique=Must be unique.

message.conflict=Conflict
Expand Down
13 changes: 13 additions & 0 deletions backend/src/main/resources/i18n/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,19 @@ label.retained-roles=(es) Retained Roles
label.remove-roleless-entity-descriptors=(es) Remove Roleless Entity Descriptors?
label.remove-empty-entities-descriptors=(es) Remove Empty Entities Descriptors?

label.attribute-eduPersonPrincipalName=(es) eduPersonPrincipalName (EPPN)
label.attribute-uid=(es) uid
label.attribute-mail=(es) mail
label.attribute-surname=(es) surname
label.attribute-givenName=(es) givenName
label.attribute-eduPersonAffiliation=(es) eduPersonAffiliation
label.attribute-eduPersonScopedAffiliation=(es) eduPersonScopedAffiliation
label.attribute-eduPersonPrimaryAffiliation=(es) eduPersonPrimaryAffiliation
label.attribute-eduPersonEntitlement=(es) eduPersonEntitlement
label.attribute-eduPersonAssurance=(es) eduPersonAssurance
label.attribute-eduPersonUniqueId=(es) eduPersonUniqueId
label.attribute-employeeNumber=(es) employeeNumber

message.must-be-unique=(es) Must be unique.

message.conflict=(es) Conflict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</thead>
<tbody>
<tr *ngFor="let attr of listOfAttributes$ | async; let i=index;">
<td scope="col">{{ attr.label }}</td>
<td scope="col" [translate]="attr.label">{{ attr.label }}</td>
<td scope="col">
<fieldset>
<div class="custom-control custom-checkbox">
Expand All @@ -19,8 +19,8 @@
(change)="onCheck($event, attr.key)"
[checked]="isChecked(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"/>
<label class="custom-control-label" for="input-{{ i }}"></label>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ReleaseAttribute {
key: string;
label: string;
}
38 changes: 38 additions & 0 deletions ui/src/app/metadata/domain/service/attributes.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { catchError, shareReplay, map } from 'rxjs/operators';
import { ReleaseAttribute } from '../model/properties/release-attribute';

const CACHE_SIZE = 1;

@Injectable()
export class AttributesService {

readonly endpoint = '/customAttributes';
readonly base = '/api';

private cache$: Observable<ReleaseAttribute[]>;

constructor(
private http: HttpClient
) { }

query(path: string = this.endpoint): Observable<ReleaseAttribute[]> {
if (!this.cache$) {
this.cache$ = this.requestAttributes(path).pipe(
shareReplay(CACHE_SIZE)
);
}

return this.cache$;
}

requestAttributes(path: string): Observable<ReleaseAttribute[]> {
return this.http.get<ReleaseAttribute[]>(`${this.base}${path}`, {})
.pipe(
map(attrs => attrs.map((attr: any) => ({ key: attr.name, label: attr.displayName }))),
catchError(err => throwError([]))
);
}
}

0 comments on commit e7c339f

Please sign in to comment.