[ACS-6251] remove dead code and imports from insights (#9059)

* remove dead code and imports from insights

* [ci:force] base class to reduce code duplications

* [ci:force] reduce code by introducing base class

* [ci:force] fix import paths

* [ci:force] fix types

* [ci:force] remove pdf from insights unit tests

* [ci:force] improve test performance

* remove obsolete mock file

* remove deleted export
This commit is contained in:
Denys Vuika
2023-11-06 11:30:49 +00:00
committed by GitHub
parent adf5a5e008
commit fe8f4a5e74
99 changed files with 617 additions and 1323 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, Output, ViewEncapsulation } from '@angular/core';
import { Component, EventEmitter, inject, Input, OnChanges, Output, ViewEncapsulation } from '@angular/core';
import { ReportQuery } from '../../diagram/models/report/report-query.model';
import { Chart } from '../../diagram/models/chart/chart.model';
import { AnalyticsService } from '../services/analytics.service';
@@ -27,6 +27,7 @@ import { AnalyticsService } from '../services/analytics.service';
encapsulation: ViewEncapsulation.None
})
export class AnalyticsGeneratorComponent implements OnChanges {
private analyticsService = inject(AnalyticsService);
/** reportId. */
@Input()
@@ -38,7 +39,7 @@ export class AnalyticsGeneratorComponent implements OnChanges {
/** success. */
@Output()
success = new EventEmitter();
success = new EventEmitter<Chart[]>();
/** error. */
@Output()
@@ -52,23 +53,23 @@ export class AnalyticsGeneratorComponent implements OnChanges {
public barChartOptions: any = {
responsive: true,
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: 1
yAxes: [
{
ticks: {
beginAtZero: true,
stepSize: 1
}
}
}],
xAxes: [{
ticks: {
},
stacked: true
}]
],
xAxes: [
{
ticks: {},
stacked: true
}
]
}
};
constructor(private analyticsService: AnalyticsService) {
}
ngOnChanges() {
if (this.reportId && this.reportParamQuery) {
this.generateReport(this.reportId, this.reportParamQuery);
@@ -77,9 +78,9 @@ export class AnalyticsGeneratorComponent implements OnChanges {
}
}
public generateReport(reportId: string, reportParamQuery: any) {
public generateReport(reportId: string, reportParamQuery: ReportQuery) {
if (reportParamQuery === undefined || reportParamQuery === null) {
reportParamQuery = {};
reportParamQuery = new ReportQuery();
}
this.analyticsService.getReportsByParams(reportId, reportParamQuery).subscribe(
(res) => {
@@ -101,7 +102,7 @@ export class AnalyticsGeneratorComponent implements OnChanges {
}
}
public refresh(report): void {
public refresh(report: Chart): void {
/**
* (My guess), for Angular to recognize the change in the dataset
* it has to change the dataset variable directly,