Skip to content

Commit

Permalink
chore: add progress filter
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaZhem committed Aug 28, 2024
1 parent 9b1ad95 commit 5ca99be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
formControlName="filter"
size="s"
[items]="items"
(ngModelChange)="progressSort.set(form.controls.filter.value)"
/>
Results: {{ searchedData().length }}
Results: {{ searchedData().length }} {{ progressSort() }}
<hr />
<label tuiLabel>
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export class TableComponent {
protected readonly segments = [null, '29 days', '30 days'];
protected readonly segmentSort: WritableSignal<string | null> = signal(null);
protected readonly successSort: WritableSignal<boolean> = signal(false);
protected readonly progressSort: WritableSignal<string[]> = signal([]);

protected readonly count = toSignal(
this.form.valueChanges.pipe(map(() => tuiCountFilledControls(this.form))),
Expand Down Expand Up @@ -319,7 +320,12 @@ export class TableComponent {
this.data()
.filter((val) => val.checkbox.title.includes(this.search()))
.filter((val) => !this.segmentSort() || val.duration === this.segmentSort())
.filter((val) => !this.successSort() || val.status.value === 'Success'),
.filter((val) => !this.successSort() || val.status.value === 'Success')
.filter(
(val) =>
!this.progressSort().length ||
this.progressSort().includes(`${val.progress.toString()}ms`),
),
);

protected length = computed(() =>
Expand Down

0 comments on commit 5ca99be

Please sign in to comment.