mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
Add NodesApi as well
This commit is contained in:
@@ -84,6 +84,7 @@ export class DataTableComponent {
|
||||
}
|
||||
|
||||
resolver(row: DataRow, col: DataColumn): any {
|
||||
debugger;
|
||||
const value = row.getValue(col.key);
|
||||
if (col.key === 'users') {
|
||||
return (value || []).map(user => `${user.firstName} ${user.lastName}`).toString();
|
||||
|
@@ -22,9 +22,10 @@ import { UploadService, AlfrescoApiService, AppConfigService, DiscoveryApiServic
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AlfrescoApiClientFactory } from '@alfresco/adf-core/alfresco-api';
|
||||
|
||||
export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
return new ProcessUploadService(api, config, discoveryApiService);
|
||||
export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService, discoveryApiService: DiscoveryApiService, alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
return new ProcessUploadService(api, config, discoveryApiService, alfrescoApiClientFactory);
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -35,7 +36,7 @@ export function processUploadServiceFactory(api: AlfrescoApiService, config: App
|
||||
{
|
||||
provide: UploadService,
|
||||
useFactory: (processUploadServiceFactory),
|
||||
deps: [AlfrescoApiService, AppConfigService, DiscoveryApiService]
|
||||
deps: [AlfrescoApiService, AppConfigService, DiscoveryApiService, AlfrescoApiClientFactory]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
@@ -26,9 +26,10 @@ import { UploadService, AlfrescoApiService, AppConfigService, DiscoveryApiServic
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AlfrescoApiClientFactory } from '@alfresco/adf-core/alfresco-api';
|
||||
|
||||
export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
return new TaskUploadService(api, config, discoveryApiService);
|
||||
export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService, discoveryApiService: DiscoveryApiService, alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
return new TaskUploadService(api, config, discoveryApiService, alfrescoApiClientFactory);
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -39,7 +40,7 @@ export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppCon
|
||||
{
|
||||
provide: UploadService,
|
||||
useFactory: (taskUploadServiceFactory),
|
||||
deps: [AlfrescoApiService, AppConfigService, DiscoveryApiService]
|
||||
deps: [AlfrescoApiService, AppConfigService, DiscoveryApiService, AlfrescoApiClientFactory]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
@@ -21,8 +21,8 @@ import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
|
||||
import { ShareDialogComponent } from './content-node-share.dialog';
|
||||
import { Observable, from, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AlfrescoApiClientFactory } from '../../../../core/alfresco-api';
|
||||
|
||||
@Directive({
|
||||
selector: '[adf-share]',
|
||||
@@ -46,15 +46,15 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private zone: NgZone,
|
||||
private alfrescoApiService: AlfrescoApiService) {
|
||||
}
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory
|
||||
) {}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
|
@@ -17,12 +17,12 @@
|
||||
|
||||
import moment from 'moment-es6';
|
||||
|
||||
import { Component, Inject, OnInit, Optional, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
|
||||
import { NodeBodyLock, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiClientFactory } from '../../../../core/alfresco-api';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-node-lock',
|
||||
@@ -37,15 +37,14 @@ export class NodeLockDialogComponent implements OnInit {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApi.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
public dialog: MatDialogRef<NodeLockDialogComponent>,
|
||||
private alfrescoApi: AlfrescoApiService,
|
||||
@Optional()
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory,
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
public data: any
|
||||
) {
|
||||
|
@@ -43,7 +43,6 @@ import {
|
||||
CustomNoPermissionTemplateDirective,
|
||||
CustomEmptyContentTemplateDirective,
|
||||
RequestPaginationModel,
|
||||
AlfrescoApiService,
|
||||
UserPreferenceValues,
|
||||
LockService,
|
||||
DataRow
|
||||
@@ -63,6 +62,7 @@ import { RowFilter } from '../data/row-filter.model';
|
||||
import { DocumentListService } from '../services/document-list.service';
|
||||
import { DocumentLoaderNode } from '../models/document-folder.model';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../core/alfresco-api';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-document-list',
|
||||
@@ -347,7 +347,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
private userPreferencesService: UserPreferencesService,
|
||||
private contentService: ContentService,
|
||||
private thumbnailService: ThumbnailService,
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory,
|
||||
private lockService: LockService) {
|
||||
this.userPreferencesService
|
||||
.select(UserPreferenceValues.PaginationSize)
|
||||
|
@@ -33,6 +33,7 @@ import {
|
||||
NodesApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../core/alfresco-api';
|
||||
import { Observable, from, of, throwError } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
|
||||
@@ -79,12 +80,15 @@ export class CustomResourcesService {
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
}
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Gets files recently accessed by a user.
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
AlfrescoApiService, ContentService, LogService, PaginationModel
|
||||
ContentService, LogService, PaginationModel
|
||||
} from '@alfresco/adf-core';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
@@ -26,6 +26,7 @@ import { Observable, from, throwError, forkJoin } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { DocumentListLoader } from '../interfaces/document-list-loader.interface';
|
||||
import { CustomResourcesService } from './custom-resources.service';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../core/alfresco-api';
|
||||
|
||||
const ROOT_ID = '-root-';
|
||||
|
||||
@@ -36,14 +37,14 @@ export class DocumentListService implements DocumentListLoader {
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodes(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(private contentService: ContentService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private customResourcesService: CustomResourcesService) {
|
||||
private customResourcesService: CustomResourcesService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@ import { VersionsApi, Node, VersionEntry, VersionPaging, NodesApi, NodeEntry, Co
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ConfirmDialogComponent } from '../dialogs/confirm.dialog';
|
||||
import { ContentVersionService } from './content-version.service';
|
||||
import { AlfrescoApiClientFactory } from '../../../../core/alfresco-api';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-version-list',
|
||||
@@ -45,7 +46,7 @@ export class VersionListComponent implements OnChanges {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApi.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -87,8 +88,9 @@ export class VersionListComponent implements OnChanges {
|
||||
constructor(private alfrescoApi: AlfrescoApiService,
|
||||
private contentService: ContentService,
|
||||
private contentVersionService: ContentVersionService,
|
||||
private dialog: MatDialog) {
|
||||
}
|
||||
private dialog: MatDialog,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory
|
||||
) {}
|
||||
|
||||
ngOnChanges() {
|
||||
this.loadVersionHistory();
|
||||
|
@@ -18,26 +18,29 @@
|
||||
/*tslint:disable*/ // => because of ADF file naming problems... Try to remove it, if you don't believe me :P
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DiscoveryApi } from '@alfresco/js-api';
|
||||
import { DiscoveryApi, NodesApi } from '@alfresco/js-api';
|
||||
import { AngularAlfrescoApi } from './angular-alfresco-api';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoApiClientFactory {
|
||||
// Here we should all the APIs from js-api
|
||||
private discoveryApi: DiscoveryApi = null;
|
||||
private nodesApi: NodesApi = null;
|
||||
|
||||
constructor(
|
||||
private angularAlfrescoApi?: AngularAlfrescoApi) {
|
||||
}
|
||||
|
||||
getDiscoveryApi() {
|
||||
// DiscoveryApi needs to rely on a lot thinner interface: JsApiHttpClient;
|
||||
this.discoveryApi = this.discoveryApi || new DiscoveryApi(this.angularAlfrescoApi as any);
|
||||
// DiscoveryApi needs to rely on a lot thinner interface: JsApiHttpClient; For now: "as any"
|
||||
this.discoveryApi = this.discoveryApi ?? new DiscoveryApi(this.angularAlfrescoApi as any);
|
||||
return this.discoveryApi;
|
||||
}
|
||||
|
||||
getNodesApi () {
|
||||
// TODO
|
||||
// NodesApi needs to rely on a lot thinner interface: JsApiHttpClient; For now: "as any"
|
||||
this.nodesApi = this.nodesApi ?? new NodesApi(this.angularAlfrescoApi as any);
|
||||
return this.nodesApi;
|
||||
}
|
||||
|
||||
getSearchApi() {
|
||||
|
@@ -38,6 +38,7 @@ export class JsApiAngularHttpClient implements JsApiHttpClient {
|
||||
request<T = any>(options: RequestOptions): Promise<T> {
|
||||
|
||||
const responseType = this.getResponseType(options);
|
||||
const params = new HttpParams({ fromObject: this.removeUndefinedValues(options.queryParams) });
|
||||
|
||||
return this.httpClient.request(
|
||||
options.httpMethod,
|
||||
@@ -46,11 +47,24 @@ export class JsApiAngularHttpClient implements JsApiHttpClient {
|
||||
...(options.bodyParam ? { body: options.bodyParam } : {}),
|
||||
...(options.headerParams ? { headers: new HttpHeaders(options.headerParams) } : {}),
|
||||
observe: 'body',
|
||||
...(options.queryParams ? { params: new HttpParams({ fromObject: options.queryParams })} : {}),
|
||||
...(responseType ? { responseType } : {}),
|
||||
...(options.queryParams ? { params } : {}),
|
||||
...(responseType ? { responseType } : {})
|
||||
}).toPromise() as unknown as Promise<T>;
|
||||
}
|
||||
|
||||
// Poor man's sanitizer
|
||||
private removeUndefinedValues (obj: {[key: string]: any}) {
|
||||
const newObj = {};
|
||||
Object.keys(obj).forEach((key) => {
|
||||
if (obj[key] === Object(obj[key])) {
|
||||
newObj[key] = this.removeUndefinedValues(obj[key]);
|
||||
} else if (obj[key] !== undefined && obj[key] !== null) {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
});
|
||||
return newObj;
|
||||
}
|
||||
|
||||
private getResponseType(options: RequestOptions): 'arraybuffer' | 'blob' | 'json' | 'text' {
|
||||
let responseType = null;
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import { Observable, forkJoin, from, of } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { TranslationService } from '../services/translation.service';
|
||||
import { map, catchError, retry } from 'rxjs/operators';
|
||||
import { AlfrescoApiClientFactory } from '../alfresco-api';
|
||||
|
||||
interface ProcessedNodeData {
|
||||
entry: Node | DeletedNode;
|
||||
@@ -70,7 +71,7 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -81,7 +82,8 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
private translation: TranslationService,
|
||||
private elementRef: ElementRef) {
|
||||
private elementRef: ElementRef,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
|
@@ -28,6 +28,7 @@ import { PermissionsEnum } from '../models/permissions.enum';
|
||||
import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
|
||||
import { DownloadService } from './download.service';
|
||||
import { ThumbnailService } from './thumbnail.service';
|
||||
import { AlfrescoApiClientFactory } from '../alfresco-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -46,7 +47,7 @@ export class ContentService {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -55,7 +56,8 @@ export class ContentService {
|
||||
private logService: LogService,
|
||||
private sanitizer: DomSanitizer,
|
||||
private downloadService: DownloadService,
|
||||
private thumbnailService: ThumbnailService) {
|
||||
private thumbnailService: ThumbnailService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -22,6 +22,7 @@ import { NodePaging, NodesApi, TrashcanApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { UserPreferencesService } from './user-preferences.service';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { AlfrescoApiClientFactory } from '../alfresco-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -30,7 +31,7 @@ export class DeletedNodesApiService {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,8 @@ export class DeletedNodesApiService {
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService
|
||||
private preferences: UserPreferencesService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory
|
||||
) {
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,7 @@ import {
|
||||
Node, NodesApi
|
||||
} from '@alfresco/js-api';
|
||||
import { ReplaySubject, Subject } from 'rxjs';
|
||||
import { AlfrescoApiClientFactory } from '../alfresco-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -38,6 +39,10 @@ export class ExternalAlfrescoApiService {
|
||||
protected alfrescoApi: AlfrescoApiCompatibility;
|
||||
_nodesApi: NodesApi;
|
||||
|
||||
constructor(
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory
|
||||
) {}
|
||||
|
||||
getInstance(): AlfrescoApiCompatibility {
|
||||
return this.alfrescoApi;
|
||||
}
|
||||
@@ -47,7 +52,7 @@ export class ExternalAlfrescoApiService {
|
||||
}
|
||||
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,7 @@ import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { UserPreferencesService } from './user-preferences.service';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { NodeMetadata } from '../models/node-metadata.model';
|
||||
import { AlfrescoApiClientFactory } from '../alfresco-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -36,11 +37,12 @@ export class NodesApiService {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory,
|
||||
private preferences: UserPreferencesService) {
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,7 @@ import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { DiscoveryApiService } from './discovery-api.service';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiClientFactory } from '../alfresco-api';
|
||||
|
||||
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
||||
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
||||
@@ -69,7 +70,7 @@ export class UploadService {
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,8 @@ export class UploadService {
|
||||
constructor(
|
||||
protected apiService: AlfrescoApiService,
|
||||
private appConfigService: AppConfigService,
|
||||
private discoveryApiService: DiscoveryApiService) {
|
||||
private discoveryApiService: DiscoveryApiService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
|
||||
this.discoveryApiService.ecmProductInfo$.pipe(filter(info => !!info))
|
||||
.subscribe(({ status }) => {
|
||||
|
@@ -44,6 +44,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { ContentService } from '../../services/content.service';
|
||||
import { UploadService } from '../../services/upload.service';
|
||||
import { FileModel } from '../../models';
|
||||
import { AlfrescoApiClientFactory } from '../../alfresco-api';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-viewer',
|
||||
@@ -292,7 +293,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@@ -310,7 +311,8 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
private uploadService: UploadService,
|
||||
private el: ElementRef,
|
||||
public dialog: MatDialog,
|
||||
private cdr: ChangeDetectorRef) {
|
||||
private cdr: ChangeDetectorRef,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
viewUtilService.maxRetries = this.maxRetries;
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,6 @@ import {
|
||||
FormValues,
|
||||
ContentLinkModel,
|
||||
AppConfigService,
|
||||
AlfrescoApiService,
|
||||
UploadWidgetContentLinkModel,
|
||||
DestinationFolderPath
|
||||
} from '@alfresco/adf-core';
|
||||
@@ -36,6 +35,7 @@ import { ProcessCloudContentService } from '../../../services/process-cloud-cont
|
||||
import { UploadCloudWidgetComponent } from './upload-cloud.widget';
|
||||
import { DestinationFolderPathModel, DestinationFolderPathType } from '../../../models/form-cloud-representation.model';
|
||||
import { ContentNodeSelectorPanelService } from '@alfresco/adf-content-services';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../../../core/alfresco-api';
|
||||
|
||||
export const RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
||||
export const ALIAS_ROOT_FOLDER = '-root-';
|
||||
@@ -67,7 +67,7 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
displayedColumns = ['icon', 'fileName', 'action'];
|
||||
@@ -80,8 +80,8 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
notificationService: NotificationService,
|
||||
private contentNodeSelectorService: ContentCloudNodeSelectorService,
|
||||
private appConfigService: AppConfigService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private contentNodeSelectorPanelService: ContentNodeSelectorPanelService
|
||||
private contentNodeSelectorPanelService: ContentNodeSelectorPanelService,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory
|
||||
) {
|
||||
super(formService, thumbnails, processCloudContentService, notificationService, logger);
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, LogService, NotificationService } from '@alfresco/adf-core';
|
||||
import { LogService, NotificationService } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import {
|
||||
ContentNodeSelectorComponent,
|
||||
@@ -27,6 +27,7 @@ import { Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { from, Observable, Subject, throwError } from 'rxjs';
|
||||
import { catchError, map, mapTo } from 'rxjs/operators';
|
||||
import { DestinationFolderPathModel } from '../models/form-cloud-representation.model';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../core/alfresco-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -35,17 +36,17 @@ export class ContentCloudNodeSelectorService {
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
this._nodesApi = this.alfrescoApiClientFactory.getNodesApi();
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
sourceNodeNotFound = false;
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private notificationService: NotificationService,
|
||||
private logService: LogService,
|
||||
private dialog: MatDialog) {
|
||||
private dialog: MatDialog,
|
||||
private alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
}
|
||||
|
||||
openUploadFileDialog(currentFolderId?: string, selectionMode?: string, isAllFileSources?: boolean, restrictRootToCurrentFolderId?: boolean): Observable<Node[]> {
|
||||
|
@@ -18,6 +18,7 @@
|
||||
import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core';
|
||||
import { ActivitiContentApi } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../core/alfresco-api';
|
||||
import { throwError } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
@@ -31,8 +32,12 @@ export class ProcessUploadService extends UploadService {
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(protected apiService: AlfrescoApiService, appConfigService: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
super(apiService, appConfigService, discoveryApiService);
|
||||
constructor(
|
||||
protected apiService: AlfrescoApiService,
|
||||
appConfigService: AppConfigService,
|
||||
discoveryApiService: DiscoveryApiService,
|
||||
alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
super(apiService, appConfigService, discoveryApiService, alfrescoApiClientFactory);
|
||||
}
|
||||
|
||||
getUploadPromise(file: any): any {
|
||||
|
@@ -19,6 +19,7 @@ import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadServic
|
||||
import { Injectable } from '@angular/core';
|
||||
import { throwError } from 'rxjs';
|
||||
import { ActivitiContentApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiClientFactory } from '../../../../../core/alfresco-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -31,8 +32,12 @@ export class TaskUploadService extends UploadService {
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(protected apiService: AlfrescoApiService, appConfigService: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
super(apiService, appConfigService, discoveryApiService);
|
||||
constructor(
|
||||
protected apiService: AlfrescoApiService,
|
||||
appConfigService: AppConfigService,
|
||||
discoveryApiService: DiscoveryApiService,
|
||||
alfrescoApiClientFactory: AlfrescoApiClientFactory) {
|
||||
super(apiService, appConfigService, discoveryApiService, alfrescoApiClientFactory);
|
||||
}
|
||||
|
||||
getUploadPromise(file: any): any {
|
||||
|
Reference in New Issue
Block a user