Migrate to @angular-eslint/prefer-inject and @typescript-eslint/prefer-readonly (#11665)

This commit is contained in:
Denys Vuika
2026-02-18 15:38:01 +00:00
committed by GitHub
parent f8fa996b04
commit 3f542d99ba
470 changed files with 2638 additions and 2247 deletions
@@ -17,7 +17,7 @@
import { CustomEmptyContentTemplateDirective, EmptyContentComponent } from '@alfresco/adf-core';
import { AppsProcessService } from '../services/apps-process.service';
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, OnInit, Output, ViewEncapsulation, inject } from '@angular/core';
import { IconModel } from './icon.model';
import { finalize, map } from 'rxjs/operators';
import { AppDefinitionRepresentation } from '@alfresco/js-api';
@@ -54,6 +54,8 @@ export const APP_LIST_LAYOUT_GRID: string = 'GRID';
host: { class: 'adf-apps' }
})
export class AppsListComponent implements OnInit, AfterContentInit {
private readonly appsProcessService = inject(AppsProcessService);
@ContentChild(CustomEmptyContentTemplateDirective)
emptyCustomContent: CustomEmptyContentTemplateDirective;
@@ -86,7 +88,6 @@ export class AppsListComponent implements OnInit, AfterContentInit {
hasEmptyCustomContentTemplate: boolean = false;
private iconsMDL: IconModel;
constructor(private appsProcessService: AppsProcessService) {}
ngOnInit() {
if (!this.isValidType()) {
@@ -20,9 +20,9 @@ const DEFAULT_TASKS_APP_MATERIAL_ICON: string = 'favorite_border';
/* spellchecker: disable */
export class IconModel {
private iconsMDL: Map<string, string>;
private supportedIconTypes = ['glyphicon', 'fa' /*Font awesome*/];
private readonly supportedIconTypes = ['glyphicon', 'fa' /*Font awesome*/];
private sharedIconsMap = [
private readonly sharedIconsMap = [
['asterisk', 'ac_unit'],
['plus', 'add'],
['euro', 'euro_symbol'],
@@ -164,7 +164,7 @@ export class IconModel {
initIconsMDL() {
this.iconsMDL = new Map<string, string>();
this.supportedIconTypes.forEach(iconType => {
this.supportedIconTypes.forEach((iconType) => {
this.sharedIconsMap.forEach(([iconKey, iconValue]) => {
this.iconsMDL.set(`${iconType}-${iconKey}`, iconValue);
});
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component } from '@angular/core';
import { Component, inject as inject_1 } from '@angular/core';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { OverlayContainer } from '@angular/cdk/overlay';
@@ -29,11 +29,11 @@ import { SelectAppsDialogComponent } from './select-apps-dialog.component';
template: ''
})
export class DialogSelectAppTestComponent {
private readonly dialog = inject_1(MatDialog);
processId: any;
dialogRef: any;
constructor(private dialog: MatDialog) {}
startProcessAction() {
this.dialogRef = this.dialog.open(SelectAppsDialogComponent, {
width: '630px'
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { Component, ViewEncapsulation, inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { AppsProcessService } from '../../services/apps-process.service';
import { CommonModule } from '@angular/common';
@@ -31,15 +31,15 @@ import { MatButtonModule } from '@angular/material/button';
encapsulation: ViewEncapsulation.None
})
export class SelectAppsDialogComponent {
private readonly appsProcessService = inject(AppsProcessService);
dialogRef = inject<MatDialogRef<SelectAppsDialogComponent>>(MatDialogRef);
data = inject(MAT_DIALOG_DATA);
processApps: any;
selectedProcess: any;
constructor(
private appsProcessService: AppsProcessService,
public dialogRef: MatDialogRef<SelectAppsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
constructor() {
this.appsProcessService.getDeployedApplications().subscribe((apps) => {
this.processApps = apps.filter((currentApp) => currentApp.id);
});
@@ -30,7 +30,7 @@ import { MatIconModule } from '@angular/material/icon';
templateUrl: './create-process-attachment.component.html'
})
export class CreateProcessAttachmentComponent implements OnChanges {
private processContentService = inject(ProcessContentService);
private readonly processContentService = inject(ProcessContentService);
/** (required) The ID of the process instance to display. */
@Input({ required: true })
@@ -30,7 +30,7 @@ import { MatIconModule } from '@angular/material/icon';
templateUrl: './create-task-attachment.component.html'
})
export class AttachmentComponent implements OnChanges {
private processContentService = inject(ProcessContentService);
private readonly processContentService = inject(ProcessContentService);
/** (required) The numeric ID of the task to display. */
@Input({ required: true })
@@ -35,7 +35,8 @@ import {
OnChanges,
Output,
SimpleChanges,
ViewEncapsulation
ViewEncapsulation,
inject
} from '@angular/core';
import { ProcessContentService } from '../../form/services/process-content.service';
import { CommonModule } from '@angular/common';
@@ -60,6 +61,11 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
encapsulation: ViewEncapsulation.None
})
export class ProcessAttachmentListComponent implements OnChanges, AfterContentInit {
private readonly processContentService = inject(ProcessContentService);
private readonly downloadService = inject(DownloadService);
private readonly thumbnailService = inject(ThumbnailService);
private readonly ngZone = inject(NgZone);
@ContentChild(EmptyListComponent)
emptyTemplate: EmptyListComponent;
@@ -99,13 +105,6 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
attachments: any[] = [];
isLoading: boolean = false;
constructor(
private processContentService: ProcessContentService,
private downloadService: DownloadService,
private thumbnailService: ThumbnailService,
private ngZone: NgZone
) {}
ngOnChanges(changes: SimpleChanges) {
if (changes['processInstanceId']?.currentValue) {
this.loadAttachmentsByProcessInstanceId(changes['processInstanceId'].currentValue);
@@ -36,7 +36,8 @@ import {
OnChanges,
Output,
SimpleChanges,
ViewEncapsulation
ViewEncapsulation,
inject
} from '@angular/core';
import { ProcessContentService } from '../../form/services/process-content.service';
import { CommonModule } from '@angular/common';
@@ -62,6 +63,11 @@ import { TranslatePipe } from '@ngx-translate/core';
encapsulation: ViewEncapsulation.None
})
export class TaskAttachmentListComponent implements OnChanges, AfterContentInit {
private readonly activitiContentService = inject(ProcessContentService);
private readonly downloadService = inject(DownloadService);
private readonly thumbnailService = inject(ThumbnailService);
private readonly ngZone = inject(NgZone);
@ContentChild(EmptyListComponent)
emptyTemplate: EmptyListComponent;
@@ -97,13 +103,6 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
attachments: any[] = [];
isLoading: boolean = false;
constructor(
private activitiContentService: ProcessContentService,
private downloadService: DownloadService,
private thumbnailService: ThumbnailService,
private ngZone: NgZone
) {}
ngOnChanges(changes: SimpleChanges) {
if (changes['taskId']?.currentValue) {
this.loadAttachmentsByTaskId(changes['taskId'].currentValue);
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';
import { Component, Input, OnChanges, ViewEncapsulation, inject } from '@angular/core';
import { ModelService } from '../services/model.service';
import { CommonModule } from '@angular/common';
import { DataColumnComponent, DataColumnListComponent, DataTableComponent } from '@alfresco/adf-core';
@@ -27,12 +27,12 @@ import { DataColumnComponent, DataColumnListComponent, DataTableComponent } from
encapsulation: ViewEncapsulation.None
})
export class FormListComponent implements OnChanges {
protected modelService = inject(ModelService);
/** The array that contains the information to show inside the list. */
@Input()
forms: any[] = [];
constructor(protected modelService: ModelService) {}
ngOnChanges() {
this.getForms();
}
@@ -76,7 +76,7 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnChange
protected visibilityService = inject(WidgetVisibilityService);
protected ecmModelService = inject(EcmModelService);
protected nodeService = inject(NodesApiService);
private cdRef = inject(ChangeDetectorRef);
private readonly cdRef = inject(ChangeDetectorRef);
/** Task id to fetch corresponding form and values. */
@Input()
@@ -17,7 +17,7 @@
import { AlfrescoApiService, SitesService } from '@alfresco/adf-content-services';
import { ExternalContent } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import {
IntegrationAlfrescoOnPremiseApi,
Node,
@@ -33,6 +33,9 @@ import { map, catchError } from 'rxjs/operators';
providedIn: 'root'
})
export class ActivitiContentService {
private readonly apiService = inject(AlfrescoApiService);
private readonly sitesService = inject(SitesService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -49,8 +52,6 @@ export class ActivitiContentService {
return this._contentApi;
}
constructor(private apiService: AlfrescoApiService, private sitesService: SitesService) {}
/**
* Returns a list of child nodes below the specified folder
*
@@ -128,8 +129,8 @@ export class ActivitiContentService {
errMsg = error.message
? error.message
: error.status
? `${error.status} - ${error.statusText}`
: ActivitiContentService.GENERIC_ERROR_MESSAGE;
? `${error.status} - ${error.statusText}`
: ActivitiContentService.GENERIC_ERROR_MESSAGE;
}
return throwError(errMsg);
}
@@ -17,7 +17,7 @@
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { FormModel } from '@alfresco/adf-core';
import { EventEmitter, Injectable } from '@angular/core';
import { EventEmitter, Injectable, inject } from '@angular/core';
import { Observable, from } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { CustomModelApi } from '@alfresco/js-api';
@@ -26,6 +26,8 @@ import { CustomModelApi } from '@alfresco/js-api';
providedIn: 'root'
})
export class EcmModelService {
private readonly apiService = inject(AlfrescoApiService);
public static MODEL_NAMESPACE: string = 'activitiForms';
public static MODEL_NAME: string = 'activitiFormsModel';
public static TYPE_MODEL: string = 'cm:folder';
@@ -38,8 +40,6 @@ export class EcmModelService {
return this._customModelApi;
}
constructor(private apiService: AlfrescoApiService) {}
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
return new Observable((observer) => {
this.searchActivitiEcmModel().subscribe(
@@ -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, throwError } from 'rxjs';
import { FormModelsApi, FormRepresentation } from '@alfresco/js-api';
import { catchError, map } from 'rxjs/operators';
@@ -26,6 +26,8 @@ import { FormDefinitionModel } from '../model/form-definition.model';
providedIn: 'root'
})
export class EditorService {
private readonly apiService = inject(AlfrescoApiService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -35,8 +37,6 @@ export class EditorService {
return this._editorApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Saves a form.
*
@@ -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, throwError } from 'rxjs';
import { ModelsApi } from '@alfresco/js-api';
import { catchError, map } from 'rxjs/operators';
@@ -25,6 +25,8 @@ import { catchError, map } from 'rxjs/operators';
providedIn: 'root'
})
export class ModelService {
private readonly apiService = inject(AlfrescoApiService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -34,8 +36,6 @@ export class ModelService {
return this._modelsApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Create a Form.
*
@@ -16,7 +16,7 @@
*/
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import {
ActivitiContentApi,
RelatedContentRepresentation,
@@ -30,6 +30,8 @@ import { catchError } from 'rxjs/operators';
providedIn: 'root'
})
export class ProcessContentService {
private readonly apiService = inject(AlfrescoApiService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -39,8 +41,6 @@ export class ProcessContentService {
return this._contentApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Create temporary related content from an uploaded file.
*
@@ -17,7 +17,7 @@
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { FormFieldOption } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { ProcessDefinitionsApi } from '@alfresco/js-api';
import { catchError } from 'rxjs/operators';
@@ -27,6 +27,8 @@ import { DynamicTableColumnOption } from '../widgets/dynamic-table/editors/model
providedIn: 'root'
})
export class ProcessDefinitionService {
private readonly apiService = inject(AlfrescoApiService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -36,8 +38,6 @@ export class ProcessDefinitionService {
return this._processDefinitionsApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Gets values of fields populated by a REST backend using a process ID.
*
@@ -88,8 +88,8 @@ export class ProcessDefinitionService {
errMsg = error.message
? error.message
: error.status
? `${error.status} - ${error.statusText}`
: ProcessDefinitionService.GENERIC_ERROR_MESSAGE;
? `${error.status} - ${error.statusText}`
: ProcessDefinitionService.GENERIC_ERROR_MESSAGE;
}
return throwError(errMsg);
}
@@ -17,7 +17,7 @@
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { FormFieldOption, FormValues, TaskProcessVariableModel } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { from, Observable, throwError } from 'rxjs';
import { CompleteFormRepresentation, SaveFormRepresentation, TaskFormsApi } from '@alfresco/js-api';
import { catchError, map } from 'rxjs/operators';
@@ -27,6 +27,8 @@ import { DynamicTableColumnOption } from '../widgets/dynamic-table/editors/model
providedIn: 'root'
})
export class TaskFormService {
private readonly apiService = inject(AlfrescoApiService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -36,8 +38,6 @@ export class TaskFormService {
return this._taskFormsApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Saves a task form.
*
@@ -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, throwError } from 'rxjs';
import { TaskRepresentation, TasksApi } from '@alfresco/js-api';
import { catchError, map } from 'rxjs/operators';
@@ -25,6 +25,8 @@ import { catchError, map } from 'rxjs/operators';
providedIn: 'root'
})
export class TaskService {
private readonly apiService = inject(AlfrescoApiService);
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
@@ -34,8 +36,6 @@ export class TaskService {
return this._taskApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Gets a task.
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, DestroyRef, inject, Inject, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { AuthenticationService, LoginDialogPanelComponent, TranslationService } from '@alfresco/adf-core';
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
@@ -48,6 +48,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
]
})
export class AttachFileWidgetDialogComponent implements OnInit {
private readonly translation = inject(TranslationService);
data = inject<AttachFileWidgetDialogComponentData>(MAT_DIALOG_DATA);
private readonly externalApiService = inject(AlfrescoApiService);
private readonly authenticationService = inject(AuthenticationService);
private readonly matDialogRef = inject<MatDialogRef<AttachFileWidgetDialogComponent>>(MatDialogRef);
@ViewChild('adfLoginPanel')
loginPanel: LoginDialogPanelComponent;
@@ -58,13 +64,10 @@ export class AttachFileWidgetDialogComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
constructor(
private translation: TranslationService,
@Inject(MAT_DIALOG_DATA) public data: AttachFileWidgetDialogComponentData,
private externalApiService: AlfrescoApiService,
private authenticationService: AuthenticationService,
private matDialogRef: MatDialogRef<AttachFileWidgetDialogComponent>
) {
constructor() {
const data = this.data;
const externalApiService = this.externalApiService;
(externalApiService as ExternalAlfrescoApiService).init(data.ecmHost, data.context);
this.action = data.actionName ? data.actionName.toUpperCase() : 'CHOOSE';
this.buttonActionName = `ATTACH-FILE.ACTIONS.${this.action}`;
@@ -17,7 +17,7 @@
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { MatDialog } from '@angular/material/dialog';
import { EventEmitter, Injectable, Output } from '@angular/core';
import { EventEmitter, Injectable, Output, inject } from '@angular/core';
import { TranslationService } from '@alfresco/adf-core';
import { Observable, of, Subject } from 'rxjs';
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
@@ -30,14 +30,15 @@ import { switchMap } from 'rxjs/operators';
})
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class AttachFileWidgetDialogService {
private readonly dialog = inject(MatDialog);
private readonly translation = inject(TranslationService);
/** Emitted when an error occurs. */
@Output()
error = new EventEmitter<any>();
private externalApis: { [key: string]: AlfrescoApiService } = {};
constructor(private dialog: MatDialog, private translation: TranslationService) {}
/**
* Opens a dialog to choose a file to upload.
*
@@ -43,6 +43,15 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
encapsulation: ViewEncapsulation.None
})
export class AttachFileWidgetComponent extends UploadWidgetComponent implements OnInit {
private readonly activitiContentService = inject(ActivitiContentService);
private readonly contentService = inject(ContentService);
private readonly contentDialog = inject(ContentNodeDialogService);
private readonly appConfigService = inject(AppConfigService);
private readonly downloadService = inject(DownloadService);
private readonly router = inject(Router);
private readonly activatedRoute = inject(ActivatedRoute);
private readonly attachDialogService = inject(AttachFileWidgetDialogService);
typeId = 'AttachFileWidgetComponent';
repositoryList: AlfrescoEndpointRepresentation[] = [];
isStartProcessPage = false;
@@ -51,19 +60,6 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
private readonly destroyRef = inject(DestroyRef);
constructor(
private activitiContentService: ActivitiContentService,
private contentService: ContentService,
private contentDialog: ContentNodeDialogService,
private appConfigService: AppConfigService,
private downloadService: DownloadService,
private router: Router,
private activatedRoute: ActivatedRoute,
private attachDialogService: AttachFileWidgetDialogService
) {
super();
}
ngOnInit() {
super.ngOnInit();
this.isStartProcessPage = this.router.url.split('?')[0].includes('start-process');
@@ -17,7 +17,7 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { Component, ViewEncapsulation, OnInit, inject } from '@angular/core';
import { WidgetComponent, FormService, ErrorWidgetComponent } from '@alfresco/adf-core';
import { ContentNodeDialogService, NodesApiService } from '@alfresco/adf-content-services';
import { Node } from '@alfresco/js-api';
@@ -46,14 +46,14 @@ import { MatButtonModule } from '@angular/material/button';
encapsulation: ViewEncapsulation.None
})
export class AttachFolderWidgetComponent extends WidgetComponent implements OnInit {
private readonly contentDialog = inject(ContentNodeDialogService);
formService = inject(FormService);
private readonly nodeService = inject(NodesApiService);
typeId = 'AttachFolderWidgetComponent';
hasFolder: boolean = false;
selectedFolderName: string = '';
constructor(private contentDialog: ContentNodeDialogService, public formService: FormService, private nodeService: NodesApiService) {
super();
}
ngOnInit() {
if (this.field?.value) {
this.hasFolder = true;
@@ -16,7 +16,7 @@
*/
import { UrlService, ContentLinkModel, FormService, DownloadService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation, inject } from '@angular/core';
import { Observable } from 'rxjs';
import { ProcessContentService } from '../../services/process-content.service';
import { CommonModule } from '@angular/common';
@@ -33,6 +33,11 @@ import { MatButtonModule } from '@angular/material/button';
encapsulation: ViewEncapsulation.None
})
export class ContentWidgetComponent implements OnChanges {
protected formService = inject(FormService);
private readonly downloadService = inject(DownloadService);
private readonly urlService = inject(UrlService);
private readonly processContentService = inject(ProcessContentService);
/** The content id to show. */
@Input()
id: string;
@@ -59,13 +64,6 @@ export class ContentWidgetComponent implements OnChanges {
content: ContentLinkModel;
constructor(
protected formService: FormService,
private downloadService: DownloadService,
private urlService: UrlService,
private processContentService: ProcessContentService
) {}
ngOnChanges(changes: SimpleChanges) {
const contentId = changes['id'];
if (contentId?.currentValue) {
@@ -53,11 +53,11 @@ export class DynamicTableWidgetComponent extends WidgetComponent implements OnIn
editMode: boolean = false;
editRow: DynamicTableRow = null;
private selectArrayCode = [32, 0, 13];
private readonly selectArrayCode = [32, 0, 13];
public elementRef = inject(ElementRef);
private visibilityService = inject(WidgetVisibilityService);
private cd = inject(ChangeDetectorRef);
private readonly visibilityService = inject(WidgetVisibilityService);
private readonly cd = inject(ChangeDetectorRef);
ngOnInit() {
if (this.field) {
@@ -16,7 +16,7 @@
*/
import { ADF_DATE_FORMATS, AdfDateFnsAdapter, DateFnsUtils } from '@alfresco/adf-core';
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, inject } from '@angular/core';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import { MatDatepickerInputEvent, MatDatepickerModule } from '@angular/material/datepicker';
import { DynamicTableColumn } from '../models/dynamic-table-column.model';
@@ -39,6 +39,8 @@ import { FormsModule } from '@angular/forms';
styleUrls: ['./date.editor.scss']
})
export class DateEditorComponent implements OnInit {
private readonly dateAdapter = inject<DateAdapter<Date>>(DateAdapter);
DATE_FORMAT: string = 'DD-MM-YYYY';
@Input()
@@ -56,8 +58,6 @@ export class DateEditorComponent implements OnInit {
minDate: Date;
maxDate: Date;
constructor(private dateAdapter: DateAdapter<Date>) {}
ngOnInit() {
const dateAdapter = this.dateAdapter as AdfDateFnsAdapter;
dateAdapter.displayFormat = this.DATE_FORMAT;
@@ -16,7 +16,7 @@
*/
import { ADF_DATETIME_FORMATS, ADF_DATE_FORMATS, AdfDateFnsAdapter, AdfDateTimeFnsAdapter, DateFnsUtils } from '@alfresco/adf-core';
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, inject } from '@angular/core';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import { DynamicTableColumn } from '../models/dynamic-table-column.model';
import { DynamicTableRow } from '../models/dynamic-table-row.model';
@@ -40,6 +40,8 @@ import { FormsModule } from '@angular/forms';
styleUrls: ['./datetime.editor.scss']
})
export class DateTimeEditorComponent implements OnInit {
private readonly dateAdapter = inject<DateAdapter<Date>>(DateAdapter);
DATE_TIME_FORMAT: string = 'DD/MM/YYYY HH:mm';
@Input()
@@ -57,8 +59,6 @@ export class DateTimeEditorComponent implements OnInit {
minDate: Date;
maxDate: Date;
constructor(private dateAdapter: DateAdapter<Date>) {}
ngOnInit() {
const momentDateAdapter = this.dateAdapter as AdfDateFnsAdapter;
momentDateAdapter.displayFormat = this.DATE_TIME_FORMAT;
@@ -18,7 +18,7 @@
/* eslint-disable @angular-eslint/component-selector */
import { FormService, FormFieldModel } from '@alfresco/adf-core';
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, inject } from '@angular/core';
import { DynamicTableColumnOption } from '../models/dynamic-table-column-option.model';
import { DynamicTableColumn } from '../models/dynamic-table-column.model';
import { DynamicTableRow } from '../models/dynamic-table-row.model';
@@ -37,6 +37,10 @@ import { FormsModule } from '@angular/forms';
styleUrls: ['./dropdown.editor.scss']
})
export class DropdownEditorComponent implements OnInit {
formService = inject(FormService);
private readonly taskFormService = inject(TaskFormService);
private readonly processDefinitionService = inject(ProcessDefinitionService);
value: any = null;
options: DynamicTableColumnOption[] = [];
@@ -49,12 +53,6 @@ export class DropdownEditorComponent implements OnInit {
@Input()
column: DynamicTableColumn;
constructor(
public formService: FormService,
private taskFormService: TaskFormService,
private processDefinitionService: ProcessDefinitionService
) {}
ngOnInit() {
const field = this.table.field;
if (field) {
@@ -26,7 +26,7 @@ import { isValid } from 'date-fns';
export class DateCellValidator implements CellValidator {
static DATE_TYPE = 'Date';
private supportedTypes: string[] = [DateCellValidator.DATE_TYPE];
private readonly supportedTypes: string[] = [DateCellValidator.DATE_TYPE];
isSupported(column: DynamicTableColumn): boolean {
return !!(column?.editable && this.supportedTypes.indexOf(column?.type) > -1);
@@ -54,7 +54,10 @@ export class DynamicTableModel extends FormWidgetModel {
}
}
constructor(field: FormFieldModel, private formService: FormService) {
constructor(
field: FormFieldModel,
private readonly formService: FormService
) {
super(field.form, field.json);
this.field = field;
@@ -66,7 +69,7 @@ export class DynamicTableModel extends FormWidgetModel {
}
if (field.json.value) {
this.rows = field.json.value.map((obj) => ({ selected: false, value: obj } as DynamicTableRow));
this.rows = field.json.value.map((obj) => ({ selected: false, value: obj }) as DynamicTableRow);
}
}
@@ -23,7 +23,7 @@ import { DynamicTableColumn } from './dynamic-table-column.model';
import { DynamicTableRow } from './dynamic-table-row.model';
export class NumberCellValidator implements CellValidator {
private supportedTypes: string[] = ['Number', 'Amount'];
private readonly supportedTypes: string[] = ['Number', 'Amount'];
isSupported(column: DynamicTableColumn): boolean {
return column?.required && this.supportedTypes.indexOf(column.type) > -1;
@@ -23,7 +23,7 @@ import { DynamicTableColumn } from './dynamic-table-column.model';
import { DynamicTableRow } from './dynamic-table-row.model';
export class RequiredCellValidator implements CellValidator {
private supportedTypes: string[] = ['String', 'Number', 'Amount', 'Date', 'Dropdown'];
private readonly supportedTypes: string[] = ['String', 'Number', 'Amount', 'Date', 'Dropdown'];
isSupported(column: DynamicTableColumn): boolean {
return column?.required && this.supportedTypes.indexOf(column.type) > -1;
@@ -21,14 +21,21 @@ import { DynamicTableRow } from '../models/dynamic-table-row.model';
import { DynamicTableModel } from '../models/dynamic-table.widget.model';
import { RowEditorComponent } from './row.editor';
import { DynamicRowValidationSummary } from '../models/dynamic-row-validation-summary.model';
import { TestBed } from '@angular/core/testing';
describe('RowEditorComponent', () => {
let component: RowEditorComponent;
let formService: FormService;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [FormService]
});
formService = TestBed.inject(FormService);
component = new RowEditorComponent();
const field = new FormFieldModel(new FormModel());
component.table = new DynamicTableModel(field, new FormService());
component.table = new DynamicTableModel(field, formService);
component.row = {} as DynamicTableRow;
component.column = {} as DynamicTableColumn;
});
@@ -45,8 +45,8 @@ import { FormsModule } from '@angular/forms';
encapsulation: ViewEncapsulation.None
})
export class RadioButtonsWidgetComponent extends WidgetComponent implements OnInit {
private taskFormService = inject(TaskFormService);
private processDefinitionService = inject(ProcessDefinitionService);
private readonly taskFormService = inject(TaskFormService);
private readonly processDefinitionService = inject(ProcessDefinitionService);
ngOnInit() {
if (this.isValidRestConfig() && !this.isReadOnlyForm()) {
@@ -53,8 +53,8 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit
oldValue: string;
options: FormFieldOption[] = [];
private taskFormService = inject(TaskFormService);
private processDefinitionService = inject(ProcessDefinitionService);
private readonly taskFormService = inject(TaskFormService);
private readonly processDefinitionService = inject(ProcessDefinitionService);
ngOnInit() {
if (this.field.form.taskId && this.field.restUrl) {
@@ -16,7 +16,7 @@
*/
import { DataColumnComponent, DataColumnListComponent, TranslationService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { Component, EventEmitter, Input, Output, ViewEncapsulation, inject } from '@angular/core';
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
import { debounceTime, switchMap } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
@@ -46,6 +46,9 @@ import { PeopleListComponent } from '../people-list/people-list.component';
encapsulation: ViewEncapsulation.None
})
export class PeopleSearchFieldComponent {
peopleProcessService = inject(PeopleProcessService);
private readonly translationService = inject(TranslationService);
@Input()
performSearch: PerformSearchCallback;
@@ -60,7 +63,7 @@ export class PeopleSearchFieldComponent {
defaultPlaceholder = 'ADF_TASK_LIST.PEOPLE.SEARCH_USER';
constructor(public peopleProcessService: PeopleProcessService, private translationService: TranslationService) {
constructor() {
this.users$ = this.searchUser.valueChanges.pipe(
debounceTime(200),
switchMap((searchWord: string) => {
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, ViewChild, ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { Component, ViewChild, ViewEncapsulation, EventEmitter, Input, Output, inject } from '@angular/core';
import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface';
import { TranslationService } from '@alfresco/adf-core';
import { PeopleSearchFieldComponent } from '../people-search-field/people-search-field.component';
@@ -39,6 +39,9 @@ const DEFAULT_ASSIGNEE_PLACEHOLDER = 'ADF_TASK_LIST.PEOPLE.ASSIGNEE';
encapsulation: ViewEncapsulation.None
})
export class PeopleSelectorComponent {
private readonly peopleProcessService = inject(PeopleProcessService);
private readonly translationService = inject(TranslationService);
@Input()
peopleId: LightUserRepresentation;
@@ -53,7 +56,7 @@ export class PeopleSelectorComponent {
selectedUser: LightUserRepresentation;
defaultPlaceholder: string;
constructor(private peopleProcessService: PeopleProcessService, private translationService: TranslationService) {
constructor() {
this.peopleIdChange = new EventEmitter();
this.performSearch = this.searchUser.bind(this);
this.defaultPlaceholder = this.translationService.instant(DEFAULT_ASSIGNEE_PLACEHOLDER);
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, EventEmitter, Input, Output, ViewChild, ViewEncapsulation, inject } from '@angular/core';
import { Observable, Observer } from 'rxjs';
import { UserEventModel } from '../../../task-list/models/user-event.model';
import { PeopleSearchComponent } from '../people-search/people-search.component';
@@ -46,6 +46,8 @@ import { DataColumnComponent, DataColumnListComponent } from '@alfresco/adf-core
encapsulation: ViewEncapsulation.None
})
export class PeopleComponent {
peopleProcessService = inject(PeopleProcessService);
/** The array of User objects to display. */
@Input()
people: LightUserRepresentation[] = [];
@@ -69,7 +71,7 @@ export class PeopleComponent {
private peopleSearchObserver: Observer<LightUserRepresentation[]>;
constructor(public peopleProcessService: PeopleProcessService) {
constructor() {
this.peopleSearch$ = new Observable<LightUserRepresentation[]>((observer) => (this.peopleSearchObserver = observer)).pipe(share());
}
@@ -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 } from 'rxjs';
import { CommentModel, CommentsService, User } from '@alfresco/adf-core';
import { map } from 'rxjs/operators';
@@ -27,14 +27,15 @@ import { PeopleProcessService } from '../../services/people-process.service';
providedIn: 'root'
})
export class CommentProcessService implements CommentsService {
private readonly apiService = inject(AlfrescoApiService);
private readonly peopleProcessService = inject(PeopleProcessService);
private _commentsApi: ActivitiCommentsApi;
get commentsApi(): ActivitiCommentsApi {
this._commentsApi = this._commentsApi ?? new ActivitiCommentsApi(this.apiService.getInstance());
return this._commentsApi;
}
constructor(private apiService: AlfrescoApiService, private peopleProcessService: PeopleProcessService) {}
/**
* Gets all comments that have been added to a process instance.
*
@@ -36,6 +36,11 @@ import { MatIconModule } from '@angular/material/icon';
encapsulation: ViewEncapsulation.None
})
export class ProcessFiltersComponent implements OnInit, OnChanges {
private readonly processFilterService = inject(ProcessFilterService);
private readonly appsProcessService = inject(AppsProcessService);
private readonly router = inject(Router);
private readonly location = inject(Location);
/**
* The parameters to filter the task filter. If there is no match then the default one
* (ie, the first filter in the list) is selected.
@@ -82,13 +87,6 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
private readonly destroyRef = inject(DestroyRef);
constructor(
private processFilterService: ProcessFilterService,
private appsProcessService: AppsProcessService,
private router: Router,
private location: Location
) {}
ngOnInit() {
this.iconsMDL = new IconModel();
this.router.events
@@ -16,7 +16,7 @@
*/
import { CommonModule, DatePipe } from '@angular/common';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild, inject } from '@angular/core';
import { TaskDetailsEvent } from '../../../task-list';
import { ProcessService } from '../../services/process.service';
import { ProcessInstanceHeaderComponent } from '../process-instance-header/process-instance-header.component';
@@ -42,6 +42,8 @@ import { ProcessCommentsComponent } from '../../../process-comments';
styleUrls: ['./process-instance-details.component.css']
})
export class ProcessInstanceDetailsComponent implements OnChanges {
private readonly processService = inject(ProcessService);
/** (required) The numeric ID of the process instance to display. */
@Input({ required: true })
processInstanceId: string;
@@ -78,8 +80,6 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
processInstanceDetails: ProcessInstanceRepresentation;
constructor(private processService: ProcessService) {}
ngOnChanges(changes: SimpleChanges) {
const processInstanceId = changes['processInstanceId'];
if (processInstanceId && !processInstanceId.currentValue) {
@@ -24,7 +24,7 @@ import {
CardViewTextItemModel,
TranslationService
} from '@alfresco/adf-core';
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
import { ProcessInstanceRepresentation } from '@alfresco/js-api';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
@@ -36,6 +36,9 @@ import { MatCardModule } from '@angular/material/card';
styleUrls: ['./process-instance-header.component.css']
})
export class ProcessInstanceHeaderComponent implements OnChanges {
private readonly translationService = inject(TranslationService);
private readonly appConfig = inject(AppConfigService);
/** (**required**) Full details of the process instance to display information about. */
@Input({ required: true })
processInstance: ProcessInstanceRepresentation;
@@ -44,7 +47,7 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
dateFormat: string;
dateLocale: string;
constructor(private translationService: TranslationService, private appConfig: AppConfigService) {
constructor() {
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat');
this.dateLocale = this.appConfig.get('dateValues.defaultDateLocale');
}
@@ -38,6 +38,9 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
styleUrls: ['./process-instance-tasks.component.css']
})
export class ProcessInstanceTasksComponent implements OnInit, OnChanges {
private readonly processService = inject(ProcessService);
private readonly dialog = inject(MatDialog);
/** The ID of the process instance to display tasks for. */
@Input({ required: true })
processInstanceDetails: ProcessInstanceRepresentation;
@@ -75,7 +78,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges {
private readonly destroyRef = inject(DestroyRef);
constructor(private processService: ProcessService, private dialog: MatDialog) {
constructor() {
this.task$ = new Observable<TaskRepresentation>((observer) => (this.taskObserver = observer)).pipe(share());
this.completedTask$ = new Observable<TaskRepresentation>((observer) => (this.completedTaskObserver = observer)).pipe(share());
}
@@ -594,7 +594,7 @@ class ProcessListContextMenuComponent implements OnInit {
appId: number;
private performAction$ = new Subject<any>();
private readonly performAction$ = new Subject<any>();
ngOnInit() {
this.performContextActions();
@@ -23,7 +23,6 @@ import {
CustomLoadingContentTemplateDirective,
DataRow,
DataColumn,
AppConfigService,
PaginatedComponent,
PaginationModel,
UserPreferencesService,
@@ -35,7 +34,7 @@ import {
NoContentTemplateDirective,
ObjectDataRow
} from '@alfresco/adf-core';
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core';
import { ProcessService } from '../../services/process.service';
import { BehaviorSubject } from 'rxjs';
import { finalize } from 'rxjs/operators';
@@ -84,6 +83,9 @@ export const processPresetsDefaultModel = {
templateUrl: './process-list.component.html'
})
export class ProcessInstanceListComponent extends DataTableSchema implements OnChanges, AfterContentInit, PaginatedComponent {
private readonly processService = inject(ProcessService);
private readonly userPreferences = inject(UserPreferencesService);
@ContentChild(CustomEmptyContentTemplateDirective)
customEmptyContent: CustomEmptyContentTemplateDirective;
@@ -192,12 +194,8 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC
sorting: any[] = ['created', 'desc'];
pagination: BehaviorSubject<PaginationModel>;
constructor(
private readonly processService: ProcessService,
private readonly userPreferences: UserPreferencesService,
appConfig: AppConfigService
) {
super(appConfig, PRESET_KEY, processPresetsDefaultModel);
constructor() {
super(PRESET_KEY, processPresetsDefaultModel);
this.size = this.userPreferences.paginationSize;
this.pagination = new BehaviorSubject<PaginationModel>({
@@ -82,6 +82,12 @@ const PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}',
encapsulation: ViewEncapsulation.None
})
export class StartProcessInstanceComponent implements OnChanges, OnInit {
private readonly processService = inject(ProcessService);
private readonly contentService = inject(ActivitiContentService);
private readonly appsProcessService = inject(AppsProcessService);
private readonly appConfig = inject(AppConfigService);
private readonly datePipe = inject(LocalizedDatePipe);
/**
* Limit the list of processes that can be started to those
* contained in the specified app.
@@ -166,14 +172,6 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
private readonly destroyRef = inject(DestroyRef);
constructor(
private processService: ProcessService,
private contentService: ActivitiContentService,
private appsProcessService: AppsProcessService,
private appConfig: AppConfigService,
private datePipe: LocalizedDatePipe
) {}
ngOnInit() {
this.processNameInput = new UntypedFormControl('', [
Validators.required,
@@ -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, forkJoin } from 'rxjs';
import { map } from 'rxjs/operators';
import {
@@ -29,14 +29,14 @@ import {
providedIn: 'root'
})
export class ProcessFilterService {
private readonly alfrescoApiService = inject(AlfrescoApiService);
private _userFiltersApi: UserFiltersApi;
get userFiltersApi(): UserFiltersApi {
this._userFiltersApi = this._userFiltersApi ?? new UserFiltersApi(this.alfrescoApiService.getInstance());
return this._userFiltersApi;
}
constructor(private alfrescoApiService: AlfrescoApiService) {}
/**
* Gets all filters defined for a Process App.
*
@@ -40,7 +40,7 @@ import { DatePipe } from '@angular/common';
providedIn: 'root'
})
export class ProcessService {
private alfrescoApiService = inject(AlfrescoApiService);
private readonly alfrescoApiService = inject(AlfrescoApiService);
private _tasksApi: TasksApi;
get tasksApi(): TasksApi {
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { RuntimeAppDefinitionsApi, AppDefinitionRepresentation } from '@alfresco/js-api';
import { Observable, from } from 'rxjs';
import { AlfrescoApiService } from '@alfresco/adf-content-services';
@@ -25,14 +25,14 @@ import { map } from 'rxjs/operators';
providedIn: 'root'
})
export class AppsProcessService {
private readonly apiService = inject(AlfrescoApiService);
private _appsApi: RuntimeAppDefinitionsApi;
get appsApi(): RuntimeAppDefinitionsApi {
this._appsApi = this._appsApi ?? new RuntimeAppDefinitionsApi(this.apiService.getInstance());
return this._appsApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Gets a list of deployed apps for this user.
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { Observable, from } from 'rxjs';
import { GroupModel } from '@alfresco/adf-core';
import { map } from 'rxjs/operators';
@@ -26,6 +26,8 @@ import { TaskActionsApi, UsersApi, ActivitiGroupsApi, UserProfileApi, UserRepres
providedIn: 'root'
})
export class PeopleProcessService {
private readonly apiService = inject(AlfrescoApiService);
private _taskActionsApi: TaskActionsApi;
get taskActionsApi(): TaskActionsApi {
this._taskActionsApi = this._taskActionsApi ?? new TaskActionsApi(this.apiService.getInstance());
@@ -50,8 +52,6 @@ export class PeopleProcessService {
return this._profileApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Gets information about the current user.
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, inject } from '@angular/core';
import { Form } from '../../models/form.model';
import { TaskListService } from '../../services/tasklist.service';
import { ReactiveFormsModule, UntypedFormControl, Validators } from '@angular/forms';
@@ -36,6 +36,10 @@ import { FormComponent } from '../../../form';
styleUrls: ['./attach-form.component.scss']
})
export class AttachFormComponent implements OnInit, OnChanges {
private readonly taskService = inject(TaskListService);
private readonly modelService = inject(ModelService);
private readonly taskFormService = inject(TaskFormService);
/** Id of the task. */
@Input({ required: true })
taskId: any;
@@ -64,8 +68,6 @@ export class AttachFormComponent implements OnInit, OnChanges {
attachFormControl: UntypedFormControl;
constructor(private taskService: TaskListService, private modelService: ModelService, private taskFormService: TaskFormService) {}
ngOnInit() {
this.attachFormControl = new UntypedFormControl('', Validators.required);
this.attachFormControl.valueChanges.subscribe((currentValue) => {
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild, inject } from '@angular/core';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { TaskListService } from '../../services/tasklist.service';
import { TaskRepresentation } from '@alfresco/js-api';
@@ -45,6 +45,9 @@ import { FormsModule } from '@angular/forms';
styleUrls: ['./checklist.component.scss']
})
export class ChecklistComponent implements OnChanges {
private readonly taskListService = inject(TaskListService);
private readonly dialog = inject(MatDialog);
/**
* The id of the parent task to which subtasks are attached.
*/
@@ -81,8 +84,6 @@ export class ChecklistComponent implements OnChanges {
checklist: TaskRepresentation[] = [];
constructor(private taskListService: TaskListService, private dialog: MatDialog) {}
ngOnChanges(changes: SimpleChanges) {
const taskId = changes['taskId'];
if (taskId?.currentValue) {
@@ -153,10 +153,10 @@ describe('StartTaskComponent', () => {
})
);
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
createTaskButton.click();
@@ -259,11 +259,11 @@ describe('StartTaskComponent', () => {
it('should not assign task when no assignee is selected', () => {
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.assigneeId = null;
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
createTaskButton.click();
@@ -64,6 +64,9 @@ const MAX_LENGTH = 255;
encapsulation: ViewEncapsulation.None
})
export class StartTaskComponent implements OnInit {
private readonly taskService = inject(TaskListService);
private readonly formBuilder = inject(UntypedFormBuilder);
/** (required) The id of the app. */
@Input({ required: true })
appId: number;
@@ -95,8 +98,6 @@ export class StartTaskComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
constructor(private taskService: TaskListService, private formBuilder: UntypedFormBuilder) {}
ngOnInit() {
if (this.name) {
this.taskDetailsModel.name = this.name;
@@ -38,7 +38,8 @@ import {
SimpleChanges,
TemplateRef,
ViewChild,
ViewEncapsulation
ViewEncapsulation,
inject
} from '@angular/core';
import { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { Observable, Observer, of } from 'rxjs';
@@ -88,6 +89,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
encapsulation: ViewEncapsulation.None
})
export class TaskDetailsComponent implements OnInit, OnChanges {
private readonly taskListService = inject(TaskListService);
private readonly peopleProcessService = inject(PeopleProcessService);
private readonly cardViewUpdateService = inject(CardViewUpdateService);
private readonly dialog = inject(MatDialog);
private readonly destroyRef = inject(DestroyRef);
@ViewChild('errorDialog')
errorDialog: TemplateRef<any>;
@@ -209,14 +216,6 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
private peopleSearchObserver: Observer<LightUserRepresentation[]>;
constructor(
private readonly taskListService: TaskListService,
private readonly peopleProcessService: PeopleProcessService,
private readonly cardViewUpdateService: CardViewUpdateService,
private readonly dialog: MatDialog,
private readonly destroyRef: DestroyRef
) {}
ngOnInit() {
this.peopleSearch = new Observable<LightUserRepresentation[]>((observer) => (this.peopleSearchObserver = observer)).pipe(share());
@@ -38,6 +38,12 @@ import { MatIconModule } from '@angular/material/icon';
encapsulation: ViewEncapsulation.None
})
export class TaskFiltersComponent implements OnInit, OnChanges {
private readonly taskFilterService = inject(TaskFilterService);
private readonly taskListService = inject(TaskListService);
private readonly appsProcessService = inject(AppsProcessService);
private readonly router = inject(Router);
private readonly activatedRoute = inject(ActivatedRoute);
/**
* Parameters to use for the task filter. If there is no match then
* the default filter (the first one the list) is selected.
@@ -83,14 +89,6 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
private readonly destroyRef = inject(DestroyRef);
constructor(
private taskFilterService: TaskFilterService,
private taskListService: TaskListService,
private appsProcessService: AppsProcessService,
private router: Router,
private activatedRoute: ActivatedRoute
) {}
ngOnInit() {
this.iconsMDL = new IconModel();
this.router.events
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Directive, Input, Output, EventEmitter, HostListener, OnInit } from '@angular/core';
import { Directive, Input, Output, EventEmitter, HostListener, OnInit, inject } from '@angular/core';
import { TaskListService } from '../../services/tasklist.service';
@Directive({
@@ -23,6 +23,8 @@ import { TaskListService } from '../../services/tasklist.service';
selector: '[adf-claim-task]'
})
export class ClaimTaskDirective implements OnInit {
private readonly taskListService = inject(TaskListService);
/** (Required) The id of the task. */
@Input()
taskId: string;
@@ -37,8 +39,6 @@ export class ClaimTaskDirective implements OnInit {
invalidParams: string[] = [];
constructor(private taskListService: TaskListService) {}
@HostListener('click')
onClick() {
try {
@@ -153,9 +153,9 @@ export class TaskFormComponent implements OnInit, OnChanges {
loading: boolean = false;
internalReadOnlyForm: boolean = false;
private taskListService = inject(TaskListService);
private peopleProcessService = inject(PeopleProcessService);
private translationService = inject(TranslationService);
private readonly taskListService = inject(TaskListService);
private readonly peopleProcessService = inject(PeopleProcessService);
private readonly translationService = inject(TranslationService);
ngOnInit() {
this.peopleProcessService.getCurrentUserInfo().subscribe((user) => {
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Directive, HostListener, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { Directive, HostListener, Input, Output, EventEmitter, OnInit, inject } from '@angular/core';
import { TaskListService } from '../../services/tasklist.service';
@Directive({
@@ -23,6 +23,8 @@ import { TaskListService } from '../../services/tasklist.service';
selector: '[adf-unclaim-task]'
})
export class UnclaimTaskDirective implements OnInit {
private readonly taskListService = inject(TaskListService);
/** (Required) The id of the task. */
@Input()
taskId: string;
@@ -37,8 +39,6 @@ export class UnclaimTaskDirective implements OnInit {
invalidParams: string[] = [];
constructor(private taskListService: TaskListService) {}
@HostListener('click')
onClick() {
try {
@@ -51,6 +51,11 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
encapsulation: ViewEncapsulation.None
})
export class TaskHeaderComponent implements OnChanges, OnInit {
private readonly peopleProcessService = inject(PeopleProcessService);
private readonly translationService = inject(TranslationService);
private readonly appConfig = inject(AppConfigService);
private readonly cardViewUpdateService = inject(CardViewUpdateService);
/** The name of the form. */
@Input()
formName: string = null;
@@ -94,12 +99,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
private readonly destroyRef = inject(DestroyRef);
constructor(
private peopleProcessService: PeopleProcessService,
private translationService: TranslationService,
private readonly appConfig: AppConfigService,
private readonly cardViewUpdateService: CardViewUpdateService
) {
constructor() {
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat');
this.dateLocale = this.appConfig.get('dateValues.defaultDateLocale');
}
@@ -749,7 +749,7 @@ describe('Task List: Custom EmptyTemplateComponent', () => {
class TaskListContextMenuComponent implements OnInit {
@Output()
contextAction = new EventEmitter<any>();
private performAction$ = new Subject<any>();
private readonly performAction$ = new Subject<any>();
ngOnInit() {
this.performContextActions();
@@ -16,7 +16,6 @@
*/
import {
AppConfigService,
CustomEmptyContentTemplateDirective,
CustomLoadingContentTemplateDirective,
DataCellEvent,
@@ -73,6 +72,9 @@ export const PRESET_KEY = 'adf-task-list.presets';
styleUrls: ['./task-list.component.css']
})
export class TaskListComponent extends DataTableSchema implements OnChanges, AfterContentInit, PaginatedComponent, OnInit {
private readonly taskListService = inject(TaskListService);
private readonly userPreferences = inject(UserPreferencesService);
@ContentChild(CustomEmptyContentTemplateDirective)
customEmptyContent: CustomEmptyContentTemplateDirective;
@@ -226,8 +228,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
private readonly destroyRef = inject(DestroyRef);
constructor(private taskListService: TaskListService, appConfigService: AppConfigService, private userPreferences: UserPreferencesService) {
super(appConfigService, PRESET_KEY, taskPresetsDefaultModel);
constructor() {
super(PRESET_KEY, taskPresetsDefaultModel);
this.pagination = new BehaviorSubject<PaginationModel>({
maxItems: this.size,
@@ -18,7 +18,7 @@
import { TaskRepresentation } from '@alfresco/js-api';
export class TaskDetailsEvent {
private _value: TaskRepresentation;
private readonly _value: TaskRepresentation;
private _defaultPrevented: boolean = false;
get value(): TaskRepresentation {