mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Optimise imports using inject function (#8557)
* optimise AuthGuard * optimise UploadBase * optimise BaseAuthenticationService * optimise FormComponent * optimise BaseCloudService * optimise card view
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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.
|
||||
*
|
||||
|
@@ -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<any>,
|
||||
defaultQueryUrl: string,
|
||||
|
@@ -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.
|
||||
*
|
||||
|
@@ -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<ProcessInstanceCloud>();
|
||||
|
||||
constructor(apiService: AlfrescoApiService,
|
||||
appConfigService: AppConfigService,
|
||||
private logService: LogService) {
|
||||
super(apiService, appConfigService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets details of a process instance.
|
||||
*
|
||||
|
@@ -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.
|
||||
*
|
||||
|
@@ -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}`
|
||||
|
@@ -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() {
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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.
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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.
|
||||
*
|
||||
|
@@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user