Skip to content

Commit

Permalink
Merge pull request primefaces#348 from atretyak1985/issue_#NNTR-281
Browse files Browse the repository at this point in the history
Issue dashboard - clicking subregion number to go to Issue list filte…
  • Loading branch information
Gunnsteinn Hall authored Dec 12, 2019
2 parents fa6e59b + 59a780c commit dcb9303
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/common/list/base-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export abstract class BaseList implements OnInit {
}

if (this.updateQueryFilters()) {
this.ptable.first = 0;
this.refresh();
}

Expand Down
3 changes: 2 additions & 1 deletion src/organization/issue/issue_list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ <h1 class="panel-title">Issues
<button class="btn btn-sm btn-primary pull-right" (click)="clickNavigateOnPage('/issue/dashboard')" title="RISC Prioritization">
<i class="fa fa-diamond" aria-hidden="true"></i>
</button>
<span class="label label-black pull-right m-r-15" style="color:white; width: auto;">Total: {{ totalRecords }}</span>
</h1>
</div>
<div class="panel-body">
<div class="no-data" *ngIf="emptyResponse">
<p>There is currently nothing to display.</p>
</div>

<div>
<div *ngIf="!emptyResponse">
<p-table #ptable class="p-table" [columns]="cols" [value]="items" [lazy]="true" (onLazyLoad)="sortingChanged($event)" [paginator]="true"
[rows]="ROWS" [totalRecords]="totalRecords" scrollable="true" [scrollHeight]="window.innerHeight - HEADER_HEIGHT + 'px'" [customSort]="true" sortMode="multiple"
[style]="{width: window.innerWidth - (filterPanel.isCollapsed ? LIST_BASE_PADDING : LIST_BASE_PADDING + FILTER_WIDTH) + 'px'}"
Expand Down
24 changes: 24 additions & 0 deletions src/organization/issue/issue_list.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Injector } from '@angular/core';
import { BaseList } from 'common/list/base-list';
import { IssueService } from './issue.service';
import { isEqual, cloneDeep } from 'lodash';


@Component({
Expand All @@ -14,6 +15,7 @@ import { IssueService } from './issue.service';
export class IssueListComponent extends BaseList {
public exportLimitOptions: any;
public riscSummary: any;
private currentProfileFilter: Array<any>;

constructor(
service: IssueService,
Expand All @@ -24,6 +26,7 @@ export class IssueListComponent extends BaseList {
this.HEADER_HEIGHT = 310;
this.FILTER_WIDTH = 300;
this.LIST_BASE_PADDING = 120;
this.currentProfileFilter = [];
}

ngOnInit() {
Expand Down Expand Up @@ -57,6 +60,15 @@ export class IssueListComponent extends BaseList {
this.service.userFiltersState['issue_risc'] = issueRisc;
isChanged = true;
}
if (!assetRisc && !issueRisc) {
if (this.service.userFiltersState['asset_risc']) {
delete this.service.userFiltersState['asset_risc'];
}
if (this.service.userFiltersState['issue_risc']) {
delete this.service.userFiltersState['issue_risc'];
}
isChanged = true;
}
return isChanged;
}

Expand Down Expand Up @@ -92,4 +104,16 @@ export class IssueListComponent extends BaseList {
super.clearContextFilter();
this.updateQueryFilters();
}

updateProfileFilters(event) {
if (this.ptable) {
this.ptable.first = 0;
}
const isFiltersEqual = isEqual(this.currentProfileFilter, event);
this.currentProfileFilter = cloneDeep(event);
if (!isFiltersEqual) {
this.refresh();
this.service.setProfileFilters(event);
}
}
}

0 comments on commit dcb9303

Please sign in to comment.