61 lines
2.3 KiB
HTML
61 lines
2.3 KiB
HTML
<table mat-table [dataSource]="policies" class="mat-elevation-z8">
|
|
<ng-container matColumnDef="path">
|
|
<th mat-header-cell *matHeaderCellDef>Path</th>
|
|
<td mat-cell *matCellDef="let policy">
|
|
{{policy.path}}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="group">
|
|
<th mat-header-cell *matHeaderCellDef>Group</th>
|
|
<td mat-cell *matCellDef="let policy">
|
|
@if (policy.editing) {
|
|
<input type="text" [(ngModel)]="policy.temp_group_name" />
|
|
}
|
|
@if (!policy.editing && groups[policy.group_id]) {
|
|
{{groups[policy.group_id].name}}
|
|
}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="usage">
|
|
<th mat-header-cell *matHeaderCellDef>Usage Rate</th>
|
|
<td mat-cell *matCellDef="let policy">
|
|
@if (policy.editing) {
|
|
<input type="number" [(ngModel)]="policy.usage" (keypress)="($event.charCode >= 48 && $event.charCode < 58)" />
|
|
}
|
|
@if (!policy.editing) {
|
|
{{policy.usage}}
|
|
}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="span">
|
|
<th mat-header-cell *matHeaderCellDef>Span (ms)</th>
|
|
<td mat-cell *matCellDef="let policy">
|
|
@if (policy.editing) {
|
|
<input type="number" [(ngModel)]="policy.span" (keypress)="($event.charCode >= 48 && $event.charCode < 58)" />
|
|
}
|
|
@if (!policy.editing) {
|
|
{{policy.span}}
|
|
}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="actions">
|
|
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
|
<td mat-cell *matCellDef="let policy">
|
|
@if (!policy.editing) {
|
|
<button mat-mini-fab (click)="edit(policy)"><mat-icon>edit</mat-icon></button>
|
|
<button mat-mini-fab (click)="delete(policy)"><mat-icon>delete</mat-icon></button>
|
|
}
|
|
@if (policy.editing) {
|
|
<button mat-mini-fab (click)="save(policy)"><mat-icon>save</mat-icon></button>
|
|
<button mat-mini-fab (click)="cancel(policy)"><mat-icon>cancel</mat-icon></button>
|
|
}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
</table> |