From f5abce8baabb7671933c4c935bb71bc32230ac5b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Mon, 5 Jun 2023 17:31:44 +0100 Subject: [PATCH] Optimise imports using inject function (#8557) * optimise AuthGuard * optimise UploadBase * optimise BaseAuthenticationService * optimise FormComponent * optimise BaseCloudService * optimise card view --- .../base-upload/upload-base.spec.ts | 10 ++----- .../components/base-upload/upload-base.ts | 10 +++---- .../components/upload-button.component.ts | 25 +++++----------- .../components/upload-drag-area.component.ts | 18 +++-------- .../src/lib/auth/guard/auth-guard-base.ts | 20 +++++-------- .../lib/auth/guard/auth-guard-bpm.service.ts | 15 +--------- .../lib/auth/guard/auth-guard-ecm.service.ts | 17 +---------- .../src/lib/auth/guard/auth-guard.service.ts | 15 ++-------- .../auth/mock/authentication.service.mock.ts | 15 ---------- .../auth/oidc/oidc-authentication.service.ts | 25 ++++++---------- .../auth/services/authentication.service.ts | 18 ++++------- .../card-view/components/base-card-view.ts | 5 ++-- .../card-view-arrayitem.component.ts | 6 ---- .../card-view-boolitem.component.ts | 6 ---- .../card-view-dateitem.component.ts | 6 ++-- .../card-view-keyvaluepairsitem.component.ts | 5 ---- .../card-view-mapitem.component.ts | 5 ---- .../card-view-selectitem.component.ts | 8 ++--- .../card-view-textitem.component.ts | 6 ++-- .../services/base-authentication.service.ts | 17 +++++------ .../lib/form/services/form-cloud.service.ts | 15 ++-------- .../form-definition-selector-cloud.service.ts | 7 ----- .../services/process-list-cloud.service.ts | 8 ----- .../process-task-list-cloud.service.ts | 8 ----- .../process/services/process-cloud.service.ts | 8 ----- .../services/start-process-cloud.service.ts | 8 ----- .../src/lib/services/base-cloud.service.ts | 11 +++---- .../services/notification-cloud.service.ts | 9 ++---- .../services/user-preference-cloud.service.ts | 9 ------ .../task/services/start-task-cloud.service.ts | 8 ----- .../lib/task/services/task-cloud.service.ts | 12 ++------ .../services/task-filter-cloud.service.ts | 5 +--- .../service-task-list-cloud.service.ts | 8 ----- .../services/task-list-cloud.service.ts | 8 ----- .../src/lib/form/form.component.ts | 30 ++++++++++--------- .../src/lib/form/start-form.component.ts | 23 +++++--------- 36 files changed, 99 insertions(+), 330 deletions(-) diff --git a/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts b/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts index 7f9e83203a..46617689b5 100644 --- a/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts +++ b/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts @@ -15,9 +15,9 @@ * limitations under the License. */ -import { Component, NgZone } from '@angular/core'; +import { Component } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; -import { TranslationService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { UploadBase } from './upload-base'; import { UploadFilesEvent } from '../upload-files.event'; import { ContentTestingModule } from '../../../testing/content.testing.module'; @@ -32,12 +32,6 @@ import { FileUploadErrorEvent } from '../../../common/events/file.event'; template: 'test component' }) export class UploadTestComponent extends UploadBase { - - constructor(protected uploadService: UploadService, - protected translationService: TranslationService, - protected ngZone: NgZone) { - super(uploadService, translationService, ngZone); - } } const file = { name: 'bigFile.png', size: 1000 } as File; diff --git a/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts b/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts index bd601039cf..650e9849c1 100644 --- a/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts +++ b/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts @@ -19,7 +19,7 @@ import { FileInfo, TranslationService } from '@alfresco/adf-core'; import { FileUploadErrorEvent } from '../../../common/events/file.event'; import { FileModel } from '../../../common/models/file.model'; import { UploadService } from '../../../common/services/upload.service'; -import { EventEmitter, Input, Output, OnInit, OnDestroy, NgZone, Directive } from '@angular/core'; +import { EventEmitter, Input, Output, OnInit, OnDestroy, NgZone, Directive, inject } from '@angular/core'; import { Subject } from 'rxjs'; import { UploadFilesEvent } from '../upload-files.event'; import { takeUntil } from 'rxjs/operators'; @@ -27,6 +27,9 @@ import { takeUntil } from 'rxjs/operators'; @Directive() // eslint-disable-next-line @angular-eslint/directive-class-suffix export abstract class UploadBase implements OnInit, OnDestroy { + protected uploadService = inject(UploadService); + protected translationService = inject(TranslationService); + protected ngZone = inject(NgZone); /** Sets a limit on the maximum size (in bytes) of a file to be uploaded. * Has no effect if undefined. @@ -82,11 +85,6 @@ export abstract class UploadBase implements OnInit, OnDestroy { protected onDestroy$ = new Subject(); - constructor(protected uploadService: UploadService, - protected translationService: TranslationService, - protected ngZone: NgZone) { - } - ngOnInit() { this.uploadService.fileUploadError .pipe(takeUntil(this.onDestroy$)) diff --git a/lib/content-services/src/lib/upload/components/upload-button.component.ts b/lib/content-services/src/lib/upload/components/upload-button.component.ts index 907a1130b2..fd7f17b206 100644 --- a/lib/content-services/src/lib/upload/components/upload-button.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-button.component.ts @@ -15,15 +15,11 @@ * limitations under the License. */ -import { - EXTENDIBLE_COMPONENT, FileUtils, - LogService, TranslationService -} from '@alfresco/adf-core'; +import { EXTENDIBLE_COMPONENT, FileUtils, LogService } from '@alfresco/adf-core'; import { Component, EventEmitter, forwardRef, Input, - OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation, NgZone + OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation, inject } from '@angular/core'; -import { UploadService } from '../../common/services/upload.service'; import { NodesApiService } from '../../common/services/nodes-api.service'; import { ContentService } from '../../common/services/content.service'; import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; @@ -43,6 +39,9 @@ import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-o encapsulation: ViewEncapsulation.None }) export class UploadButtonComponent extends UploadBase implements OnInit, OnChanges, NodeAllowableOperationSubject { + private contentService = inject(ContentService); + private nodesApiService = inject(NodesApiService); + protected logService = inject(LogService); /** Allows/disallows upload folders (only for Chrome). */ @Input() @@ -66,20 +65,10 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang /** Emitted when create permission is missing. */ @Output() - permissionEvent: EventEmitter = new EventEmitter(); + permissionEvent = new EventEmitter(); private hasAllowableOperations: boolean = false; - - protected permissionValue: Subject = new Subject(); - - constructor(protected uploadService: UploadService, - private contentService: ContentService, - private nodesApiService: NodesApiService, - protected translationService: TranslationService, - protected logService: LogService, - protected ngZone: NgZone) { - super(uploadService, translationService, ngZone); - } + protected permissionValue = new Subject(); ngOnInit() { this.permissionValue.subscribe((permission: boolean) => { diff --git a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts index b0fc903a1d..d29800b708 100644 --- a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts @@ -15,15 +15,11 @@ * limitations under the License. */ -import { - EXTENDIBLE_COMPONENT, FileInfo, FileUtils, - NotificationService, TranslationService -} from '@alfresco/adf-core'; -import { Component, forwardRef, ViewEncapsulation, NgZone } from '@angular/core'; +import { EXTENDIBLE_COMPONENT, FileInfo, FileUtils, NotificationService } from '@alfresco/adf-core'; +import { Component, forwardRef, ViewEncapsulation, inject } from '@angular/core'; import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-operation-subject.interface'; import { UploadBase } from './base-upload/upload-base'; import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; -import { UploadService } from '../../common/services/upload.service'; import { ContentService } from '../../common/services/content.service'; import { FileModel } from '../../common/models/file.model'; @@ -38,14 +34,8 @@ import { FileModel } from '../../common/models/file.model'; encapsulation: ViewEncapsulation.None }) export class UploadDragAreaComponent extends UploadBase implements NodeAllowableOperationSubject { - - constructor(protected uploadService: UploadService, - protected translationService: TranslationService, - private notificationService: NotificationService, - private contentService: ContentService, - protected ngZone: NgZone) { - super(uploadService, translationService, ngZone); - } + private notificationService = inject(NotificationService); + private contentService = inject(ContentService); /** * Method called when files are dropped in the drag area. diff --git a/lib/core/src/lib/auth/guard/auth-guard-base.ts b/lib/core/src/lib/auth/guard/auth-guard-base.ts index 2b37795ca1..0a1c1a874b 100644 --- a/lib/core/src/lib/auth/guard/auth-guard-base.ts +++ b/lib/core/src/lib/auth/guard/auth-guard-base.ts @@ -24,16 +24,19 @@ import { UrlTree } from '@angular/router'; import { AuthenticationService } from '../services/authentication.service'; -import { - AppConfigService, - AppConfigValues -} from '../../app-config/app-config.service'; +import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service'; import { OauthConfigModel } from '../models/oauth-config.model'; import { MatDialog } from '@angular/material/dialog'; import { StorageService } from '../../common/services/storage.service'; import { Observable } from 'rxjs'; +import { inject } from '@angular/core'; export abstract class AuthGuardBase implements CanActivate, CanActivateChild { + protected authenticationService = inject(AuthenticationService); + protected router = inject(Router); + protected appConfigService = inject(AppConfigService); + protected dialog = inject(MatDialog); + private storageService = inject(StorageService); protected get withCredentials(): boolean { return this.appConfigService.get( @@ -42,15 +45,6 @@ export abstract class AuthGuardBase implements CanActivate, CanActivateChild { ); } - constructor( - protected authenticationService: AuthenticationService, - protected router: Router, - protected appConfigService: AppConfigService, - protected dialog: MatDialog, - private storageService: StorageService - ) { - } - abstract checkLogin( activeRoute: ActivatedRouteSnapshot, redirectUrl: string diff --git a/lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts b/lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts index b119d46901..4d511832a9 100644 --- a/lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts +++ b/lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts @@ -16,26 +16,13 @@ */ import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router'; -import { AppConfigService } from '../../app-config/app-config.service'; -import { AuthenticationService } from '../services/authentication.service'; +import { ActivatedRouteSnapshot, UrlTree } from '@angular/router'; import { AuthGuardBase } from './auth-guard-base'; -import { MatDialog } from '@angular/material/dialog'; -import { StorageService } from '../../common/services/storage.service'; @Injectable({ providedIn: 'root' }) export class AuthGuardBpm extends AuthGuardBase { - - constructor(authenticationService: AuthenticationService, - router: Router, - appConfigService: AppConfigService, - dialog: MatDialog, - storageService: StorageService) { - super(authenticationService, router, appConfigService, dialog, storageService); - } - async checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Promise { if (this.authenticationService.isBpmLoggedIn() || this.withCredentials) { return true; diff --git a/lib/core/src/lib/auth/guard/auth-guard-ecm.service.ts b/lib/core/src/lib/auth/guard/auth-guard-ecm.service.ts index c00b6e7bd7..0154b91ec7 100644 --- a/lib/core/src/lib/auth/guard/auth-guard-ecm.service.ts +++ b/lib/core/src/lib/auth/guard/auth-guard-ecm.service.ts @@ -16,28 +16,13 @@ */ import { Injectable } from '@angular/core'; -import { - ActivatedRouteSnapshot, Router, UrlTree -} from '@angular/router'; -import { AuthenticationService } from '../services/authentication.service'; -import { AppConfigService } from '../../app-config/app-config.service'; +import { ActivatedRouteSnapshot, UrlTree } from '@angular/router'; import { AuthGuardBase } from './auth-guard-base'; -import { MatDialog } from '@angular/material/dialog'; -import { StorageService } from '../../common/services/storage.service'; @Injectable({ providedIn: 'root' }) export class AuthGuardEcm extends AuthGuardBase { - - constructor(authenticationService: AuthenticationService, - router: Router, - appConfigService: AppConfigService, - dialog: MatDialog, - storageService: StorageService) { - super(authenticationService, router, appConfigService, dialog, storageService); - } - async checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Promise { if (this.authenticationService.isEcmLoggedIn() || this.withCredentials) { return true; diff --git a/lib/core/src/lib/auth/guard/auth-guard.service.ts b/lib/core/src/lib/auth/guard/auth-guard.service.ts index e41729cef0..9f6b1897d4 100644 --- a/lib/core/src/lib/auth/guard/auth-guard.service.ts +++ b/lib/core/src/lib/auth/guard/auth-guard.service.ts @@ -16,13 +16,9 @@ */ import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router'; -import { AuthenticationService } from '../services/authentication.service'; -import { AppConfigService } from '../../app-config/app-config.service'; +import { ActivatedRouteSnapshot, UrlTree } from '@angular/router'; import { AuthGuardBase } from './auth-guard-base'; import { JwtHelperService } from '../services/jwt-helper.service'; -import { MatDialog } from '@angular/material/dialog'; -import { StorageService } from '../../common/services/storage.service'; @Injectable({ providedIn: 'root' @@ -31,13 +27,8 @@ export class AuthGuard extends AuthGuardBase { ticketChangeBind: any; - constructor(private jwtHelperService: JwtHelperService, - authenticationService: AuthenticationService, - router: Router, - appConfigService: AppConfigService, - dialog: MatDialog, - storageService: StorageService) { - super(authenticationService, router, appConfigService, dialog, storageService); + constructor(private jwtHelperService: JwtHelperService) { + super(); this.ticketChangeBind = this.ticketChange.bind(this); window.addEventListener('storage', this.ticketChangeBind); diff --git a/lib/core/src/lib/auth/mock/authentication.service.mock.ts b/lib/core/src/lib/auth/mock/authentication.service.mock.ts index 2057600863..dfa6e8674f 100644 --- a/lib/core/src/lib/auth/mock/authentication.service.mock.ts +++ b/lib/core/src/lib/auth/mock/authentication.service.mock.ts @@ -18,26 +18,11 @@ import { Observable, of, throwError } from 'rxjs'; import { Injectable } from '@angular/core'; import { AuthenticationService } from '../services/authentication.service'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { CookieService } from '../../common/services/cookie.service'; -import { LogService } from '../../common/services/log.service'; -import { StorageService } from '../../common/services/storage.service'; -import { AppConfigService } from '../../app-config/app-config.service'; @Injectable({ providedIn: 'root' }) export class AuthenticationMock extends AuthenticationService { - constructor( - appConfig: AppConfigService, - storageService: StorageService, - alfrescoApi: AlfrescoApiService, - cookie: CookieService, - logService: LogService - ) { - super(alfrescoApi, appConfig, cookie, logService, storageService); - } - login(username: string, password: string): Observable<{ type: string; ticket: any }> { if (username === 'fake-username' && password === 'fake-password') { return of({ type: 'type', ticket: 'ticket' }); diff --git a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts index 8e3add6753..ff19ca19a8 100644 --- a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts +++ b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts @@ -15,16 +15,13 @@ * limitations under the License. */ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; import { EMPTY, Observable } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; -import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { AppConfigValues } from '../../app-config/app-config.service'; import { BaseAuthenticationService } from '../../services/base-authentication.service'; -import { CookieService } from '../../common/services/cookie.service'; import { JwtHelperService } from '../services/jwt-helper.service'; -import { LogService } from '../../common/services/log.service'; import { AuthConfigService } from '../oidc/auth-config.service'; import { AuthService } from './auth.service'; @@ -32,19 +29,15 @@ import { AuthService } from './auth.service'; providedIn: 'root' }) export class OIDCAuthenticationService extends BaseAuthenticationService { + private authStorage = inject(OAuthStorage); + private oauthService = inject(OAuthService); + private readonly authConfig = inject(AuthConfigService); + private readonly auth = inject(AuthService); + readonly supportCodeFlow = true; - constructor( - alfrescoApi: AlfrescoApiService, - appConfig: AppConfigService, - cookie: CookieService, - logService: LogService, - private authStorage: OAuthStorage, - private oauthService: OAuthService, - private readonly authConfig: AuthConfigService, - private readonly auth: AuthService - ) { - super(alfrescoApi, appConfig, cookie, logService); + constructor() { + super(); this.alfrescoApi.alfrescoApiInitialized.subscribe(() => { this.alfrescoApi.getInstance().reply('logged-in', () => { this.onLogin.next(); diff --git a/lib/core/src/lib/auth/services/authentication.service.ts b/lib/core/src/lib/auth/services/authentication.service.ts index 2694c03e8c..dc4623217e 100644 --- a/lib/core/src/lib/auth/services/authentication.service.ts +++ b/lib/core/src/lib/auth/services/authentication.service.ts @@ -15,12 +15,9 @@ * limitations under the License. */ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { Observable, from } from 'rxjs'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { CookieService } from '../../common/services/cookie.service'; -import { LogService } from '../../common/services/log.service'; -import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service'; +import { AppConfigValues } from '../../app-config/app-config.service'; import { map, catchError, tap } from 'rxjs/operators'; import { JwtHelperService } from './jwt-helper.service'; import { StorageService } from '../../common/services/storage.service'; @@ -30,16 +27,11 @@ import { BaseAuthenticationService } from '../../services/base-authentication.se providedIn: 'root' }) export class AuthenticationService extends BaseAuthenticationService { + private storageService = inject(StorageService); readonly supportCodeFlow = false; - constructor( - alfrescoApi: AlfrescoApiService, - appConfig: AppConfigService, - cookie: CookieService, - logService: LogService, - private storageService: StorageService - ) { - super(alfrescoApi, appConfig, cookie, logService); + constructor() { + super(); this.alfrescoApi.alfrescoApiInitialized.subscribe(() => { this.alfrescoApi.getInstance().reply('logged-in', () => { this.onLogin.next(); diff --git a/lib/core/src/lib/card-view/components/base-card-view.ts b/lib/core/src/lib/card-view/components/base-card-view.ts index a6e6272ada..764efe8f10 100644 --- a/lib/core/src/lib/card-view/components/base-card-view.ts +++ b/lib/core/src/lib/card-view/components/base-card-view.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Input, OnDestroy, Directive } from '@angular/core'; +import { Input, OnDestroy, Directive, inject } from '@angular/core'; import { CardViewUpdateService } from '../services/card-view-update.service'; import { CardViewItem } from '../interfaces/card-view.interfaces'; import { CardViewBaseItemModel } from '../models/card-view-baseitem.model'; @@ -25,13 +25,14 @@ import { takeUntil } from 'rxjs/operators'; @Directive() // eslint-disable-next-line @angular-eslint/directive-class-suffix export abstract class BaseCardView implements OnDestroy { + protected cardViewUpdateService = inject(CardViewUpdateService); @Input() property: T; protected destroy$ = new Subject(); - constructor(protected cardViewUpdateService: CardViewUpdateService) { + constructor() { this.cardViewUpdateService.updateItem$ .pipe(takeUntil(this.destroy$)) .subscribe((itemModel: CardViewBaseItemModel) => { diff --git a/lib/core/src/lib/card-view/components/card-view-arrayitem/card-view-arrayitem.component.ts b/lib/core/src/lib/card-view/components/card-view-arrayitem/card-view-arrayitem.component.ts index df7361738d..1be88fdbc2 100644 --- a/lib/core/src/lib/card-view/components/card-view-arrayitem/card-view-arrayitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-arrayitem/card-view-arrayitem.component.ts @@ -17,7 +17,6 @@ import { Component, ViewEncapsulation } from '@angular/core'; import { CardViewArrayItemModel } from '../../models/card-view-arrayitem.model'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { BaseCardView } from '../base-card-view'; @Component({ @@ -27,11 +26,6 @@ import { BaseCardView } from '../base-card-view'; encapsulation: ViewEncapsulation.None }) export class CardViewArrayItemComponent extends BaseCardView { - - constructor(cardViewUpdateService: CardViewUpdateService) { - super(cardViewUpdateService); - } - clicked(): void { if (this.isClickable()) { this.cardViewUpdateService.clicked(this.property); diff --git a/lib/core/src/lib/card-view/components/card-view-boolitem/card-view-boolitem.component.ts b/lib/core/src/lib/card-view/components/card-view-boolitem/card-view-boolitem.component.ts index 16e0e6a4cc..f4e67e4a15 100644 --- a/lib/core/src/lib/card-view/components/card-view-boolitem/card-view-boolitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-boolitem/card-view-boolitem.component.ts @@ -18,7 +18,6 @@ import { Component, Input } from '@angular/core'; import { MatCheckboxChange } from '@angular/material/checkbox'; import { CardViewBoolItemModel } from '../../models/card-view-boolitem.model'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { BaseCardView } from '../base-card-view'; @Component({ @@ -27,14 +26,9 @@ import { BaseCardView } from '../base-card-view'; }) export class CardViewBoolItemComponent extends BaseCardView { - @Input() editable: boolean; - constructor(cardViewUpdateService: CardViewUpdateService) { - super(cardViewUpdateService); - } - isEditable() { return this.editable && this.property.editable; } diff --git a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts index c6ea729bab..277cf62012 100644 --- a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.ts @@ -21,7 +21,6 @@ import { DatetimeAdapter, MAT_DATETIME_FORMATS, MatDatetimepickerComponent } fro import { MAT_MOMENT_DATETIME_FORMATS, MomentDatetimeAdapter } from '@mat-datetimepicker/moment'; import moment, { Moment } from 'moment'; import { CardViewDateItemModel } from '../../models/card-view-dateitem.model'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { UserPreferencesService, UserPreferenceValues } from '../../../common/services/user-preferences.service'; import { MomentDateAdapter } from '../../../common/utils/moment-date-adapter'; import { MOMENT_DATE_FORMATS } from '../../../common/utils/moment-date-formats.model'; @@ -66,13 +65,12 @@ export class CardViewDateItemComponent extends BaseCardView(); - constructor(cardViewUpdateService: CardViewUpdateService, - private dateAdapter: DateAdapter, + constructor(private dateAdapter: DateAdapter, private userPreferencesService: UserPreferencesService, private appConfig: AppConfigService, private clipboardService: ClipboardService, private translateService: TranslationService) { - super(cardViewUpdateService); + super(); this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat'); } diff --git a/lib/core/src/lib/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts b/lib/core/src/lib/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts index 22ee7cad22..3e7b981784 100644 --- a/lib/core/src/lib/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts @@ -16,7 +16,6 @@ */ import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { CardViewKeyValuePairsItemModel } from '../../models/card-view.models'; import { CardViewKeyValuePairsItemType } from '../../interfaces/card-view.interfaces'; import { MatTableDataSource } from '@angular/material/table'; @@ -37,10 +36,6 @@ export class CardViewKeyValuePairsItemComponent extends BaseCardView; - constructor(cardViewUpdateService: CardViewUpdateService) { - super(cardViewUpdateService); - } - ngOnChanges() { this.values = this.property.value || []; this.matTableValues = new MatTableDataSource(this.values); diff --git a/lib/core/src/lib/card-view/components/card-view-mapitem/card-view-mapitem.component.ts b/lib/core/src/lib/card-view/components/card-view-mapitem/card-view-mapitem.component.ts index f731c06f94..701f725b1d 100644 --- a/lib/core/src/lib/card-view/components/card-view-mapitem/card-view-mapitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-mapitem/card-view-mapitem.component.ts @@ -17,7 +17,6 @@ import { Component, Input } from '@angular/core'; import { CardViewMapItemModel } from '../../models/card-view-mapitem.model'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { BaseCardView } from '../base-card-view'; @Component({ @@ -33,10 +32,6 @@ export class CardViewMapItemComponent extends BaseCardView @Input() displayEmpty: boolean = true; - constructor(cardViewUpdateService: CardViewUpdateService) { - super(cardViewUpdateService); - } - showProperty() { return this.displayEmpty || !this.property.isEmpty(); } diff --git a/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.ts b/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.ts index fe41f37568..a9e05655ee 100644 --- a/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.ts @@ -15,9 +15,8 @@ * limitations under the License. */ -import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core'; +import { Component, Input, OnChanges, OnDestroy, OnInit, inject } from '@angular/core'; import { CardViewSelectItemModel } from '../../models/card-view-selectitem.model'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { BehaviorSubject, combineLatest, Observable, Subject } from 'rxjs'; import { CardViewSelectItemOption } from '../../interfaces/card-view.interfaces'; import { MatSelectChange } from '@angular/material/select'; @@ -31,6 +30,7 @@ import { takeUntil, map } from 'rxjs/operators'; styleUrls: ['./card-view-selectitem.component.scss'] }) export class CardViewSelectItemComponent extends BaseCardView> implements OnInit, OnChanges, OnDestroy { + private appConfig = inject(AppConfigService); static HIDE_FILTER_LIMIT = 5; @Input() editable: boolean = false; @@ -51,10 +51,6 @@ export class CardViewSelectItemComponent extends BaseCardView[]> = null; - constructor(cardViewUpdateService: CardViewUpdateService, private appConfig: AppConfigService) { - super(cardViewUpdateService); - } - ngOnChanges(): void { this.value = this.property.value; } diff --git a/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts b/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts index 92bdd92d2f..0fdb812795 100644 --- a/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts @@ -17,7 +17,6 @@ import { ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { CardViewTextItemModel } from '../../models/card-view-textitem.model'; -import { CardViewUpdateService } from '../../services/card-view-update.service'; import { BaseCardView } from '../base-card-view'; import { MatChipInputEvent } from '@angular/material/chips'; import { ClipboardService } from '../../../clipboard/clipboard.service'; @@ -67,11 +66,10 @@ export class CardViewTextItemComponent extends BaseCardView(); - constructor(cardViewUpdateService: CardViewUpdateService, - private clipboardService: ClipboardService, + constructor(private clipboardService: ClipboardService, private translateService: TranslationService, private cd: ChangeDetectorRef) { - super(cardViewUpdateService); + super(); } ngOnChanges(changes: SimpleChanges): void { diff --git a/lib/core/src/lib/services/base-authentication.service.ts b/lib/core/src/lib/services/base-authentication.service.ts index 1674ea013e..bb0e313d92 100644 --- a/lib/core/src/lib/services/base-authentication.service.ts +++ b/lib/core/src/lib/services/base-authentication.service.ts @@ -23,36 +23,35 @@ import { AppConfigService, AppConfigValues } from '../app-config/app-config.serv import { AlfrescoApiService } from './alfresco-api.service'; import { CookieService } from '../common/services/cookie.service'; import { LogService } from '../common/services/log.service'; +import { inject } from '@angular/core'; const REMEMBER_ME_COOKIE_KEY = 'ALFRESCO_REMEMBER_ME'; const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30; export abstract class BaseAuthenticationService { + protected alfrescoApi = inject(AlfrescoApiService); + protected appConfig = inject(AppConfigService); + protected cookie = inject(CookieService); + private logService = inject(LogService); + protected bearerExcludedUrls: readonly string[] = ['resources/', 'assets/', 'auth/realms', 'idp/']; protected redirectUrl: RedirectionModel = null; onLogin = new ReplaySubject(1); onLogout = new ReplaySubject(1); - _peopleApi: PeopleApi; + private _peopleApi: PeopleApi; get peopleApi(): PeopleApi { this._peopleApi = this._peopleApi ?? new PeopleApi(this.alfrescoApi.getInstance()); return this._peopleApi; } - _profileApi: UserProfileApi; + private _profileApi: UserProfileApi; get profileApi(): UserProfileApi { this._profileApi = this._profileApi ?? new UserProfileApi(this.alfrescoApi.getInstance()); return this._profileApi; } - constructor( - protected alfrescoApi: AlfrescoApiService, - protected appConfig: AppConfigService, - protected cookie: CookieService, - private logService: LogService - ) {} - abstract readonly supportCodeFlow: boolean; abstract getToken(): string; abstract isLoggedIn(): boolean; diff --git a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts index 8490f16273..1fde7b564d 100644 --- a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts @@ -16,13 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { - AlfrescoApiService, - FormValues, - AppConfigService, - FormModel, - FormFieldOption -} from '@alfresco/adf-core'; +import { FormValues, FormModel, FormFieldOption } from '@alfresco/adf-core'; import { Observable, from, EMPTY } from 'rxjs'; import { expand, map, reduce, switchMap } from 'rxjs/operators'; import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model'; @@ -43,11 +37,8 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi return this._uploadApi; } - constructor( - apiService: AlfrescoApiService, - appConfigService: AppConfigService - ) { - super(apiService, appConfigService); + constructor() { + super(); } /** diff --git a/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.ts b/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.ts index 397ff94399..1008cbce64 100644 --- a/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.ts @@ -16,7 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; import { map } from 'rxjs/operators'; import { from, Observable } from 'rxjs'; import { BaseCloudService } from '../../services/base-cloud.service'; @@ -27,12 +26,6 @@ import { FormDefinitionSelectorCloudServiceInterface } from './form-definition-s providedIn: 'root' }) export class FormDefinitionSelectorCloudService extends BaseCloudService implements FormDefinitionSelectorCloudServiceInterface { - - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService) { - super(apiService, appConfigService); - } - /** * Get all forms of an app. * diff --git a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.ts b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.ts index 15c323ffd8..6822a694d9 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.ts @@ -16,7 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model'; import { Observable, throwError } from 'rxjs'; import { ProcessListCloudSortingModel } from '../models/process-list-sorting.model'; @@ -25,13 +24,6 @@ import { map } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ProcessListCloudService extends BaseCloudService { - - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService, - private logService: LogService) { - super(apiService, appConfigService); - } - private getProcess( callback: (queryUrl: string, queryParams: any) => Observable, defaultQueryUrl: string, diff --git a/lib/process-services-cloud/src/lib/process/process-list/services/process-task-list-cloud.service.ts b/lib/process-services-cloud/src/lib/process/process-list/services/process-task-list-cloud.service.ts index c43806390f..29939c85a1 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/services/process-task-list-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/services/process-task-list-cloud.service.ts @@ -16,7 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { Observable, throwError } from 'rxjs'; import { BaseCloudService } from '../../../services/base-cloud.service'; import { map } from 'rxjs/operators'; @@ -27,13 +26,6 @@ import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.mod @Injectable({ providedIn: 'root' }) export class ProcessTaskListCloudService extends BaseCloudService implements TaskListCloudServiceInterface { - - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService, - protected logService: LogService) { - super(apiService, appConfigService); - } - /** * Finds a task using an object with optional query properties. * diff --git a/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts b/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts index ecd603d71b..93b4a9d61b 100644 --- a/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { AlfrescoApiService, LogService, AppConfigService } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { Observable, Subject, throwError } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; @@ -29,15 +28,8 @@ import { ProcessCloudInterface } from './process-cloud.interface'; providedIn: 'root' }) export class ProcessCloudService extends BaseCloudService implements ProcessCloudInterface { - dataChangesDetected = new Subject(); - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService, - private logService: LogService) { - super(apiService, appConfigService); - } - /** * Gets details of a process instance. * diff --git a/lib/process-services-cloud/src/lib/process/start-process/services/start-process-cloud.service.ts b/lib/process-services-cloud/src/lib/process/start-process/services/start-process-cloud.service.ts index 8eb5faedb8..5e69e23e77 100755 --- a/lib/process-services-cloud/src/lib/process/start-process/services/start-process-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/process/start-process/services/start-process-cloud.service.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { Observable, throwError } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -29,13 +28,6 @@ import { TaskVariableCloud } from '../../../form/models/task-variable-cloud.mode providedIn: 'root' }) export class StartProcessCloudService extends BaseCloudService { - - constructor(apiService: AlfrescoApiService, - private logService: LogService, - appConfigService: AppConfigService) { - super(apiService, appConfigService); - } - /** * Gets the process definitions associated with an app. * diff --git a/lib/process-services-cloud/src/lib/services/base-cloud.service.ts b/lib/process-services-cloud/src/lib/services/base-cloud.service.ts index ed0b4df920..82f65de0de 100644 --- a/lib/process-services-cloud/src/lib/services/base-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/services/base-cloud.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; +import { Injectable, inject } from '@angular/core'; import { from, Observable } from 'rxjs'; export interface CallApiParams { @@ -33,7 +34,11 @@ export interface CallApiParams { responseType?: string; } +@Injectable() export class BaseCloudService { + protected apiService = inject(AlfrescoApiService); + protected appConfigService = inject(AppConfigService); + protected logService = inject(LogService); protected defaultParams: CallApiParams = { path: '', @@ -42,10 +47,6 @@ export class BaseCloudService { accepts: ['application/json'] }; - constructor( - protected apiService: AlfrescoApiService, - protected appConfigService: AppConfigService) {} - getBasePath(appName: string): string { return appName ? `${this.contextRoot}/${appName}` diff --git a/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts b/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts index 2978833a5c..2644e76132 100644 --- a/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts @@ -22,21 +22,16 @@ import { WebSocketLink } from '@apollo/client/link/ws'; import { onError } from '@apollo/client/link/error'; import { getMainDefinition } from '@apollo/client/utilities'; import { Injectable } from '@angular/core'; -import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; import { BaseCloudService } from './base-cloud.service'; @Injectable({ providedIn: 'root' }) export class NotificationCloudService extends BaseCloudService { - appsListening = []; - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService, - public apollo: Apollo, - private http: HttpLink) { - super(apiService, appConfigService); + constructor(public apollo: Apollo, private http: HttpLink) { + super(); } private get webSocketHost() { diff --git a/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.ts b/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.ts index 46c6c28e6c..3eb30630ce 100644 --- a/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.ts @@ -17,20 +17,11 @@ import { Injectable } from '@angular/core'; import { PreferenceCloudServiceInterface } from './preference-cloud.interface'; -import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { throwError, Observable } from 'rxjs'; import { BaseCloudService } from './base-cloud.service'; @Injectable({ providedIn: 'root' }) export class UserPreferenceCloudService extends BaseCloudService implements PreferenceCloudServiceInterface { - - constructor( - apiService: AlfrescoApiService, - appConfigService: AppConfigService, - private logService: LogService) { - super(apiService, appConfigService); - } - /** * Gets user preferences * diff --git a/lib/process-services-cloud/src/lib/task/services/start-task-cloud.service.ts b/lib/process-services-cloud/src/lib/task/services/start-task-cloud.service.ts index a6db9cfd3f..8244ffe9e4 100644 --- a/lib/process-services-cloud/src/lib/task/services/start-task-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/services/start-task-cloud.service.ts @@ -16,7 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model'; @@ -25,13 +24,6 @@ import { BaseCloudService } from '../../services/base-cloud.service'; @Injectable({ providedIn: 'root' }) export class StartTaskCloudService extends BaseCloudService { - - constructor( - apiService: AlfrescoApiService, - appConfigService: AppConfigService) { - super(apiService, appConfigService); - } - /** * @deprecated in 3.5.0, use TaskCloudService instead. * Creates a new standalone task. diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts index aa1c17634f..7a6c00e6cc 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts @@ -16,7 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, LogService, AppConfigService, CardViewArrayItem, TranslationService } from '@alfresco/adf-core'; +import { CardViewArrayItem, TranslationService } from '@alfresco/adf-core'; import { throwError, Observable, of, Subject } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { @@ -30,10 +30,7 @@ import { import { BaseCloudService } from '../../services/base-cloud.service'; import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; -import { - DEFAULT_TASK_PRIORITIES, - TaskPriorityOption -} from '../models/task.model'; +import { DEFAULT_TASK_PRIORITIES, TaskPriorityOption } from '../models/task.model'; import { TaskCloudServiceInterface } from './task-cloud.service.interface'; import { IdentityUserService } from '../../people/services/identity-user.service'; @@ -45,13 +42,10 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi dataChangesDetected$ = new Subject(); constructor( - apiService: AlfrescoApiService, - appConfigService: AppConfigService, - private logService: LogService, private translateService: TranslationService, private identityUserService: IdentityUserService ) { - super(apiService, appConfigService); + super(); } /** diff --git a/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts b/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts index 626a1e470d..5f134d84a8 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; import { Injectable, Inject } from '@angular/core'; import { Observable, of, BehaviorSubject, throwError } from 'rxjs'; import { TaskFilterCloudModel } from '../models/filter-cloud.model'; @@ -55,10 +54,8 @@ export class TaskFilterCloudService extends BaseCloudService { private identityUserService: IdentityUserService, @Inject(TASK_FILTERS_SERVICE_TOKEN) public preferenceService: PreferenceCloudServiceInterface, - apiService: AlfrescoApiService, - appConfigService: AppConfigService, private notificationCloudService: NotificationCloudService) { - super(apiService, appConfigService); + super(); this.filtersSubject = new BehaviorSubject([]); this.filters$ = this.filtersSubject.asObservable(); } diff --git a/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.ts b/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.ts index 0157831085..fc2c2c3c9e 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.ts @@ -16,7 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { ServiceTaskQueryCloudRequestModel, ServiceTaskIntegrationContextCloudModel } from '../models/service-task-cloud.model'; import { Observable, throwError } from 'rxjs'; import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.model'; @@ -25,13 +24,6 @@ import { map } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ServiceTaskListCloudService extends BaseCloudService { - - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService, - private logService: LogService) { - super(apiService, appConfigService); - } - /** * Finds a task using an object with optional query properties. * diff --git a/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.ts b/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.ts index 99573e3da2..68686a274e 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.ts @@ -16,7 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { TaskQueryCloudRequestModel } from '../../../models/filter-cloud-model'; import { Observable, throwError } from 'rxjs'; import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.model'; @@ -27,13 +26,6 @@ import { TaskListCloudServiceInterface } from '../../../services/task-list-cloud @Injectable({ providedIn: 'root' }) export class TaskListCloudService extends BaseCloudService implements TaskListCloudServiceInterface { - - constructor(apiService: AlfrescoApiService, - appConfigService: AppConfigService, - protected logService: LogService) { - super(apiService, appConfigService); - } - /** * Finds a task using an object with optional query properties. * diff --git a/lib/process-services/src/lib/form/form.component.ts b/lib/process-services/src/lib/form/form.component.ts index 023930e5a1..b184965a6f 100644 --- a/lib/process-services/src/lib/form/form.component.ts +++ b/lib/process-services/src/lib/form/form.component.ts @@ -24,7 +24,8 @@ import { SimpleChanges, OnInit, OnDestroy, - OnChanges + OnChanges, + inject } from '@angular/core'; import { WidgetVisibilityService, @@ -57,6 +58,14 @@ import { FormDefinitionModel } from './model/form-definition.model'; encapsulation: ViewEncapsulation.None }) export class FormComponent extends FormBaseComponent implements OnInit, OnDestroy, OnChanges { + protected formService = inject(FormService); + protected taskFormService = inject(TaskFormService); + protected taskService = inject(TaskService); + protected editorService = inject(EditorService); + protected modelService = inject(ModelService); + protected visibilityService = inject(WidgetVisibilityService); + protected ecmModelService = inject(EcmModelService); + protected nodeService = inject(NodesApiService); /** Underlying form model instance. */ @Input() @@ -92,36 +101,29 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnDestro /** Emitted when the form is submitted with the `Save` or custom outcomes. */ @Output() - formSaved: EventEmitter = new EventEmitter(); + formSaved = new EventEmitter(); /** Emitted when the form is submitted with the `Complete` outcome. */ @Output() - formCompleted: EventEmitter = new EventEmitter(); + formCompleted = new EventEmitter(); /** Emitted when form content is clicked. */ @Output() - formContentClicked: EventEmitter = new EventEmitter(); + formContentClicked = new EventEmitter(); /** Emitted when the form is loaded or reloaded. */ @Output() - formLoaded: EventEmitter = new EventEmitter(); + formLoaded = new EventEmitter(); /** Emitted when form values are refreshed due to a data property change. */ @Output() - formDataRefreshed: EventEmitter = new EventEmitter(); + formDataRefreshed = new EventEmitter(); debugMode: boolean = false; protected onDestroy$ = new Subject(); - constructor(protected formService: FormService, - protected taskFormService: TaskFormService, - protected taskService: TaskService, - protected editorService: EditorService, - protected modelService: ModelService, - protected visibilityService: WidgetVisibilityService, - protected ecmModelService: EcmModelService, - protected nodeService: NodesApiService) { + constructor() { super(); } diff --git a/lib/process-services/src/lib/form/start-form.component.ts b/lib/process-services/src/lib/form/start-form.component.ts index f086e8fd2f..d6449d3580 100644 --- a/lib/process-services/src/lib/form/start-form.component.ts +++ b/lib/process-services/src/lib/form/start-form.component.ts @@ -26,15 +26,12 @@ import { SimpleChanges, ViewChild, ViewEncapsulation, - OnDestroy + OnDestroy, + inject } from '@angular/core'; import { FormComponent } from './form.component'; -import { ContentLinkModel, FormService, WidgetVisibilityService, FormOutcomeModel } from '@alfresco/adf-core'; +import { ContentLinkModel, FormOutcomeModel } from '@alfresco/adf-core'; import { ProcessService } from '../process-list/services/process.service'; -import { EditorService } from './services/editor.service'; -import { ModelService } from './services/model.service'; -import { TaskFormService } from './services/task-form.service'; -import { TaskService } from './services/task.service'; @Component({ selector: 'adf-start-form', @@ -43,6 +40,7 @@ import { TaskService } from './services/task.service'; encapsulation: ViewEncapsulation.None }) export class StartFormComponent extends FormComponent implements OnChanges, OnInit, OnDestroy { + public processService = inject(ProcessService); /** Definition ID of the process to start, this parameter can not be use in combination with processId */ @Input() @@ -66,22 +64,17 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn /** Emitted when the user clicks one of the outcome buttons that completes the form. */ @Output() - outcomeClick: EventEmitter = new EventEmitter(); + outcomeClick = new EventEmitter(); /** Emitted when a field of the form is clicked. */ @Output() - formContentClicked: EventEmitter = new EventEmitter(); + formContentClicked = new EventEmitter(); @ViewChild('outcomesContainer') outcomesContainer: ElementRef = null; - constructor(public processService: ProcessService, - taskFormService: TaskFormService, - taskService: TaskService, - editorService: EditorService, - modelService: ModelService, - formService: FormService, visibilityService: WidgetVisibilityService) { - super(formService, taskFormService, taskService, editorService, modelService, visibilityService, null, null); + constructor() { + super(); this.showTitle = false; }