mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-27 04:03:00 +02:00
Added search logic
This commit is contained in:
parent
e2b49b74c4
commit
b971474974
@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { BehaviorSubject, Subject, from, switchMap, takeUntil } from "rxjs";
|
||||
|
||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||
import { SearchModule, TableDataSource } from "@bitwarden/components";
|
||||
|
||||
import { HeaderModule } from "../../../../../../../apps/web/src/app/layouts/header/header.module";
|
||||
@ -16,6 +17,7 @@ import { MemberAccessReportView } from "./view/member-access-report.view";
|
||||
standalone: true,
|
||||
})
|
||||
export class MemberAccessReportComponent implements OnInit {
|
||||
protected destroy$ = new Subject<void>();
|
||||
protected dataSource = new TableDataSource<MemberAccessReportView>();
|
||||
private _searchText$ = new BehaviorSubject<string>("");
|
||||
|
||||
@ -25,10 +27,25 @@ export class MemberAccessReportComponent implements OnInit {
|
||||
|
||||
set searchText(value: string) {
|
||||
this._searchText$.next(value);
|
||||
this.dataSource.filter = value;
|
||||
}
|
||||
constructor(protected reportService: MemberAccessReportService) {}
|
||||
|
||||
constructor(
|
||||
protected reportService: MemberAccessReportService,
|
||||
private searchService: SearchService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.dataSource.data = this.reportService.getMemberAccessMockData();
|
||||
|
||||
this._searchText$.pipe(
|
||||
switchMap((searchText) => from(this.searchService.isSearchable(searchText))),
|
||||
takeUntil(this.destroy$),
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user