Skip to content

Commit 2c92056

Browse files
authored
Merge pull request #651 from bcgov/oleks
BugFixes
2 parents a428851 + a44898b commit 2c92056

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<h2 class="title">Aggregated Listings</h2>
33
<div class="search-container">
44
<span class="vertical-spacer" *ngIf="isFilterSet"></span>
5-
<p-dropdown [options]="searchColumns" id="search-by-drd" [(ngModel)]="searchColumn"
6-
class="search-by-select"></p-dropdown>
5+
<p-dropdown [options]="searchColumns" [showClear]="searchColumn !== 'all'" (onClear)="clearSearchBy($event)"
6+
id="search-by-drd" [(ngModel)]="searchColumn" class="search-by-select"></p-dropdown>
77
<span class="p-input-icon-right search-input-container">
88
<button pButton class="search-submit-btn" id="search-submit-btn" (click)="onSearch()"> <i
99
class="pi pi-search"></i></button>

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,12 @@ export class AggregatedListingsTableComponent implements OnInit {
227227
}
228228

229229
onSearch(): void {
230-
this.getListings(this.currentPage.pageNumber);
230+
this.paginator.changePage(0);
231+
}
232+
233+
clearSearchBy(_event: any): void {
234+
this.searchColumn = 'all';
235+
this.cd.detectChanges();
231236
}
232237

233238
get isFilterSet(): boolean {

frontend/src/app/features/components/listings-table/listings-table.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<h2 class="title">Listings</h2>
33
<div class="search-container">
44
<span class="vertical-spacer" *ngIf="isFilterSet"></span>
5-
<p-dropdown [options]="searchColumns" id="search-by-drd" [(ngModel)]="searchColumn"
6-
class="search-by-select"></p-dropdown>
5+
<p-dropdown [options]="searchColumns" [showClear]="searchColumn !== 'all'" (onClear)="clearSearchBy($event)"
6+
id="search-by-drd" [(ngModel)]="searchColumn" class="search-by-select"></p-dropdown>
77
<span class="p-input-icon-right search-input-container">
88
<button pButton class="search-submit-btn" id="search-submit-btn" (click)="onSearch()"> <i
99
class="pi pi-search"></i></button>
@@ -213,7 +213,7 @@ <h2 class="title">Listings</h2>
213213
{{ row.lastActionNm || '-'}}
214214
</td>
215215
<td>
216-
{{ row.lastActionDtm || '-' |date }}
216+
{{ row.lastActionDtm? '-': row.lastActionDtm |date }}
217217
</td>
218218
</tr>
219219
</ng-template>

frontend/src/app/features/components/listings-table/listings-table.component.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ListingDataService } from '../../../common/services/listing-data.servic
33
import { PagingResponse, PagingResponsePageInfo } from '../../../common/models/paging-response';
44
import { ListingTableRow } from '../../../common/models/listing-table-row';
55
import { CommonModule } from '@angular/common';
6-
import { Table, TableModule } from 'primeng/table';
6+
import { TableModule } from 'primeng/table';
77
import { ButtonModule } from 'primeng/button';
88
import { DropdownModule } from 'primeng/dropdown';
99
import { CheckboxModule } from 'primeng/checkbox';
@@ -87,10 +87,6 @@ export class ListingsTableComponent implements OnInit {
8787
) { }
8888

8989
ngOnInit(): void {
90-
setInterval(() => {
91-
this.cd.detectChanges();
92-
}, 250);
93-
9490
this.getOrganizations();
9591
this.initFilters();
9692
let page = 1;
@@ -158,6 +154,11 @@ export class ListingsTableComponent implements OnInit {
158154
this.paginator.changePage(0);
159155
}
160156

157+
clearSearchBy(_event: any): void {
158+
this.searchColumn = 'all';
159+
this.cd.detectChanges();
160+
}
161+
161162
unselectAll(): void {
162163
this.selectedListings = [];
163164
}
@@ -188,7 +189,7 @@ export class ListingsTableComponent implements OnInit {
188189
}
189190

190191
onSearch(): void {
191-
this.getListings(this.currentPage.pageNumber);
192+
this.paginator.changePage(0);
192193
}
193194

194195
get isFilterSet(): boolean {

0 commit comments

Comments
 (0)