Skip to content

Commit

Permalink
Fix dashboard component filter input box showing in empty workflow steps
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro-bulgaris-qcif committed Jun 24, 2024
1 parent 7f01055 commit 290704b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2>{{ 'dashboard-heading' | i18next: {stage: workflowStep.config.workflow.stage
<div *ngIf="workflowSteps.length == 1 && !hideWorkflowStepTitle && (dashboardTypeSelected == 'standard' || dashboardTypeSelected == 'consolidated')" class="col-md-4">
<h2>{{ 'dashboard-heading-one-step' | i18next: {recordTypeName: typeLabel} }}</h2>
</div>
<ng-container *ngIf="dashboardTypeSelected == 'standard' && (records[workflowStep.config.workflow.stage].totalItems > 0 || (records[workflowStep.config.workflow.stage].totalItems <= 0 && isFilterSearchDisplayed))">
<ng-container *ngIf="dashboardTypeSelected == 'standard' && (records[workflowStep.config.workflow.stage].totalItems > 0 || (records[workflowStep.config.workflow.stage].totalItems <= 0 && getFilterSearchDisplayed(workflowStep.config.workflow.stage)))">
<div class="col-md-8">
<div class="d-flex flex-row mt-4">
<button class="btn btn-primary dropdown-toggle" type='button' data-bs-toggle="dropdown" aria-expanded="false" >Filter by {{ filterFieldName }}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class DashboardComponent extends BaseComponent {
defaultFilterField: FilterField = { name: this.filterFieldName, path: this.filterFieldPath };
filterSearchString: string = '';
hideWorkflowStepTitle: boolean = false;
isFilterSearchDisplayed: boolean = false;
isFilterSearchDisplayed: any = {};
isSearching: boolean = false;

defaultRowConfig = [
Expand Down Expand Up @@ -803,11 +803,20 @@ export class DashboardComponent extends BaseComponent {
return this.getFilters('text');
}

public getFilterSearchDisplayed(step: string): boolean {
let filterDisplayed = _.get(this.isFilterSearchDisplayed,step,'');
if(filterDisplayed == 'filterDisplayed') {
return true;
} else {
return false;
}
}

public async filterChanged(step: string) {

if (this.dashboardTypeSelected == 'standard') {
this.isSearching = true;
this.isFilterSearchDisplayed = true;
this.isFilterSearchDisplayed[step] = 'filterDisplayed';
let sortDetails = this.sortMap[step];
let stagedRecords = await this.recordService.getRecords(this.recordType, step, 1, '', this.getSortString(sortDetails),this.filterFieldPath,this.filterSearchString);
let planTable: PlanTable = this.evaluatePlanTableColumns({}, {}, {}, step, stagedRecords);
Expand Down

0 comments on commit 290704b

Please sign in to comment.