Skip to content

Commit 9f6eed0

Browse files
Mattia VianelliMattia Vianelli
authored andcommitted
DSC-2194 Updated checks for the chart button
(cherry picked from commit 25f60c596cc7d3370424c71f2a184785001eb931) (cherry picked from commit 7fd87b9)
1 parent aeed634 commit 9f6eed0

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/app/shared/search/search-charts/search-charts.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h2 class="m-0 text-break">{{'search.filters.applied.charts.' + ((configuration
77
</div>
88
<button class="btn btn-outline-secondary" data-test="search-charts-toggle"
99
ngbTooltip="{{'search.sidebar.show.hide.charts.tooltip' | translate}}"
10-
(click)="toggleChart()" *ngIf="showChartsToggle">
10+
(click)="toggleChart()" *ngIf="showChartsToggle && hasValidCharts">
1111
<i class="fa fa-chart-line mr-2"></i> {{"search.filters.applied.charts.show.hide" | translate}}</button>
1212
</div>
1313
<div *ngIf="!collapseChart && selectedFilter" @shrinkInOut data-test="search-charts">

src/app/shared/search/search-charts/search-charts.component.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ export class SearchChartsComponent implements OnInit {
6969
*/
7070
isPlatformBrowser: boolean;
7171

72+
/**
73+
* Array with charts visibility
74+
*/
75+
chartsVisibilityList$: Observable<boolean[]> = of([true]);
76+
77+
/**
78+
*
79+
* @param cdr
80+
* @param searchService
81+
* @param platformId
82+
* @param searchConfigService
83+
*/
84+
85+
/**
86+
* Prop that provides the boolean value for an existing valid chart (true if at least one valid chart is found)
87+
*/
88+
hasValidCharts = false;
89+
7290
constructor(
7391
private cdr: ChangeDetectorRef,
7492
private searchService: SearchService,
@@ -89,6 +107,7 @@ export class SearchChartsComponent implements OnInit {
89107
this.selectedFilter = this.selectedFilter
90108
? this.selectedFilter
91109
: rd.hasSucceeded && hasValues ? rd.payload[0] : null;
110+
this.hasValidCharts = hasValues;
92111
this.cdr.detectChanges();
93112
})
94113
);

0 commit comments

Comments
 (0)