various code quality fixes (#5792)

* various code quality fixes

* reduce duplicated code

* add safety check
This commit is contained in:
Denys Vuika
2020-06-18 17:57:46 +01:00
committed by GitHub
parent dc2060fe49
commit e9350bd297
54 changed files with 96 additions and 154 deletions

View File

@@ -120,8 +120,8 @@ export class AnalyticsGeneratorComponent implements OnChanges {
return this.showDetails;
}
isCurrent(position: number) {
return position === this.currentChartPosition ? true : false;
isCurrent(position: number): boolean {
return position === this.currentChartPosition;
}
selectCurrent(position: number) {

View File

@@ -85,10 +85,10 @@ export class AnalyticsReportHeatMapComponent implements OnInit {
});
}
hasMetric() {
return (this.report.totalCountsPercentages ||
this.report.totalTimePercentages ||
this.report.avgTimePercentages) ? true : false;
hasMetric(): boolean {
return !!(this.report.totalCountsPercentages ||
this.report.totalTimePercentages ||
this.report.avgTimePercentages);
}
}

View File

@@ -171,15 +171,15 @@ export class AnalyticsReportListComponent implements OnInit {
this.selectFirst = false;
}
isSelected(report: any) {
return this.currentReport === report ? true : false;
isSelected(report: any): boolean {
return this.currentReport === report;
}
isList() {
isList(): boolean {
return this.layoutType === AnalyticsReportListComponent.LAYOUT_LIST;
}
isGrid() {
isGrid(): boolean {
return this.layoutType === AnalyticsReportListComponent.LAYOUT_GRID;
}
}

View File

@@ -35,8 +35,8 @@ export class WidgetComponent implements OnChanges {
}
}
hasField() {
return this.field ? true : false;
hasField(): boolean {
return !!this.field;
}
hasValue(): boolean {

View File

@@ -101,7 +101,7 @@ export class BarChart extends Chart {
};
};
hasDatasets() {
return this.datasets && this.datasets.length > 0 ? true : false;
hasDatasets(): boolean {
return this.datasets && this.datasets.length > 0;
}
}

View File

@@ -28,7 +28,7 @@ export class DetailsTableChart extends TableChart {
}
}
hasDetailsTable() {
return this.detailsTable ? true : false;
hasDetailsTable(): boolean {
return !!this.detailsTable;
}
}