mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Migrate to @angular-eslint/prefer-inject and @typescript-eslint/prefer-readonly (#11665)
This commit is contained in:
@@ -45,7 +45,7 @@ import { AnalyticsReportHeatMapComponent } from './analytics-report-heat-map.com
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class AnalyticsGeneratorComponent implements OnChanges {
|
||||
private analyticsService = inject(AnalyticsService);
|
||||
private readonly analyticsService = inject(AnalyticsService);
|
||||
|
||||
/** reportId. */
|
||||
@Input()
|
||||
|
||||
+4
-3
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core';
|
||||
import { ReactiveFormsModule, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { AnalyticsService } from '../services/analytics.service';
|
||||
import { ParameterValueModel } from '../../diagram/models/report/parameter-value.model';
|
||||
@@ -29,6 +29,9 @@ import { DiagramComponent } from '../../diagram/components/diagram.component';
|
||||
templateUrl: './analytics-report-heat-map.component.html'
|
||||
})
|
||||
export class AnalyticsReportHeatMapComponent implements OnInit {
|
||||
private readonly analyticsService = inject(AnalyticsService);
|
||||
private readonly formBuilder = inject(UntypedFormBuilder);
|
||||
|
||||
/** reportId. */
|
||||
@Input()
|
||||
report: any;
|
||||
@@ -48,8 +51,6 @@ export class AnalyticsReportHeatMapComponent implements OnInit {
|
||||
currentMetricColors: any;
|
||||
metricType: string;
|
||||
|
||||
constructor(private analyticsService: AnalyticsService, private formBuilder: UntypedFormBuilder) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.initForm();
|
||||
this.field.id = 'metrics';
|
||||
|
||||
+4
-2
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, inject } from '@angular/core';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { ReportParametersModel } from '../../diagram/models/report/report-parameters.model';
|
||||
import { AnalyticsService } from '../services/analytics.service';
|
||||
@@ -36,6 +36,8 @@ export const LAYOUT_GRID = 'GRID';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class AnalyticsReportListComponent implements OnInit {
|
||||
private readonly analyticsService = inject(AnalyticsService);
|
||||
|
||||
/** layout Type LIST or GRID. */
|
||||
@Input()
|
||||
layoutType: string = LAYOUT_LIST;
|
||||
@@ -66,7 +68,7 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
|
||||
private reportObserver: Observer<any>;
|
||||
|
||||
constructor(private analyticsService: AnalyticsService) {
|
||||
constructor() {
|
||||
this.report$ = new Observable<ReportParametersModel>((observer) => (this.reportObserver = observer)).pipe(share());
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -133,6 +133,12 @@ export interface ReportFormValues {
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class AnalyticsReportParametersComponent implements OnInit, OnChanges, AfterContentChecked {
|
||||
private readonly analyticsService = inject(AnalyticsService);
|
||||
private readonly formBuilder = inject(FormBuilder);
|
||||
private readonly downloadService = inject(DownloadService);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly dateAdapter = inject(AdfDateFnsAdapter);
|
||||
|
||||
/** appId ID of the target app. */
|
||||
@Input()
|
||||
appId: number;
|
||||
@@ -188,14 +194,6 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, Af
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
private analyticsService: AnalyticsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private downloadService: DownloadService,
|
||||
private dialog: MatDialog,
|
||||
private dateAdapter: AdfDateFnsAdapter
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.onDropdownChanged.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((field: any) => {
|
||||
const paramDependOn = this.reportParameters.definition.parameters.find((param) => param.dependsOn === field.id);
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
/* eslint-disable @angular-eslint/no-input-rename */
|
||||
|
||||
import { ADF_DATE_FORMATS, AdfDateFnsAdapter } from '@alfresco/adf-core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, inject } from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
||||
import { ReportParameterDetailsModel } from '../../../../diagram/models/report/report-parameter-details.model';
|
||||
@@ -50,6 +50,8 @@ interface DateRangeProps {
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class DateRangeWidgetComponent implements OnInit {
|
||||
private readonly dateAdapter = inject<DateAdapter<Date>>(DateAdapter);
|
||||
|
||||
@Input('group')
|
||||
dateRange: FormGroup<DateRangeProps>;
|
||||
|
||||
@@ -64,8 +66,6 @@ export class DateRangeWidgetComponent implements OnInit {
|
||||
startDateValue = new Date();
|
||||
endDateValue = new Date();
|
||||
|
||||
constructor(private dateAdapter: DateAdapter<Date>) {}
|
||||
|
||||
ngOnInit() {
|
||||
const dateAdapter = this.dateAdapter as AdfDateFnsAdapter;
|
||||
dateAdapter.displayFormat = DISPLAY_FORMAT;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, of } from 'rxjs';
|
||||
import { ParameterValueModel } from '../../diagram/models/report/parameter-value.model';
|
||||
import { ReportParametersModel } from '../../diagram/models/report/report-parameters.model';
|
||||
@@ -34,6 +34,8 @@ import { LineChart } from '../../diagram/models/chart/line-chart.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AnalyticsService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _reportApi: ReportApi;
|
||||
get reportApi(): ReportApi {
|
||||
this._reportApi = this._reportApi ?? new ReportApi(this.apiService.getInstance());
|
||||
@@ -46,8 +48,6 @@ export class AnalyticsService {
|
||||
return this._processDefinitionsApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService) {}
|
||||
|
||||
/**
|
||||
* Retrieve all the Deployed app
|
||||
* @param appId application id
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, inject } from '@angular/core';
|
||||
import { DiagramElementModel } from '../models/diagram/diagram-element.model';
|
||||
import { DiagramModel } from '../models/diagram/diagram.model';
|
||||
import { DiagramColorService } from '../services/diagram-color.service';
|
||||
@@ -73,6 +73,10 @@ const PADDING_HEIGHT: number = 60;
|
||||
templateUrl: './diagram.component.html'
|
||||
})
|
||||
export class DiagramComponent implements OnChanges {
|
||||
private readonly diagramColorService = inject(DiagramColorService);
|
||||
private readonly raphaelService = inject(RaphaelService);
|
||||
private readonly diagramsService = inject(DiagramsService);
|
||||
|
||||
/** processDefinitionId. */
|
||||
@Input()
|
||||
processDefinitionId: any;
|
||||
@@ -111,8 +115,6 @@ export class DiagramComponent implements OnChanges {
|
||||
|
||||
diagram: DiagramModel;
|
||||
|
||||
constructor(private diagramColorService: DiagramColorService, private raphaelService: RaphaelService, private diagramsService: DiagramsService) {}
|
||||
|
||||
ngOnChanges() {
|
||||
this.reset();
|
||||
this.diagramColorService.setTotalColors(this.metricColor);
|
||||
|
||||
@@ -20,8 +20,8 @@ import { RaphaelService } from './raphael.service';
|
||||
|
||||
@Directive()
|
||||
export class RaphaelBase {
|
||||
private raphaelService = inject(RaphaelService);
|
||||
private element = inject(ElementRef);
|
||||
private readonly raphaelService = inject(RaphaelService);
|
||||
private readonly element = inject(ElementRef);
|
||||
|
||||
paper: any;
|
||||
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { ModelJsonBpmnApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DiagramsService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _modelJsonBpmnApi: ModelJsonBpmnApi;
|
||||
get modelJsonBpmnApi(): ModelJsonBpmnApi {
|
||||
this._modelJsonBpmnApi = this._modelJsonBpmnApi ?? new ModelJsonBpmnApi(this.apiService.getInstance());
|
||||
return this._modelJsonBpmnApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService) {}
|
||||
|
||||
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
||||
return from(this.modelJsonBpmnApi.getModelJSON(processDefinitionId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user