mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Improve compatibility (#7214)
* refactor content * refactor core * refactor rest * fix lint * fix * lint * lint * fix * fix * fix
This commit is contained in:
@@ -38,7 +38,12 @@ export class LibraryFavoriteDirective implements OnChanges {
|
||||
@Output() error = new EventEmitter<any>();
|
||||
|
||||
private targetLibrary = null;
|
||||
private favoritesApi: FavoritesApi;
|
||||
|
||||
_favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.alfrescoApiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
@@ -58,7 +63,6 @@ export class LibraryFavoriteDirective implements OnChanges {
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
this.favoritesApi = new FavoritesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
|
@@ -48,7 +48,11 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
|
||||
isJoinRequested: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
private sitesApi: SitesApi;
|
||||
_sitesApi: SitesApi;
|
||||
get sitesApi(): SitesApi {
|
||||
this._sitesApi = this._sitesApi ?? new SitesApi(this.alfrescoApiService.getInstance());
|
||||
return this._sitesApi;
|
||||
}
|
||||
|
||||
/** Site for which to toggle the membership request. */
|
||||
@Input('adf-library-membership')
|
||||
@@ -75,7 +79,6 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
private sitesService: SitesService,
|
||||
private versionCompatibilityService: VersionCompatibilityService
|
||||
) {
|
||||
this.sitesApi = new SitesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@@ -62,8 +62,17 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
@Output()
|
||||
delete: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
private trashcanApi: TrashcanApi;
|
||||
private nodesApi: NodesApi;
|
||||
_trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.alfrescoApiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
@@ -73,8 +82,6 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
private translation: TranslationService,
|
||||
private elementRef: ElementRef) {
|
||||
this.trashcanApi = new TrashcanApi(this.alfrescoApiService.getInstance());
|
||||
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
|
@@ -31,7 +31,11 @@ import { DownloadService } from '../services/download.service';
|
||||
})
|
||||
export class NodeDownloadDirective {
|
||||
|
||||
private contentApi: ContentApi;
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
/** Nodes to download. */
|
||||
@Input('adfNodeDownload')
|
||||
@@ -50,7 +54,6 @@ export class NodeDownloadDirective {
|
||||
private apiService: AlfrescoApiService,
|
||||
private downloadService: DownloadService,
|
||||
private dialog: MatDialog) {
|
||||
this.contentApi = new ContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -30,7 +30,11 @@ import { catchError, map } from 'rxjs/operators';
|
||||
export class NodeFavoriteDirective implements OnChanges {
|
||||
favorites: any[] = [];
|
||||
|
||||
private favoritesApi: FavoritesApi;
|
||||
_favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.alfrescoApiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
|
||||
/** Array of nodes to toggle as favorites. */
|
||||
@Input('adf-node-favorite')
|
||||
@@ -48,7 +52,6 @@ export class NodeFavoriteDirective implements OnChanges {
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
this.favoritesApi = new FavoritesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
|
@@ -35,7 +35,12 @@ export class RestoreMessageModel {
|
||||
})
|
||||
export class NodeRestoreDirective {
|
||||
private readonly restoreProcessStatus;
|
||||
private trashcanApi: TrashcanApi;
|
||||
|
||||
_trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.alfrescoApiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
|
||||
/** Array of deleted nodes to restore. */
|
||||
@Input('adf-restore')
|
||||
@@ -53,7 +58,6 @@ export class NodeRestoreDirective {
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
private translation: TranslationService) {
|
||||
this.restoreProcessStatus = this.processStatus();
|
||||
this.trashcanApi = new TrashcanApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
private recover(selection: any) {
|
||||
|
@@ -38,15 +38,21 @@ export class ActivitiContentService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
contentApi: ActivitiContentApi;
|
||||
_integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
get integrationAlfrescoOnPremiseApi(): IntegrationAlfrescoOnPremiseApi {
|
||||
this._integrationAlfrescoOnPremiseApi = this._integrationAlfrescoOnPremiseApi ?? new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
return this._integrationAlfrescoOnPremiseApi;
|
||||
}
|
||||
|
||||
_contentApi: ActivitiContentApi;
|
||||
get contentApi(): ActivitiContentApi {
|
||||
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private sitesService: SitesService) {
|
||||
|
||||
this.integrationAlfrescoOnPremiseApi = new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
this.contentApi = new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -32,11 +32,14 @@ export class EcmModelService {
|
||||
public static MODEL_NAME: string = 'activitiFormsModel';
|
||||
public static TYPE_MODEL: string = 'cm:folder';
|
||||
|
||||
private customModelApi: CustomModelApi;
|
||||
_customModelApi: CustomModelApi;
|
||||
get customModelApi(): CustomModelApi {
|
||||
this._customModelApi = this._customModelApi ?? new CustomModelApi(this.apiService.getInstance());
|
||||
return this._customModelApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.customModelApi = new CustomModelApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
||||
|
@@ -52,15 +52,59 @@ export class FormService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
taskApi: TasksApi;
|
||||
taskFormsApi: TaskFormsApi;
|
||||
modelsApi: ModelsApi;
|
||||
editorApi: FormModelsApi;
|
||||
processDefinitionsApi: ProcessDefinitionsApi;
|
||||
processInstancesApi: ProcessInstancesApi;
|
||||
processInstanceVariablesApi: ProcessInstanceVariablesApi;
|
||||
groupsApi: ActivitiGroupsApi;
|
||||
usersApi: UsersApi;
|
||||
_taskFormsApi: TaskFormsApi;
|
||||
get taskFormsApi(): TaskFormsApi {
|
||||
this._taskFormsApi = this._taskFormsApi ?? new TaskFormsApi(this.apiService.getInstance());
|
||||
return this._taskFormsApi;
|
||||
}
|
||||
|
||||
_taskApi: TasksApi;
|
||||
get taskApi(): TasksApi {
|
||||
this._taskApi = this._taskApi ?? new TasksApi(this.apiService.getInstance());
|
||||
return this._taskApi;
|
||||
}
|
||||
|
||||
_modelsApi: ModelsApi;
|
||||
get modelsApi(): ModelsApi {
|
||||
this._modelsApi = this._modelsApi ?? new ModelsApi(this.apiService.getInstance());
|
||||
return this._modelsApi;
|
||||
}
|
||||
|
||||
_editorApi: FormModelsApi;
|
||||
get editorApi(): FormModelsApi {
|
||||
this._editorApi = this._editorApi ?? new FormModelsApi(this.apiService.getInstance());
|
||||
return this._editorApi;
|
||||
}
|
||||
|
||||
_processDefinitionsApi: ProcessDefinitionsApi;
|
||||
get processDefinitionsApi(): ProcessDefinitionsApi {
|
||||
this._processDefinitionsApi = this._processDefinitionsApi ?? new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
return this._processDefinitionsApi;
|
||||
}
|
||||
|
||||
_processInstanceVariablesApi: ProcessInstanceVariablesApi;
|
||||
get processInstanceVariablesApi(): ProcessInstanceVariablesApi {
|
||||
this._processInstanceVariablesApi = this._processInstanceVariablesApi ?? new ProcessInstanceVariablesApi(this.apiService.getInstance());
|
||||
return this._processInstanceVariablesApi;
|
||||
}
|
||||
|
||||
_processInstancesApi: ProcessInstancesApi;
|
||||
get processInstancesApi(): ProcessInstancesApi {
|
||||
this._processInstancesApi = this._processInstancesApi ?? new ProcessInstancesApi(this.apiService.getInstance());
|
||||
return this._processInstancesApi;
|
||||
}
|
||||
|
||||
_groupsApi: ActivitiGroupsApi;
|
||||
get groupsApi(): ActivitiGroupsApi {
|
||||
this._groupsApi = this._groupsApi ?? new ActivitiGroupsApi(this.apiService.getInstance());
|
||||
return this._groupsApi;
|
||||
}
|
||||
|
||||
_usersApi: UsersApi;
|
||||
get usersApi(): UsersApi {
|
||||
this._usersApi = this._usersApi ?? new UsersApi(this.apiService.getInstance());
|
||||
return this._usersApi;
|
||||
}
|
||||
|
||||
formLoaded = new Subject<FormEvent>();
|
||||
formDataRefreshed = new Subject<FormEvent>();
|
||||
@@ -83,16 +127,6 @@ export class FormService {
|
||||
constructor(private ecmModelService: EcmModelService,
|
||||
private apiService: AlfrescoApiService,
|
||||
protected logService: LogService) {
|
||||
|
||||
this.taskApi = new TasksApi(this.apiService.getInstance());
|
||||
this.modelsApi = new ModelsApi(this.apiService.getInstance());
|
||||
this.editorApi = new FormModelsApi(this.apiService.getInstance());
|
||||
this.processDefinitionsApi = new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
this.processInstanceVariablesApi = new ProcessInstanceVariablesApi(this.apiService.getInstance());
|
||||
this.processInstancesApi = new ProcessInstancesApi(this.apiService.getInstance());
|
||||
this.usersApi = new UsersApi(this.apiService.getInstance());
|
||||
this.groupsApi = new ActivitiGroupsApi(this.apiService.getInstance());
|
||||
this.taskFormsApi = new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -30,11 +30,14 @@ export class ProcessContentService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private contentApi: ActivitiContentApi;
|
||||
_contentApi: ActivitiContentApi;
|
||||
get contentApi(): ActivitiContentApi {
|
||||
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.contentApi = new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -37,13 +37,17 @@ import { TaskFormsApi } from '@alfresco/js-api';
|
||||
})
|
||||
export class WidgetVisibilityService {
|
||||
|
||||
private taskFormsApi: TaskFormsApi;
|
||||
_taskFormsApi: TaskFormsApi;
|
||||
get taskFormsApi(): TaskFormsApi {
|
||||
this._taskFormsApi = this._taskFormsApi ?? new TaskFormsApi(this.apiService.getInstance());
|
||||
return this._taskFormsApi;
|
||||
}
|
||||
|
||||
private processVarList: TaskProcessVariableModel[];
|
||||
private form: FormModel;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.taskFormsApi = new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
public refreshVisibility(form: FormModel, processVarList?: TaskProcessVariableModel[]) {
|
||||
|
@@ -27,11 +27,14 @@ import { map, catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class AppsProcessService {
|
||||
|
||||
appsApi: RuntimeAppDefinitionsApi;
|
||||
_appsApi: RuntimeAppDefinitionsApi;
|
||||
get appsApi(): RuntimeAppDefinitionsApi {
|
||||
this._appsApi = this._appsApi ?? new RuntimeAppDefinitionsApi(this.apiService.getInstance());
|
||||
return this._appsApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.appsApi = new RuntimeAppDefinitionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -48,7 +48,11 @@ export class AuthenticationService {
|
||||
*/
|
||||
onLogout: ReplaySubject<any> = new ReplaySubject<any>(1);
|
||||
|
||||
private profileApi: UserProfileApi;
|
||||
_profileApi: UserProfileApi;
|
||||
get profileApi(): UserProfileApi {
|
||||
this._profileApi = this._profileApi ?? new UserProfileApi(this.alfrescoApi.getInstance());
|
||||
return this._profileApi;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private appConfig: AppConfigService,
|
||||
@@ -58,7 +62,6 @@ export class AuthenticationService {
|
||||
private logService: LogService) {
|
||||
this.alfrescoApi.alfrescoApiInitialized.subscribe(() => {
|
||||
this.alfrescoApi.getInstance().reply('logged-in', () => {
|
||||
this.profileApi = new UserProfileApi(alfrescoApi.getInstance());
|
||||
this.onLogin.next();
|
||||
});
|
||||
});
|
||||
|
@@ -33,11 +33,14 @@ import { UserProfileApi, UserRepresentation } from '@alfresco/js-api';
|
||||
})
|
||||
export class BpmUserService {
|
||||
|
||||
private profileApi: UserProfileApi;
|
||||
_profileApi: UserProfileApi;
|
||||
get profileApi(): UserProfileApi {
|
||||
this._profileApi = this._profileApi ?? new UserProfileApi(this.apiService.getInstance());
|
||||
return this._profileApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.profileApi = new UserProfileApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,11 +28,14 @@ import { CommentEntry, CommentsApi } from '@alfresco/js-api';
|
||||
})
|
||||
export class CommentContentService {
|
||||
|
||||
private commentsApi: CommentsApi;
|
||||
_commentsApi: CommentsApi;
|
||||
get commentsApi(): CommentsApi {
|
||||
this._commentsApi = this._commentsApi ?? new CommentsApi(this.apiService.getInstance());
|
||||
return this._commentsApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.commentsApi = new CommentsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +45,7 @@ export class CommentContentService {
|
||||
* @returns Details of the comment added
|
||||
*/
|
||||
addNodeComment(nodeId: string, message: string): Observable<CommentModel> {
|
||||
return from(this.commentsApi.createComment(nodeId, {content: message}))
|
||||
return from(this.commentsApi.createComment(nodeId, { content: message }))
|
||||
.pipe(
|
||||
map((response: CommentEntry) => {
|
||||
return new CommentModel({
|
||||
|
@@ -29,11 +29,14 @@ import { ActivitiCommentsApi } from '@alfresco/js-api';
|
||||
})
|
||||
export class CommentProcessService {
|
||||
|
||||
private commentsApi: ActivitiCommentsApi;
|
||||
_commentsApi: ActivitiCommentsApi;
|
||||
get commentsApi(): ActivitiCommentsApi {
|
||||
this._commentsApi = this._commentsApi ?? new ActivitiCommentsApi(this.apiService.getInstance());
|
||||
return this._commentsApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.commentsApi = new ActivitiCommentsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -38,8 +38,17 @@ export class ContentService {
|
||||
folderCreate: Subject<MinimalNode> = new Subject<MinimalNode>();
|
||||
folderEdit: Subject<MinimalNode> = new Subject<MinimalNode>();
|
||||
|
||||
private contentApi: ContentApi;
|
||||
private nodesApi: NodesApi;
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(public authService: AuthenticationService,
|
||||
public apiService: AlfrescoApiService,
|
||||
@@ -47,8 +56,6 @@ export class ContentService {
|
||||
private sanitizer: DomSanitizer,
|
||||
private downloadService: DownloadService,
|
||||
private thumbnailService: ThumbnailService) {
|
||||
this.contentApi = new ContentApi(apiService.getInstance());
|
||||
this.nodesApi = new NodesApi(apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,15 +28,22 @@ import { catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class DeletedNodesApiService {
|
||||
|
||||
nodesApi: NodesApi;
|
||||
trashcanApi: TrashcanApi;
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
_trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.apiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService
|
||||
) {
|
||||
this.nodesApi = new NodesApi(this.apiService.getInstance());
|
||||
this.trashcanApi = new TrashcanApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,11 +27,14 @@ import { catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class DownloadZipService {
|
||||
|
||||
downloadsApi: DownloadsApi;
|
||||
_downloadsApi: DownloadsApi;
|
||||
get downloadsApi(): DownloadsApi {
|
||||
this._downloadsApi = this._downloadsApi ?? new DownloadsApi(this.apiService.getInstance());
|
||||
return this._downloadsApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.downloadsApi = new DownloadsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,16 +28,16 @@ import { PeopleApi } from '@alfresco/js-api';
|
||||
})
|
||||
export class EcmUserService {
|
||||
|
||||
private _peopleApi: PeopleApi;
|
||||
_peopleApi: PeopleApi;
|
||||
get peopleApi(): PeopleApi {
|
||||
this._peopleApi = this._peopleApi ?? new PeopleApi(this.apiService.getInstance());
|
||||
return this._peopleApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private contentService: ContentService) {
|
||||
}
|
||||
|
||||
get peopleApi(): PeopleApi {
|
||||
return this._peopleApi || (this._peopleApi = new PeopleApi(this.apiService.getInstance()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about a user identified by their username.
|
||||
* @param userName Target username
|
||||
|
@@ -19,8 +19,7 @@ import { Injectable } from '@angular/core';
|
||||
import {
|
||||
AlfrescoApiCompatibility,
|
||||
ContentApi,
|
||||
Core,
|
||||
Node
|
||||
Node, NodesApi
|
||||
} from '@alfresco/js-api';
|
||||
import { ReplaySubject, Subject } from 'rxjs';
|
||||
|
||||
@@ -37,6 +36,7 @@ export class ExternalAlfrescoApiService {
|
||||
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
|
||||
|
||||
protected alfrescoApi: AlfrescoApiCompatibility;
|
||||
_nodesApi: NodesApi;
|
||||
|
||||
getInstance(): AlfrescoApiCompatibility {
|
||||
return this.alfrescoApi;
|
||||
@@ -46,8 +46,9 @@ export class ExternalAlfrescoApiService {
|
||||
return this.getInstance().content;
|
||||
}
|
||||
|
||||
get nodesApi(): Core.NodesApi {
|
||||
return this.getInstance().nodes;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
init(ecmHost: string, contextRoot: string) {
|
||||
|
@@ -27,7 +27,11 @@ import { catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class FavoritesApiService {
|
||||
|
||||
private favoritesApi: FavoritesApi;
|
||||
_favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.apiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
|
||||
static remapEntry({ entry }: any): any {
|
||||
entry.properties = {
|
||||
@@ -42,7 +46,6 @@ export class FavoritesApiService {
|
||||
private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService
|
||||
) {
|
||||
this.favoritesApi = new FavoritesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
remapFavoritesData(data: FavoritePaging = {}): NodePaging {
|
||||
|
@@ -28,13 +28,20 @@ import { NodeMetadata } from '../models/node-metadata.model';
|
||||
})
|
||||
export class NodesApiService {
|
||||
|
||||
private nodesApi: NodesApi;
|
||||
private trashcanApi: TrashcanApi;
|
||||
_trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.apiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService) {
|
||||
this.nodesApi = new NodesApi(this.apiService.getInstance());
|
||||
this.trashcanApi = new TrashcanApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
private getEntryFromEntity(entity: NodeEntry) {
|
||||
|
@@ -50,10 +50,13 @@ export class PeopleContentService {
|
||||
private hasContentAdminRole: boolean = false;
|
||||
hasCheckedIsContentAdmin: boolean = false;
|
||||
|
||||
private peopleApi: PeopleApi;
|
||||
_peopleApi: PeopleApi;
|
||||
get peopleApi(): PeopleApi {
|
||||
this._peopleApi = this._peopleApi ?? new PeopleApi(this.apiService.getInstance());
|
||||
return this._peopleApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
this.peopleApi = new PeopleApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +127,7 @@ export class PeopleContentService {
|
||||
}
|
||||
|
||||
private buildOrderArray(sorting: PeopleContentSortingModel): string[] {
|
||||
return sorting?.orderBy && sorting?.direction ? [ `${sorting.orderBy} ${sorting.direction.toUpperCase()}` ] : [];
|
||||
return sorting?.orderBy && sorting?.direction ? [`${sorting.orderBy} ${sorting.direction.toUpperCase()}`] : [];
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
|
@@ -21,20 +21,31 @@ import { UserProcessModel } from '../models/user-process.model';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { LogService } from './log.service';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { TaskActionsApi, UsersApi, ResultListDataRepresentationLightUserRepresentation } from '@alfresco/js-api';
|
||||
import {
|
||||
TaskActionsApi,
|
||||
UsersApi,
|
||||
ResultListDataRepresentationLightUserRepresentation
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PeopleProcessService {
|
||||
|
||||
private taskActionsApi: TaskActionsApi;
|
||||
private userApi: UsersApi;
|
||||
_taskActionsApi: TaskActionsApi;
|
||||
get taskActionsApi(): TaskActionsApi {
|
||||
this._taskActionsApi = this._taskActionsApi ?? new TaskActionsApi(this.apiService.getInstance());
|
||||
return this._taskActionsApi;
|
||||
}
|
||||
|
||||
_userApi: UsersApi;
|
||||
get userApi(): UsersApi {
|
||||
this._userApi = this._userApi ?? new UsersApi(this.apiService.getInstance());
|
||||
return this._userApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.taskActionsApi = new TaskActionsApi(this.apiService.getInstance());
|
||||
this.userApi = new UsersApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -26,12 +26,19 @@ import { concatMap, switchMap, takeWhile, map } from 'rxjs/operators';
|
||||
})
|
||||
export class RenditionsService {
|
||||
|
||||
private renditionsApi: RenditionsApi;
|
||||
private contentApi: ContentApi;
|
||||
_renditionsApi: RenditionsApi;
|
||||
get renditionsApi(): RenditionsApi {
|
||||
this._renditionsApi = this._renditionsApi ?? new RenditionsApi(this.apiService.getInstance());
|
||||
return this._renditionsApi;
|
||||
}
|
||||
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService) {
|
||||
this.renditionsApi = new RenditionsApi(this.apiService.getInstance());
|
||||
this.contentApi = new ContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,13 +27,21 @@ import { SearchConfigurationService } from './search-configuration.service';
|
||||
export class SearchService {
|
||||
|
||||
dataLoaded: Subject<ResultSetPaging> = new Subject();
|
||||
queriesApi: QueriesApi;
|
||||
searchApi: SearchApi;
|
||||
|
||||
_queriesApi: QueriesApi;
|
||||
get queriesApi(): QueriesApi {
|
||||
this._queriesApi = this._queriesApi ?? new QueriesApi(this.apiService.getInstance());
|
||||
return this._queriesApi;
|
||||
}
|
||||
|
||||
_searchApi: SearchApi;
|
||||
get searchApi(): SearchApi {
|
||||
this._searchApi = this._searchApi ?? new SearchApi(this.apiService.getInstance());
|
||||
return this._searchApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private searchConfigurationService: SearchConfigurationService) {
|
||||
this.queriesApi = new QueriesApi(this.apiService.getInstance());
|
||||
this.searchApi = new SearchApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,11 +28,15 @@ import { catchError } from 'rxjs/operators';
|
||||
export class SharedLinksApiService {
|
||||
|
||||
error = new Subject<{ statusCode: number, message: string }>();
|
||||
private sharedLinksApi: SharedlinksApi;
|
||||
|
||||
_sharedLinksApi: SharedlinksApi;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
this._sharedLinksApi = this._sharedLinksApi ?? new SharedlinksApi(this.apiService.getInstance());
|
||||
return this._sharedLinksApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService) {
|
||||
this.sharedLinksApi = new SharedlinksApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,10 +40,13 @@ import { LogService } from './log.service';
|
||||
})
|
||||
export class SitesService {
|
||||
|
||||
private sitesApi: SitesApi;
|
||||
_sitesApi: SitesApi;
|
||||
get sitesApi(): SitesApi {
|
||||
this._sitesApi = this._sitesApi ?? new SitesApi(this.apiService.getInstance());
|
||||
return this._sitesApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
this.sitesApi = new SitesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -164,10 +164,13 @@ export class ThumbnailService {
|
||||
'task': './assets/images/task.svg'
|
||||
};
|
||||
|
||||
private contentApi: ContentApi;
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(protected apiService: AlfrescoApiService, matIconRegistry: MatIconRegistry, sanitizer: DomSanitizer) {
|
||||
this.contentApi = new ContentApi(apiService.getInstance());
|
||||
Object.keys(this.mimeTypeIcons).forEach((key) => {
|
||||
const url = sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key]);
|
||||
|
||||
|
@@ -63,9 +63,23 @@ export class UploadService {
|
||||
fileUploadDeleted: Subject<FileUploadDeleteEvent> = new Subject<FileUploadDeleteEvent>();
|
||||
fileDeleted: Subject<string> = new Subject<string>();
|
||||
|
||||
private uploadApi: UploadApi;
|
||||
private nodesApi: NodesApi;
|
||||
private versionsApi: VersionsApi;
|
||||
_uploadApi: UploadApi;
|
||||
get uploadApi(): UploadApi {
|
||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
||||
return this._uploadApi;
|
||||
}
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
_versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
|
||||
constructor(
|
||||
protected apiService: AlfrescoApiService,
|
||||
@@ -76,10 +90,6 @@ export class UploadService {
|
||||
.subscribe(({ status }) => {
|
||||
this.isThumbnailGenerationEnabled = status.isThumbnailGenerationEnabled;
|
||||
});
|
||||
|
||||
this.uploadApi = new UploadApi(apiService.getInstance());
|
||||
this.nodesApi = new NodesApi(apiService.getInstance());
|
||||
this.versionsApi = new VersionsApi(apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -206,11 +206,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
|
||||
/** Emitted when user clicks 'Navigate Before' ("<") button. */
|
||||
@Output()
|
||||
navigateBefore = new EventEmitter<MouseEvent|KeyboardEvent>();
|
||||
navigateBefore = new EventEmitter<MouseEvent | KeyboardEvent>();
|
||||
|
||||
/** Emitted when user clicks 'Navigate Next' (">") button. */
|
||||
@Output()
|
||||
navigateNext = new EventEmitter<MouseEvent|KeyboardEvent>();
|
||||
navigateNext = new EventEmitter<MouseEvent | KeyboardEvent>();
|
||||
|
||||
/** Emitted when the shared link used is not valid. */
|
||||
@Output()
|
||||
@@ -257,10 +257,29 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
private shouldCloseViewer = true;
|
||||
private keyDown$ = fromEvent<KeyboardEvent>(document, 'keydown');
|
||||
|
||||
private sharedLinksApi: SharedlinksApi;
|
||||
private versionsApi: VersionsApi;
|
||||
private nodesApi: NodesApi;
|
||||
private contentApi: ContentApi;
|
||||
_sharedLinksApi: SharedlinksApi;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
this._sharedLinksApi = this._sharedLinksApi ?? new SharedlinksApi(this.apiService.getInstance());
|
||||
return this._sharedLinksApi;
|
||||
}
|
||||
|
||||
_versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private viewUtilService: ViewUtilService,
|
||||
@@ -270,10 +289,6 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
private uploadService: UploadService,
|
||||
private el: ElementRef,
|
||||
public dialog: MatDialog) {
|
||||
this.sharedLinksApi = new SharedlinksApi(this.apiService.getInstance());
|
||||
this.versionsApi = new VersionsApi(this.apiService.getInstance());
|
||||
this.nodesApi = new NodesApi(this.apiService.getInstance());
|
||||
this.contentApi = new ContentApi(this.apiService.getInstance());
|
||||
viewUtilService.maxRetries = this.maxRetries;
|
||||
}
|
||||
|
||||
@@ -563,11 +578,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
this.close();
|
||||
}
|
||||
|
||||
onNavigateBeforeClick(event: MouseEvent|KeyboardEvent) {
|
||||
onNavigateBeforeClick(event: MouseEvent | KeyboardEvent) {
|
||||
this.navigateBefore.next(event);
|
||||
}
|
||||
|
||||
onNavigateNextClick(event: MouseEvent|KeyboardEvent) {
|
||||
onNavigateNextClick(event: MouseEvent | KeyboardEvent) {
|
||||
this.navigateNext.next(event);
|
||||
}
|
||||
|
||||
@@ -754,7 +769,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
skipWhile(() => !this.overlayMode),
|
||||
filter((e: KeyboardEvent) => e.keyCode === 27),
|
||||
takeUntil(this.onDestroy$)
|
||||
).subscribe( (event: KeyboardEvent) => {
|
||||
).subscribe((event: KeyboardEvent) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (this.shouldCloseViewer) {
|
||||
|
@@ -74,16 +74,27 @@ export class ViewUtilService {
|
||||
viewerTypeChange: Subject<string> = new Subject<string>();
|
||||
urlFileContentChange: Subject<string> = new Subject<string>();
|
||||
|
||||
renditionsApi: RenditionsApi;
|
||||
contentApi: ContentApi;
|
||||
versionsApi: VersionsApi;
|
||||
_renditionsApi: RenditionsApi;
|
||||
get renditionsApi(): RenditionsApi {
|
||||
this._renditionsApi = this._renditionsApi ?? new RenditionsApi(this.apiService.getInstance());
|
||||
return this._renditionsApi;
|
||||
}
|
||||
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
_versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private translateService: TranslationService) {
|
||||
this.renditionsApi = new RenditionsApi(this.apiService.getInstance());
|
||||
this.contentApi = new ContentApi(this.apiService.getInstance());
|
||||
this.versionsApi = new VersionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user