mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
refactor content
This commit is contained in:
parent
8c8e388fa0
commit
b8e7e79b26
@ -22,20 +22,21 @@ import { from, Observable, of, Subject, zip } from 'rxjs';
|
||||
import { AspectListDialogComponentData } from './aspect-list-dialog-data.interface';
|
||||
import { AspectListDialogComponent } from './aspect-list-dialog.component';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api';
|
||||
import { AspectEntry, AspectPaging, AspectsApi, NodesApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AspectListService {
|
||||
|
||||
private aspectsApi: AspectsApi;
|
||||
get aspectsApi(): AspectsApi {
|
||||
return new AspectsApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
private appConfigService: AppConfigService,
|
||||
private dialog: MatDialog,
|
||||
private logService: LogService) {
|
||||
this.aspectsApi = new AspectsApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
getAspects(): Observable<AspectEntry[]> {
|
||||
|
@ -18,7 +18,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
|
||||
import { AuditApi, AuditAppPaging, AuditAppEntry, AuditApp, AuditBodyUpdate, AuditEntryPaging, AuditEntryEntry } from '@alfresco/js-api';
|
||||
import {
|
||||
AuditApi,
|
||||
AuditAppPaging,
|
||||
AuditAppEntry,
|
||||
AuditApp,
|
||||
AuditBodyUpdate,
|
||||
AuditEntryPaging,
|
||||
AuditEntryEntry,
|
||||
AspectsApi
|
||||
} from '@alfresco/js-api';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@ -26,10 +35,11 @@ import { catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class AuditService {
|
||||
|
||||
auditApi: AuditApi;
|
||||
get auditApi(): AuditApi {
|
||||
return new AuditApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
this.auditApi = new AuditApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
getAuditApps(opts?: any): Observable<AuditAppPaging> {
|
||||
|
@ -26,10 +26,12 @@ import { ClassesApi } from '@alfresco/js-api';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PropertyDescriptorsService {
|
||||
private classesApi: ClassesApi;
|
||||
|
||||
get classesApi(): ClassesApi {
|
||||
return new ClassesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
this.classesApi = new ClassesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
||||
|
@ -43,13 +43,15 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
|
||||
baseShareUrl: string;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
private nodesApi = new NodesApi();
|
||||
|
||||
get nodes(): NodesApi {
|
||||
return new NodesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private zone: NgZone,
|
||||
private alfrescoApiService: AlfrescoApiService) {
|
||||
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@ -25,10 +25,11 @@ import { map } from 'rxjs/operators';
|
||||
})
|
||||
export class ContentTypeService {
|
||||
|
||||
private typesApi: TypesApi;
|
||||
get typesApi(): TypesApi {
|
||||
return new TypesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
this.typesApi = new TypesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
getContentTypeByPrefix(prefixedType: string): Observable<TypeEntry> {
|
||||
|
@ -72,7 +72,9 @@ export class LibraryDialogComponent implements OnInit, OnDestroy {
|
||||
];
|
||||
disableCreateButton = false;
|
||||
|
||||
queriesApi: QueriesApi;
|
||||
get queriesApi(): QueriesApi {
|
||||
return new QueriesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
@ -80,7 +82,6 @@ export class LibraryDialogComponent implements OnInit, OnDestroy {
|
||||
private formBuilder: FormBuilder,
|
||||
private dialog: MatDialogRef<LibraryDialogComponent>
|
||||
) {
|
||||
this.queriesApi = new QueriesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -35,7 +35,9 @@ export class NodeLockDialogComponent implements OnInit {
|
||||
node: Node = null;
|
||||
nodeName: string;
|
||||
|
||||
private nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
return new NodesApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
@ -45,7 +47,6 @@ export class NodeLockDialogComponent implements OnInit {
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
public data: any
|
||||
) {
|
||||
this.nodesApi = new NodesApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -342,7 +342,10 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
private rowMenuCache: { [key: string]: ContentActionModel[] } = {};
|
||||
private loadingTimeout;
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
private nodesApi: NodesApi;
|
||||
|
||||
get nodes(): NodesApi {
|
||||
return new NodesApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private documentListService: DocumentListService,
|
||||
private ngZone: NgZone,
|
||||
@ -353,7 +356,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
private thumbnailService: ThumbnailService,
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private lockService: LockService) {
|
||||
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
|
||||
this.userPreferencesService
|
||||
.select(UserPreferenceValues.PaginationSize)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
|
@ -41,22 +41,35 @@ export class CustomResourcesService {
|
||||
|
||||
private CREATE_PERMISSION = 'create';
|
||||
|
||||
peopleApi: PeopleApi;
|
||||
sitesApi: SitesApi;
|
||||
trashcanApi: TrashcanApi;
|
||||
searchApi: SearchApi;
|
||||
sharedLinksApi: SharedlinksApi;
|
||||
favoritesApi: FavoritesApi;
|
||||
nodesApi: NodesApi;
|
||||
get peopleApi(): PeopleApi {
|
||||
return new PeopleApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get sitesApi(): SitesApi {
|
||||
return new SitesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get trashcanApi(): TrashcanApi {
|
||||
return new TrashcanApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get searchApi(): SearchApi {
|
||||
return new SearchApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
return new SharedlinksApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get favoritesApi(): FavoritesApi {
|
||||
return new FavoritesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get nodes(): NodesApi {
|
||||
return new NodesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
this.peopleApi = new PeopleApi(this.apiService.getInstance());
|
||||
this.sitesApi = new SitesApi(this.apiService.getInstance());
|
||||
this.favoritesApi = new FavoritesApi(this.apiService.getInstance());
|
||||
this.searchApi = new SearchApi(this.apiService.getInstance());
|
||||
this.sharedLinksApi = new SharedlinksApi(this.apiService.getInstance());
|
||||
this.trashcanApi = new TrashcanApi(this.apiService.getInstance());
|
||||
this.nodesApi = new NodesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,13 +34,14 @@ export class DocumentListService implements DocumentListLoader {
|
||||
|
||||
static ROOT_ID = '-root-';
|
||||
|
||||
nodes: NodesApi;
|
||||
get nodes(): NodesApi {
|
||||
return new NodesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private contentService: ContentService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private customResourcesService: CustomResourcesService) {
|
||||
this.nodes = new NodesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,12 +24,13 @@ import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
})
|
||||
export class GroupService {
|
||||
|
||||
groupsApi: GroupsApi;
|
||||
get groupsApi(): GroupsApi {
|
||||
return new GroupsApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(
|
||||
private alfrescoApiService: AlfrescoApiService
|
||||
) {
|
||||
this.groupsApi = new GroupsApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
async listAllGroupMembershipsForPerson(personId: string, opts?: any, accumulator = []): Promise<GroupEntry[]> {
|
||||
|
@ -42,13 +42,14 @@ import { RoleModel } from '../models/role.model';
|
||||
})
|
||||
export class NodePermissionService {
|
||||
|
||||
groupsApi: GroupsApi;
|
||||
get groupsApi(): GroupsApi {
|
||||
return new GroupsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private searchApiService: SearchService,
|
||||
private nodeService: NodesApiService,
|
||||
private translation: TranslationService) {
|
||||
this.groupsApi = new GroupsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,10 @@ import { SearchForm } from '../models/search-form.interface';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export abstract class BaseQueryBuilderService {
|
||||
private searchApi: SearchApi;
|
||||
|
||||
get searchApi(): SearchApi {
|
||||
return new SearchApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
/* Stream that emits the search configuration whenever the user change the search forms */
|
||||
configUpdated = new Subject<SearchConfiguration>();
|
||||
@ -88,7 +91,6 @@ export abstract class BaseQueryBuilderService {
|
||||
ranges: { [id: string]: SearchRange } = {};
|
||||
|
||||
constructor(protected appConfig: AppConfigService, protected alfrescoApiService: AlfrescoApiService) {
|
||||
this.searchApi = new SearchApi(this.alfrescoApiService.getInstance());
|
||||
this.resetToDefaults();
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,11 @@ import { catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class RatingService {
|
||||
|
||||
ratingsApi: RatingsApi;
|
||||
get ratingsApi(): RatingsApi {
|
||||
return new RatingsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
this.ratingsApi = new RatingsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,9 @@ import { TagBody, TagPaging, TagEntry, TagsApi } from '@alfresco/js-api';
|
||||
// tslint:disable-next-line: directive-class-suffix
|
||||
export class TagService {
|
||||
|
||||
private tagsApi: TagsApi;
|
||||
get tagsApi(): TagsApi {
|
||||
return new TagsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/** Emitted when tag information is updated. */
|
||||
@Output()
|
||||
@ -35,7 +37,6 @@ export class TagService {
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.tagsApi = new TagsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,9 +32,18 @@ import { ConfirmDialogComponent } from '../dialogs/confirm.dialog';
|
||||
})
|
||||
export class VersionListComponent implements OnChanges {
|
||||
|
||||
private versionsApi: VersionsApi;
|
||||
private nodesApi: NodesApi;
|
||||
private contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
return new ContentApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
|
||||
get versionsApi(): VersionsApi {
|
||||
return new VersionsApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
|
||||
get nodesApi(): NodesApi {
|
||||
return new NodesApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
|
||||
versions: VersionEntry[] = [];
|
||||
isLoading = true;
|
||||
|
||||
@ -73,9 +82,6 @@ export class VersionListComponent implements OnChanges {
|
||||
constructor(private alfrescoApi: AlfrescoApiService,
|
||||
private contentService: ContentService,
|
||||
private dialog: MatDialog) {
|
||||
this.versionsApi = new VersionsApi(this.alfrescoApi.getInstance());
|
||||
this.nodesApi = new NodesApi(this.alfrescoApi.getInstance());
|
||||
this.contentApi = new ContentApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { ObjectDataTableAdapter, AlfrescoApiService, LogService } from '@alfresco/adf-core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { WebscriptApi } from '@alfresco/js-api';
|
||||
import { TaskFormsApi, WebscriptApi } from '@alfresco/js-api';
|
||||
|
||||
/**
|
||||
* <adf-webscript-get [scriptPath]="string"
|
||||
@ -45,6 +45,10 @@ import { WebscriptApi } from '@alfresco/js-api';
|
||||
})
|
||||
export class WebscriptComponent implements OnChanges {
|
||||
|
||||
get webscriptApi(): WebscriptApi {
|
||||
return new WebscriptApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/** (required) Path to the webscript (as defined by webscript). */
|
||||
@Input()
|
||||
scriptPath: string;
|
||||
@ -81,11 +85,8 @@ export class WebscriptComponent implements OnChanges {
|
||||
data: any = undefined;
|
||||
showError: boolean = false;
|
||||
|
||||
webscriptApi: WebscriptApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.webscriptApi = new WebscriptApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
|
@ -35,18 +35,19 @@ import { map, catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class ActivitiContentService {
|
||||
|
||||
get integrationAlfrescoOnPremiseApi(): IntegrationAlfrescoOnPremiseApi {
|
||||
return new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
}
|
||||
get contentApi(): ActivitiContentApi {
|
||||
return new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
contentApi: ActivitiContentApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private sitesService: SitesService) {
|
||||
|
||||
this.integrationAlfrescoOnPremiseApi = new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
this.contentApi = new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,20 +30,22 @@ import {
|
||||
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
||||
import { WidgetVisibilityModel, WidgetTypeEnum } from '../models/widget-visibility.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { TaskFormsApi } from '@alfresco/js-api';
|
||||
import { RuntimeAppDefinitionsApi, TaskFormsApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WidgetVisibilityService {
|
||||
|
||||
private taskFormsApi: TaskFormsApi;
|
||||
get taskFormsApi(): TaskFormsApi {
|
||||
return new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
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[]) {
|
||||
|
@ -257,10 +257,21 @@ 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;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
return new SharedlinksApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get versionsApi(): VersionsApi {
|
||||
return new VersionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get nodesApi(): NodesApi {
|
||||
return new NodesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get contentApi(): ContentApi {
|
||||
return new ContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private viewUtilService: ViewUtilService,
|
||||
@ -270,10 +281,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;
|
||||
}
|
||||
|
||||
|
@ -74,16 +74,21 @@ export class ViewUtilService {
|
||||
viewerTypeChange: Subject<string> = new Subject<string>();
|
||||
urlFileContentChange: Subject<string> = new Subject<string>();
|
||||
|
||||
renditionsApi: RenditionsApi;
|
||||
contentApi: ContentApi;
|
||||
versionsApi: VersionsApi;
|
||||
get renditionsApi(): RenditionsApi {
|
||||
return new RenditionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get contentApi(): ContentApi {
|
||||
return new ContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get versionsApi(): VersionsApi {
|
||||
return new VersionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,18 +28,21 @@ import { MultiBarChart } from '../../diagram/models/chart/multi-bar-chart.model'
|
||||
import { PieChart } from '../../diagram/models/chart/pie-chart.model';
|
||||
import { TableChart } from '../../diagram/models/chart/table-chart.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { ProcessDefinitionsApi, ReportApi } from '@alfresco/js-api';
|
||||
import { ActivitiContentApi, ProcessDefinitionsApi, ReportApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AnalyticsService {
|
||||
|
||||
reportApi: ReportApi;
|
||||
processDefinitionsApi: ProcessDefinitionsApi;
|
||||
get reportApi(): ReportApi {
|
||||
return new ReportApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get reportApi(): ProcessDefinitionsApi {
|
||||
return new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.reportApi = new ReportApi(this.apiService.getInstance());
|
||||
this.processDefinitionsApi = new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user