SM-585: Add ability to do table sort for service account list (#4943)
This commit is contained in:
parent
fbd0d41b51
commit
75965e6408
|
@ -17,7 +17,7 @@
|
||||||
</button>
|
</button>
|
||||||
</sm-no-items>
|
</sm-no-items>
|
||||||
|
|
||||||
<bit-table *ngIf="serviceAccounts?.length >= 1">
|
<bit-table *ngIf="serviceAccounts?.length >= 1" [dataSource]="dataSource">
|
||||||
<ng-container header>
|
<ng-container header>
|
||||||
<tr>
|
<tr>
|
||||||
<th bitCell class="tw-w-0">
|
<th bitCell class="tw-w-0">
|
||||||
|
@ -31,9 +31,9 @@
|
||||||
{{ "all" | i18n }}
|
{{ "all" | i18n }}
|
||||||
</label>
|
</label>
|
||||||
</th>
|
</th>
|
||||||
<th bitCell colspan="2">{{ "name" | i18n }}</th>
|
<th bitCell colspan="2" bitSortable="name" default>{{ "name" | i18n }}</th>
|
||||||
<th bitCell>{{ "secrets" | i18n }}</th>
|
<th bitCell>{{ "secrets" | i18n }}</th>
|
||||||
<th bitCell>{{ "lastEdited" | i18n }}</th>
|
<th bitCell bitSortable="revisionDate">{{ "lastEdited" | i18n }}</th>
|
||||||
<th bitCell class="tw-w-0">
|
<th bitCell class="tw-w-0">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -46,8 +46,8 @@
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-template body>
|
<ng-template body let-rows$>
|
||||||
<tr bitRow *ngFor="let serviceAccount of serviceAccounts">
|
<tr bitRow *ngFor="let serviceAccount of rows$ | async">
|
||||||
<td bitCell>
|
<td bitCell>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { SelectionModel } from "@angular/cdk/collections";
|
||||||
import { Component, EventEmitter, Input, OnDestroy, Output } from "@angular/core";
|
import { Component, EventEmitter, Input, OnDestroy, Output } from "@angular/core";
|
||||||
import { Subject, takeUntil } from "rxjs";
|
import { Subject, takeUntil } from "rxjs";
|
||||||
|
|
||||||
|
import { TableDataSource } from "@bitwarden/components";
|
||||||
|
|
||||||
import { ServiceAccountView } from "../models/view/service-account.view";
|
import { ServiceAccountView } from "../models/view/service-account.view";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -9,6 +11,8 @@ import { ServiceAccountView } from "../models/view/service-account.view";
|
||||||
templateUrl: "./service-accounts-list.component.html",
|
templateUrl: "./service-accounts-list.component.html",
|
||||||
})
|
})
|
||||||
export class ServiceAccountsListComponent implements OnDestroy {
|
export class ServiceAccountsListComponent implements OnDestroy {
|
||||||
|
protected dataSource = new TableDataSource<ServiceAccountView>();
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
get serviceAccounts(): ServiceAccountView[] {
|
get serviceAccounts(): ServiceAccountView[] {
|
||||||
return this._serviceAccounts;
|
return this._serviceAccounts;
|
||||||
|
@ -16,6 +20,7 @@ export class ServiceAccountsListComponent implements OnDestroy {
|
||||||
set serviceAccounts(serviceAccounts: ServiceAccountView[]) {
|
set serviceAccounts(serviceAccounts: ServiceAccountView[]) {
|
||||||
this.selection.clear();
|
this.selection.clear();
|
||||||
this._serviceAccounts = serviceAccounts;
|
this._serviceAccounts = serviceAccounts;
|
||||||
|
this.dataSource.data = serviceAccounts;
|
||||||
}
|
}
|
||||||
private _serviceAccounts: ServiceAccountView[];
|
private _serviceAccounts: ServiceAccountView[];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue