Added user management for groups. Improved user experience slightly. Added some error checks for request acks.
This commit is contained in:
@ -1,6 +1,19 @@
|
||||
<div>
|
||||
<h2>{{group?.name}}</h2>
|
||||
|
||||
@if (!isSpecialGroup) {
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Users</mat-panel-title>
|
||||
<mat-panel-description class="muted">
|
||||
{{chatters.length}} user{{chatters.length == 1 ? '' : 's'}}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<twitch-user-list [twitchUsers]="chatters"
|
||||
[group]="group" />
|
||||
</mat-expansion-panel>
|
||||
}
|
||||
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Policies</mat-panel-title>
|
||||
@ -12,9 +25,7 @@
|
||||
[groups]="groups"
|
||||
[policies]="policies"
|
||||
[group]="group?.id" />
|
||||
@if (policies.length > 0) {
|
||||
<policy-table [policies]="policies" />
|
||||
}
|
||||
</mat-expansion-panel>
|
||||
|
||||
<mat-expansion-panel>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Group } from '../../shared/models/group';
|
||||
import { Policy } from '../../shared/models/policy';
|
||||
@ -13,9 +13,10 @@ import { PolicyTableComponent } from "../../policies/policy-table/policy-table.c
|
||||
import { PolicyAddButtonComponent } from '../../policies/policy-add-button/policy-add-button.component';
|
||||
import { HermesClientService } from '../../hermes-client.service';
|
||||
import { GroupChatter } from '../../shared/models/group-chatter';
|
||||
import { TwitchUsersModule } from "../../twitch-users/twitch-users.module";
|
||||
import { SpecialGroups } from '../../shared/utils/groups';
|
||||
|
||||
@Component({
|
||||
selector: 'group-page',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatExpansionModule,
|
||||
@ -25,7 +26,9 @@ import { GroupChatter } from '../../shared/models/group-chatter';
|
||||
PoliciesModule,
|
||||
PolicyAddButtonComponent,
|
||||
ReactiveFormsModule,
|
||||
PolicyTableComponent
|
||||
PolicyTableComponent,
|
||||
PolicyTableComponent,
|
||||
TwitchUsersModule,
|
||||
],
|
||||
templateUrl: './group-page.component.html',
|
||||
styleUrl: './group-page.component.scss'
|
||||
@ -38,6 +41,7 @@ export class GroupPageComponent {
|
||||
private _chatters: GroupChatter[];
|
||||
private _policies: Policy[];
|
||||
|
||||
isSpecialGroup = false;
|
||||
groups: Group[] = [];
|
||||
|
||||
constructor() {
|
||||
@ -57,6 +61,7 @@ export class GroupPageComponent {
|
||||
}
|
||||
|
||||
this._group = group;
|
||||
this.isSpecialGroup = SpecialGroups.includes(this.group!.name);
|
||||
this._chatters = [...data['chatters'].filter((c: GroupChatter) => c.group_id == group_id)];
|
||||
this._policies = [...data['policies'].filter((p: Policy) => p.group_id == group_id)];
|
||||
});
|
||||
@ -79,7 +84,7 @@ export class GroupPageComponent {
|
||||
if (!this.group)
|
||||
return;
|
||||
|
||||
this._client.first(d => d.d.request.type == 'delete_group' && d.d.request.data.id == this.group!.id)
|
||||
this._client.first(d => d.d.request.type == 'delete_group' && d.d.request.data.group == this.group!.id)
|
||||
.subscribe(async () => await this._router.navigate(['groups']));
|
||||
this._client.deleteGroup(this.group.id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user