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