Skip to content

Commit baef90e

Browse files
Mattia VianelliAndrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2024_02_x/DSC-2820 (pull request DSpace#4785)
DSC-2820 fixed the views wording in the downloads tab of the statistics Approved-by: Andrea Barbasso
2 parents dc81735 + d674e90 commit baef90e

6 files changed

Lines changed: 36 additions & 14 deletions

File tree

src/app/statistics-page/cris-statistics-page/statistics-chart/statistics-chart-bar/statistics-chart-bar.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
Inject,
99
PLATFORM_ID,
1010
} from '@angular/core';
11-
import { TranslateModule } from '@ngx-translate/core';
11+
import {
12+
TranslateModule,
13+
TranslateService,
14+
} from '@ngx-translate/core';
1215
import {
1316
Observable,
1417
of,
@@ -61,8 +64,9 @@ export class StatisticsChartBarComponent extends StatisticsChartDataComponent {
6164
@Inject(PLATFORM_ID) protected platformId: any,
6265
@Inject(NativeWindowService) protected _window: NativeWindowRef,
6366
@Inject(DOCUMENT) protected document: any,
67+
protected translateService: TranslateService,
6468
) {
65-
super(report, categoryType, platformId, _window, document);
69+
super(report, categoryType, platformId, _window, document, translateService);
6670
}
6771

6872
/**

src/app/statistics-page/cris-statistics-page/statistics-chart/statistics-chart-data/statistics-chart-data.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
PLATFORM_ID,
1111
ViewChild,
1212
} from '@angular/core';
13+
import { TranslateService } from '@ngx-translate/core';
1314
import {
1415
BehaviorSubject,
1516
Observable,
@@ -76,6 +77,7 @@ export abstract class StatisticsChartDataComponent implements OnInit {
7677
@Inject(PLATFORM_ID) protected platformId: any,
7778
@Inject(NativeWindowService) protected _window: NativeWindowRef,
7879
@Inject(DOCUMENT) protected document: any,
80+
protected translateService: TranslateService,
7981
) {
8082

8183
/* IMPORTANT
@@ -102,7 +104,7 @@ export abstract class StatisticsChartDataComponent implements OnInit {
102104
downloadPng() {
103105
this.isLoading.next(false);
104106
const node = this.chartRef.nativeElement;
105-
this.exportService.exportAsImage(node, ExportImageType.png, this.report.reportType, this.isLoading);
107+
this.exportService.exportAsImage(node, ExportImageType.png, this.getReportName(), this.isLoading);
106108
}
107109

108110
/**
@@ -111,15 +113,15 @@ export abstract class StatisticsChartDataComponent implements OnInit {
111113
downloadJpeg() {
112114
this.isSecondLoading.next(false);
113115
const node = this.chartRef.nativeElement;
114-
this.exportService.exportAsImage(node, ExportImageType.jpeg, this.report.reportType, this.isSecondLoading);
116+
this.exportService.exportAsImage(node, ExportImageType.jpeg, this.getReportName(), this.isSecondLoading);
115117
}
116118

117119
/**
118120
* Export the table information in excel mode.
119121
*/
120122
exportExcel() {
121123
this.isLoading.next(true);
122-
this.exportService.exportAsFile('xlsx', 'dataTable', this.report.reportType, true).subscribe(() => {
124+
this.exportService.exportAsFile('xlsx', 'dataTable', this.getReportName(), true).subscribe(() => {
123125
this.isLoading.next(false);
124126
});
125127
}
@@ -129,11 +131,15 @@ export abstract class StatisticsChartDataComponent implements OnInit {
129131
*/
130132
exportCsv() {
131133
this.isSecondLoading.next(true);
132-
this.exportService.exportAsFile('csv', 'dataTable', this.report.reportType, true).subscribe(() => {
134+
this.exportService.exportAsFile('csv', 'dataTable', this.getReportName(), true).subscribe(() => {
133135
this.isSecondLoading.next(false);
134136
});
135137
}
136138

139+
protected getReportName(): string {
140+
return this.translateService.instant('statistics.table.' + this.categoryType + '.title.' + this.report.reportType);
141+
}
142+
137143
/**
138144
* Parse information as needed by charts can be overriden
139145
*/

src/app/statistics-page/cris-statistics-page/statistics-chart/statistics-chart-line/statistics-chart-line.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('StatisticsChartLineComponent', () => {
103103

104104
const expectedResult = [
105105
{
106-
'name': 'TotalVisitsPerMonth',
106+
'name': 'statistics.table.mainReports.title.TotalVisitsPerMonth',
107107
'series': [
108108
{
109109
'name': 'September 2020',

src/app/statistics-page/cris-statistics-page/statistics-chart/statistics-chart-line/statistics-chart-line.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
Inject,
99
PLATFORM_ID,
1010
} from '@angular/core';
11-
import { TranslateModule } from '@ngx-translate/core';
11+
import {
12+
TranslateModule,
13+
TranslateService,
14+
} from '@ngx-translate/core';
1215
import {
1316
Observable,
1417
of,
@@ -60,8 +63,9 @@ export class StatisticsChartLineComponent extends StatisticsChartDataComponent {
6063
@Inject(PLATFORM_ID) protected platformId: any,
6164
@Inject(NativeWindowService) protected _window: NativeWindowRef,
6265
@Inject(DOCUMENT) protected document: any,
66+
protected translateService: TranslateService,
6367
) {
64-
super(report, categoryType, platformId, _window, document);
68+
super(report, categoryType, platformId, _window, document, translateService);
6569
}
6670

6771
/**
@@ -87,7 +91,7 @@ export class StatisticsChartLineComponent extends StatisticsChartDataComponent {
8791
return of(
8892
[
8993
{
90-
name: this.report.reportType,
94+
name: this.getReportName(),
9195
series: series,
9296
},
9397
],

src/app/statistics-page/cris-statistics-page/statistics-chart/statistics-chart-pie/statistics-chart-pie.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
Inject,
99
PLATFORM_ID,
1010
} from '@angular/core';
11-
import { TranslateModule } from '@ngx-translate/core';
11+
import {
12+
TranslateModule,
13+
TranslateService,
14+
} from '@ngx-translate/core';
1215
import {
1316
Observable,
1417
of,
@@ -61,8 +64,9 @@ export class StatisticsChartPieComponent extends StatisticsChartDataComponent {
6164
@Inject(PLATFORM_ID) protected platformId: any,
6265
@Inject(NativeWindowService) protected _window: NativeWindowRef,
6366
@Inject(DOCUMENT) protected document: any,
67+
protected translateService: TranslateService,
6468
) {
65-
super(report, categoryType, platformId, _window, document);
69+
super(report, categoryType, platformId, _window, document, translateService);
6670
}
6771

6872
/**

src/app/statistics-page/cris-statistics-page/statistics-chart/statistics-table/statistics-table.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
OnInit,
1313
PLATFORM_ID,
1414
} from '@angular/core';
15-
import { TranslateModule } from '@ngx-translate/core';
15+
import {
16+
TranslateModule,
17+
TranslateService,
18+
} from '@ngx-translate/core';
1619

1720
import {
1821
NativeWindowRef,
@@ -75,8 +78,9 @@ export class StatisticsTableComponent extends StatisticsChartDataComponent imple
7578
@Inject(PLATFORM_ID) protected platformId: any,
7679
@Inject(NativeWindowService) protected _window: NativeWindowRef,
7780
@Inject(DOCUMENT) protected document: any,
81+
protected translateService: TranslateService,
7882
) {
79-
super(report, categoryType, platformId, _window, document);
83+
super(report, categoryType, platformId, _window, document, translateService);
8084
}
8185

8286
/**

0 commit comments

Comments
 (0)