[Provider] Add events for Provider Organizations (#1090)

This commit is contained in:
Oscar Hinton 2021-07-21 19:53:21 +02:00 committed by GitHub
parent a94faf06a9
commit c608a489dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 2 deletions

View File

@ -58,6 +58,13 @@ export class ClientsComponent implements OnInit {
this.providerId = params.providerId;
await this.load();
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
this.searchText = qParams.search;
if (queryParamsSub != null) {
queryParamsSub.unsubscribe();
}
});
});
}

2
jslib

@ -1 +1 @@
Subproject commit 00acbce556c015fae9e6281ea7db2e704ec96c26
Subproject commit 8bf0f75d9e9869bbb8df397fb0c3bae4359eacf0

View File

@ -245,6 +245,18 @@ export class EventService {
msg = this.i18nService.t('removedUserId', this.formatProviderUserId(ev));
humanReadableMsg = this.i18nService.t('removedUserId', this.getShortId(ev.providerUserId));
break;
case EventType.ProviderOrganization_Created:
msg = this.i18nService.t('createdOrganizationId', this.formatProviderOrganizationId(ev));
humanReadableMsg = this.i18nService.t('createdOrganizationId', this.getShortId(ev.providerOrganizationId));
break;
case EventType.ProviderOrganization_Added:
msg = this.i18nService.t('addedOrganizationId', this.formatProviderOrganizationId(ev));
humanReadableMsg = this.i18nService.t('addedOrganizationId', this.getShortId(ev.providerOrganizationId));
break;
case EventType.ProviderOrganization_Removed:
msg = this.i18nService.t('removedOrganizationId', this.formatProviderOrganizationId(ev));
humanReadableMsg = this.i18nService.t('removedOrganizationId', this.getShortId(ev.providerOrganizationId));
break;
default:
break;
}
@ -342,6 +354,13 @@ export class EventService {
return a.outerHTML;
}
private formatProviderOrganizationId(ev: EventResponse) {
const shortId = this.getShortId(ev.providerOrganizationId);
const a = this.makeAnchor(shortId);
a.setAttribute('href', '#/providers/' + ev.providerId + '/clients?search=' + shortId);
return a.outerHTML;
}
private formatPolicyId(ev: EventResponse) {
const shortId = this.getShortId(ev.policyId);
const a = this.makeAnchor(shortId);
@ -357,7 +376,7 @@ export class EventService {
}
private getShortId(id: string) {
return id.substring(0, 8);
return id?.substring(0, 8);
}
private toDateTimeLocalString(date: Date) {

View File

@ -2577,6 +2577,33 @@
}
}
},
"createdOrganizationId": {
"message": "Created organization $ID$.",
"placeholders": {
"id": {
"content": "$1",
"example": "John Smith"
}
}
},
"addedOrganizationId": {
"message": "Added organization $ID$.",
"placeholders": {
"id": {
"content": "$1",
"example": "John Smith"
}
}
},
"removedOrganizationId": {
"message": "Removed organization $ID$.",
"placeholders": {
"id": {
"content": "$1",
"example": "John Smith"
}
}
},
"device": {
"message": "Device"
},