mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
import { AppsState, ClientDto, ClientsState, DialogModel, RoleDto } from '@app/shared';
|
|
|
|
@Component({
|
|
selector: 'sqx-client',
|
|
styleUrls: ['./client.component.scss'],
|
|
templateUrl: './client.component.html',
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ClientComponent {
|
|
@Input()
|
|
public client: ClientDto;
|
|
|
|
@Input()
|
|
public clientRoles: ReadonlyArray<RoleDto>;
|
|
|
|
public connectDialog = new DialogModel();
|
|
|
|
constructor(
|
|
public readonly appsState: AppsState,
|
|
private readonly clientsState: ClientsState
|
|
) {
|
|
}
|
|
|
|
public revoke() {
|
|
this.clientsState.revoke(this.client);
|
|
}
|
|
|
|
public update(role: string) {
|
|
this.clientsState.update(this.client, { role });
|
|
}
|
|
|
|
public updateAccess(allowAnonymous: boolean) {
|
|
this.clientsState.update(this.client, { allowAnonymous });
|
|
}
|
|
|
|
public rename(name: string) {
|
|
this.clientsState.update(this.client, { name });
|
|
}
|
|
|
|
public trackByRole(_index: number, role: RoleDto) {
|
|
return role.name;
|
|
}
|
|
}
|