Skip to content

Commit 4982559

Browse files
Mattia Vianelliatarix83
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-2194 (pull request DSpace#2853)
Task/dspace cris 2023 02 x/DSC-2194 Approved-by: Giuseppe Digilio
2 parents e94cc1e + 353298b commit 4982559

6 files changed

Lines changed: 28 additions & 3 deletions

File tree

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/relation/cris-layout-relation-box.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
[renderOnServerSide]="false"
55
[searchEnabled]="searchEnabled"
66
[showCharts]="true"
7+
[collapseCharts]="true"
8+
[showChartsToggle]="true"
79
[showScopeSelector]="false"
810
[showSearchResultNotice]="showSearchResultNotice$ | async"
911
[searchResultNotice]="searchResultNotice">

src/app/lucky-search/search/lucky-search.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('LuckySearchComponent', () => {
203203
spyOn((component as any), 'loadBitstreamsAndRedirectIfNeeded').and.returnValue(observableOf([bitstream]));
204204
spyOn((component as any), 'hasBitstreamFilters').and.returnValue(true);
205205
spyOn(component, 'redirect');
206-
routerStub.parseUrl.and.returnValue(bitstreamSearchTree);
206+
routerStub.parseUrl.and.returnValue(bitstreamSearchTree).and.callThrough();
207207

208208
component.resultsRD$.next(data);
209209

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<ds-themed-search [showCharts]="true" [showCsvExport]="false" [showExport]="true" [trackStatistics]="true"></ds-themed-search>
1+
<ds-themed-search [showCharts]="true" [collapseCharts]="true" [showChartsToggle]="true" [showCsvExport]="false" [showExport]="true" [trackStatistics]="true"></ds-themed-search>

src/app/search-page/themed-configuration-search-page.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ export class ThemedConfigurationSearchPageComponent extends ThemedComponent<Conf
5353
@Input()
5454
context: Context;
5555

56+
/**
57+
* Defines whether to start as showing the charts collapsed
58+
*/
59+
@Input() collapseCharts = false;
60+
61+
/**
62+
* Defines whether to show the toggle button to Show/Hide chart
63+
*/
64+
@Input() showChartsToggle = false;
65+
5666
protected inAndOutputNames: (keyof ConfigurationSearchPageComponent & keyof this)[] =
5767
['context', 'configuration', 'fixedFilterQuery', 'inPlaceSearch', 'searchEnabled', 'sideBarWidth'];
5868

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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ export class SearchChartsComponent implements OnInit {
6969
*/
7070
isPlatformBrowser: boolean;
7171

72+
/**
73+
* Prop that provides the boolean value for an existing valid chart (true if at least one valid chart is found)
74+
*/
75+
hasValidCharts = false;
76+
77+
/**
78+
*
79+
* @param cdr
80+
* @param searchService
81+
* @param platformId
82+
* @param searchConfigService
83+
*/
7284
constructor(
7385
private cdr: ChangeDetectorRef,
7486
private searchService: SearchService,
@@ -89,6 +101,7 @@ export class SearchChartsComponent implements OnInit {
89101
this.selectedFilter = this.selectedFilter
90102
? this.selectedFilter
91103
: rd.hasSucceeded && hasValues ? rd.payload[0] : null;
104+
this.hasValidCharts = hasValues;
92105
this.cdr.detectChanges();
93106
})
94107
);

0 commit comments

Comments
 (0)