mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
feat: replace api usage for ContentCustomApi
This commit is contained in:
@@ -16,25 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { ApiClientsService } from '@alfresco/adf-core';
|
||||||
import { Observable, defer, forkJoin } from 'rxjs';
|
import { Observable, defer, forkJoin } from 'rxjs';
|
||||||
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
|
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { ClassesApi } from '@alfresco/js-api';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PropertyDescriptorsService {
|
export class PropertyDescriptorsService {
|
||||||
|
|
||||||
private _classesApi;
|
get classesApi() {
|
||||||
get classesApi(): ClassesApi {
|
return this.apiClientsService.get('ContentCustomClient.classes');
|
||||||
this._classesApi = this._classesApi ?? new ClassesApi(this.alfrescoApiService.getInstance());
|
|
||||||
return this._classesApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
constructor(private apiClientsService: ApiClientsService) { }
|
||||||
}
|
|
||||||
|
|
||||||
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
||||||
const groupFetchStreams = groupNames
|
const groupFetchStreams = groupNames
|
||||||
|
@@ -16,22 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { ApiClientsService } from '@alfresco/adf-core';
|
||||||
import { ContentApi } from '@alfresco/js-api';
|
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ContentVersionService {
|
export class ContentVersionService {
|
||||||
private _contentApi: ContentApi;
|
|
||||||
|
|
||||||
get contentApi(): ContentApi {
|
get contentApi() {
|
||||||
if (!this._contentApi) {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = new ContentApi(this.alfrescoApi.getInstance());
|
|
||||||
}
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private alfrescoApi: AlfrescoApiService) {}
|
constructor(private apiClientsService: ApiClientsService) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get content URL for the given nodeId and specific version.
|
* Get content URL for the given nodeId and specific version.
|
||||||
|
@@ -15,9 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService, ContentService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, ApiClientsService, ContentService } from '@alfresco/adf-core';
|
||||||
import { Component, Input, OnChanges, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
import { Component, Input, OnChanges, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
||||||
import { VersionsApi, Node, VersionEntry, VersionPaging, NodesApi, NodeEntry, ContentApi } from '@alfresco/js-api';
|
import { VersionsApi, Node, VersionEntry, VersionPaging, NodesApi, NodeEntry } from '@alfresco/js-api';
|
||||||
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';
|
||||||
@@ -31,10 +31,8 @@ import { ContentVersionService } from './content-version.service';
|
|||||||
})
|
})
|
||||||
export class VersionListComponent implements OnChanges {
|
export class VersionListComponent implements OnChanges {
|
||||||
|
|
||||||
_contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.alfrescoApi.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_versionsApi: VersionsApi;
|
_versionsApi: VersionsApi;
|
||||||
@@ -84,11 +82,13 @@ export class VersionListComponent implements OnChanges {
|
|||||||
@Output()
|
@Output()
|
||||||
viewVersion = new EventEmitter<string>();
|
viewVersion = new EventEmitter<string>();
|
||||||
|
|
||||||
constructor(private alfrescoApi: AlfrescoApiService,
|
constructor(
|
||||||
private contentService: ContentService,
|
private apiClientsService: ApiClientsService,
|
||||||
private contentVersionService: ContentVersionService,
|
private alfrescoApi: AlfrescoApiService,
|
||||||
private dialog: MatDialog) {
|
private contentService: ContentService,
|
||||||
}
|
private contentVersionService: ContentVersionService,
|
||||||
|
private dialog: MatDialog
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
this.loadVersionHistory();
|
this.loadVersionHistory();
|
||||||
|
@@ -15,9 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ObjectDataTableAdapter, AlfrescoApiService, LogService } from '@alfresco/adf-core';
|
import { ObjectDataTableAdapter, LogService, ApiClientsService } from '@alfresco/adf-core';
|
||||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||||
import { WebscriptApi } from '@alfresco/js-api';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <adf-webscript-get [scriptPath]="string"
|
* <adf-webscript-get [scriptPath]="string"
|
||||||
@@ -45,10 +44,8 @@ import { WebscriptApi } from '@alfresco/js-api';
|
|||||||
})
|
})
|
||||||
export class WebscriptComponent implements OnChanges {
|
export class WebscriptComponent implements OnChanges {
|
||||||
|
|
||||||
_webscriptApi: WebscriptApi;
|
get webscriptApi() {
|
||||||
get webscriptApi(): WebscriptApi {
|
return this.apiClientsService.get('ContentCustomClient.webscript');
|
||||||
this._webscriptApi = this._webscriptApi ?? new WebscriptApi(this.apiService.getInstance());
|
|
||||||
return this._webscriptApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** (required) Path to the webscript (as defined by webscript). */
|
/** (required) Path to the webscript (as defined by webscript). */
|
||||||
@@ -87,9 +84,10 @@ export class WebscriptComponent implements OnChanges {
|
|||||||
data: any = undefined;
|
data: any = undefined;
|
||||||
showError: boolean = false;
|
showError: boolean = false;
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService,
|
constructor(
|
||||||
private logService: LogService) {
|
private apiClientsService: ApiClientsService,
|
||||||
}
|
private logService: LogService
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
if (this.showData) {
|
if (this.showData) {
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ActivitiClientModule } from './activiti/activiti-client.module';
|
import { ActivitiClientModule } from './activiti/activiti-client.module';
|
||||||
|
import { ContentCustomClientModule } from './content-custom/content-custom-client.module';
|
||||||
import { DiscoveryClientModule } from './discovery/discovery-client.module';
|
import { DiscoveryClientModule } from './discovery/discovery-client.module';
|
||||||
import { SearchClientModule } from './search/search-client.module';
|
import { SearchClientModule } from './search/search-client.module';
|
||||||
|
|
||||||
@@ -24,7 +25,8 @@ import { SearchClientModule } from './search/search-client.module';
|
|||||||
imports: [
|
imports: [
|
||||||
ActivitiClientModule,
|
ActivitiClientModule,
|
||||||
DiscoveryClientModule,
|
DiscoveryClientModule,
|
||||||
SearchClientModule
|
SearchClientModule,
|
||||||
|
ContentCustomClientModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AlfrescoJsClientsModule { }
|
export class AlfrescoJsClientsModule { }
|
||||||
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ClassesApi, ContentApi, CustomModelApi, UploadApi, WebscriptApi } from '@alfresco/js-api';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { ApiClientsService } from '../../api-clients.service';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
namespace Api {
|
||||||
|
interface ApiRegistry {
|
||||||
|
['ContentCustomClient.webscript']: WebscriptApi;
|
||||||
|
['ContentCustomClient.upload']: UploadApi;
|
||||||
|
['ContentCustomClient.classes']: ClassesApi;
|
||||||
|
['ContentCustomClient.content']: ContentApi;
|
||||||
|
['ContentCustomClient.custom-model']: CustomModelApi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule()
|
||||||
|
export class ContentCustomClientModule {
|
||||||
|
constructor(private apiClientsService: ApiClientsService) {
|
||||||
|
this.apiClientsService.register('ContentCustomClient.webscript', WebscriptApi);
|
||||||
|
this.apiClientsService.register('ContentCustomClient.upload', UploadApi);
|
||||||
|
this.apiClientsService.register('ContentCustomClient.classes', ClassesApi);
|
||||||
|
this.apiClientsService.register('ContentCustomClient.content', ContentApi);
|
||||||
|
this.apiClientsService.register('ContentCustomClient.custom-model', CustomModelApi);
|
||||||
|
}
|
||||||
|
}
|
@@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
import { Directive, Input, HostListener } from '@angular/core';
|
import { Directive, Input, HostListener } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
|
||||||
import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
|
import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
|
||||||
import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
import { NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||||
import { DownloadService } from '../services/download.service';
|
import { DownloadService } from '../services/download.service';
|
||||||
|
import { ApiClientsService } from '../api/api-clients.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directive selectors without adf- prefix will be deprecated on 3.0.0
|
* Directive selectors without adf- prefix will be deprecated on 3.0.0
|
||||||
@@ -31,10 +31,8 @@ import { DownloadService } from '../services/download.service';
|
|||||||
})
|
})
|
||||||
export class NodeDownloadDirective {
|
export class NodeDownloadDirective {
|
||||||
|
|
||||||
_contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Nodes to download. */
|
/** Nodes to download. */
|
||||||
@@ -51,10 +49,10 @@ export class NodeDownloadDirective {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private apiService: AlfrescoApiService,
|
private apiClientsService: ApiClientsService,
|
||||||
private downloadService: DownloadService,
|
private downloadService: DownloadService,
|
||||||
private dialog: MatDialog) {
|
private dialog: MatDialog
|
||||||
}
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads multiple selected nodes.
|
* Downloads multiple selected nodes.
|
||||||
|
@@ -16,12 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { LogService } from '../../services/log.service';
|
import { LogService } from '../../services/log.service';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { FormModel } from '../components/widgets/core/form.model';
|
import { FormModel } from '../components/widgets/core/form.model';
|
||||||
import { map, catchError } from 'rxjs/operators';
|
import { map, catchError } from 'rxjs/operators';
|
||||||
import { CustomModelApi } from '@alfresco/js-api';
|
import { ApiClientsService } from '../../api/api-clients.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -32,15 +31,11 @@ export class EcmModelService {
|
|||||||
public static MODEL_NAME: string = 'activitiFormsModel';
|
public static MODEL_NAME: string = 'activitiFormsModel';
|
||||||
public static TYPE_MODEL: string = 'cm:folder';
|
public static TYPE_MODEL: string = 'cm:folder';
|
||||||
|
|
||||||
_customModelApi: CustomModelApi;
|
get customModelApi() {
|
||||||
get customModelApi(): CustomModelApi {
|
return this.apiClientsService.get('ContentCustomClient.custom-model');
|
||||||
this._customModelApi = this._customModelApi ?? new CustomModelApi(this.apiService.getInstance());
|
|
||||||
return this._customModelApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService,
|
constructor(private apiClientsService: ApiClientsService, private logService: LogService) { }
|
||||||
private logService: LogService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
||||||
return new Observable((observer) => {
|
return new Observable((observer) => {
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { ContentApi, MinimalNode, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
import { MinimalNode, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||||
import { Observable, Subject, from, throwError } from 'rxjs';
|
import { Observable, Subject, from, throwError } from 'rxjs';
|
||||||
import { FolderCreatedEvent } from '../events/folder-created.event';
|
import { FolderCreatedEvent } from '../events/folder-created.event';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@@ -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 { ApiClientsService } from '../api/api-clients.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -38,10 +39,8 @@ export class ContentService {
|
|||||||
folderCreate: Subject<MinimalNode> = new Subject<MinimalNode>();
|
folderCreate: Subject<MinimalNode> = new Subject<MinimalNode>();
|
||||||
folderEdit: Subject<MinimalNode> = new Subject<MinimalNode>();
|
folderEdit: Subject<MinimalNode> = new Subject<MinimalNode>();
|
||||||
|
|
||||||
_contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_nodesApi: NodesApi;
|
_nodesApi: NodesApi;
|
||||||
@@ -50,13 +49,15 @@ export class ContentService {
|
|||||||
return this._nodesApi;
|
return this._nodesApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(public authService: AuthenticationService,
|
constructor(
|
||||||
public apiService: AlfrescoApiService,
|
public authService: AuthenticationService,
|
||||||
private logService: LogService,
|
public apiService: AlfrescoApiService,
|
||||||
private sanitizer: DomSanitizer,
|
private logService: LogService,
|
||||||
private downloadService: DownloadService,
|
private sanitizer: DomSanitizer,
|
||||||
private thumbnailService: ThumbnailService) {
|
private downloadService: DownloadService,
|
||||||
}
|
private thumbnailService: ThumbnailService,
|
||||||
|
private apiClientsService: ApiClientsService
|
||||||
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated in 3.2.0, use DownloadService instead.
|
* @deprecated in 3.2.0, use DownloadService instead.
|
||||||
|
@@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { RenditionEntry, RenditionPaging, RenditionsApi, ContentApi } from '@alfresco/js-api';
|
import { RenditionEntry, RenditionPaging, RenditionsApi } from '@alfresco/js-api';
|
||||||
import { Observable, from, interval, empty } from 'rxjs';
|
import { Observable, from, interval, empty } from 'rxjs';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { concatMap, switchMap, takeWhile, map } from 'rxjs/operators';
|
import { concatMap, switchMap, takeWhile, map } from 'rxjs/operators';
|
||||||
|
import { ApiClientsService } from '../api/api-clients.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -32,13 +33,11 @@ export class RenditionsService {
|
|||||||
return this._renditionsApi;
|
return this._renditionsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService, private apiClientsService: ApiClientsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -20,7 +20,8 @@ import { Injectable } from '@angular/core';
|
|||||||
import { MatIconRegistry } from '@angular/material/icon';
|
import { MatIconRegistry } from '@angular/material/icon';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { ContentApi, NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
|
import { ApiClientsService } from '../api/api-clients.service';
|
||||||
|
|
||||||
const DEFAULT_ICON = './assets/images/ft_ic_miscellaneous.svg';
|
const DEFAULT_ICON = './assets/images/ft_ic_miscellaneous.svg';
|
||||||
|
|
||||||
@@ -163,13 +164,16 @@ export class ThumbnailService {
|
|||||||
task: './assets/images/task.svg'
|
task: './assets/images/task.svg'
|
||||||
};
|
};
|
||||||
|
|
||||||
_contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(protected apiService: AlfrescoApiService, matIconRegistry: MatIconRegistry, sanitizer: DomSanitizer) {
|
constructor(
|
||||||
|
protected apiService: AlfrescoApiService,
|
||||||
|
matIconRegistry: MatIconRegistry,
|
||||||
|
sanitizer: DomSanitizer,
|
||||||
|
private apiClientsService: ApiClientsService
|
||||||
|
) {
|
||||||
Object.keys(this.mimeTypeIcons).forEach((key) => {
|
Object.keys(this.mimeTypeIcons).forEach((key) => {
|
||||||
const url = sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key]);
|
const url = sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key]);
|
||||||
|
|
||||||
|
@@ -29,7 +29,8 @@ import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.
|
|||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
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, VersionsApi } from '@alfresco/js-api';
|
||||||
|
import { ApiClientsService } from '../api/api-clients.service';
|
||||||
|
|
||||||
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
||||||
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
||||||
@@ -61,10 +62,8 @@ export class UploadService {
|
|||||||
private abortedFile: string;
|
private abortedFile: string;
|
||||||
private isThumbnailGenerationEnabled: boolean;
|
private isThumbnailGenerationEnabled: boolean;
|
||||||
|
|
||||||
private _uploadApi: UploadApi;
|
get uploadApi() {
|
||||||
get uploadApi(): UploadApi {
|
return this.apiClientsService.get('ContentCustomClient.upload');
|
||||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
|
||||||
return this._uploadApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _nodesApi: NodesApi;
|
private _nodesApi: NodesApi;
|
||||||
@@ -80,6 +79,7 @@ export class UploadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
protected apiClientsService: ApiClientsService,
|
||||||
protected apiService: AlfrescoApiService,
|
protected apiService: AlfrescoApiService,
|
||||||
private appConfigService: AppConfigService,
|
private appConfigService: AppConfigService,
|
||||||
private discoveryApiService: DiscoveryApiService) {
|
private discoveryApiService: DiscoveryApiService) {
|
||||||
@@ -237,7 +237,7 @@ export class UploadService {
|
|||||||
if (file.id) {
|
if (file.id) {
|
||||||
return this.nodesApi.updateNodeContent(file.id, file.file as any, opts);
|
return this.nodesApi.updateNodeContent(file.id, file.file as any, opts);
|
||||||
} else {
|
} else {
|
||||||
const nodeBody = { ... file.options };
|
const nodeBody = { ...file.options };
|
||||||
delete nodeBody['versioningEnabled'];
|
delete nodeBody['versioningEnabled'];
|
||||||
|
|
||||||
return this.uploadApi.uploadFile(
|
return this.uploadApi.uploadFile(
|
||||||
|
@@ -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 { ApiClientsService } from '../../api/api-clients.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer',
|
selector: 'adf-viewer',
|
||||||
@@ -297,21 +298,22 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
return this._nodesApi;
|
return this._nodesApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
_contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService,
|
constructor(
|
||||||
private viewUtilService: ViewUtilService,
|
private apiService: AlfrescoApiService,
|
||||||
private logService: LogService,
|
private viewUtilService: ViewUtilService,
|
||||||
private extensionService: AppExtensionService,
|
private logService: LogService,
|
||||||
private contentService: ContentService,
|
private extensionService: AppExtensionService,
|
||||||
private uploadService: UploadService,
|
private contentService: ContentService,
|
||||||
private el: ElementRef,
|
private uploadService: UploadService,
|
||||||
public dialog: MatDialog,
|
private el: ElementRef,
|
||||||
private cdr: ChangeDetectorRef) {
|
public dialog: MatDialog,
|
||||||
|
private cdr: ChangeDetectorRef,
|
||||||
|
private apiClientsService: ApiClientsService
|
||||||
|
) {
|
||||||
viewUtilService.maxRetries = this.maxRetries;
|
viewUtilService.maxRetries = this.maxRetries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,8 +324,8 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.apiService.nodeUpdated.pipe(
|
this.apiService.nodeUpdated.pipe(
|
||||||
filter((node) => node && node.id === this.nodeId &&
|
filter((node) => node && node.id === this.nodeId &&
|
||||||
(node.name !== this.fileName ||
|
(node.name !== this.fileName ||
|
||||||
this.getNodeVersionProperty(this.nodeEntry.entry) !== this.getNodeVersionProperty(node))),
|
this.getNodeVersionProperty(this.nodeEntry.entry) !== this.getNodeVersionProperty(node))),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntil(this.onDestroy$)
|
||||||
).subscribe((node) => this.onNodeUpdated(node));
|
).subscribe((node) => this.onNodeUpdated(node));
|
||||||
|
|
||||||
|
@@ -16,12 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ContentApi, RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api';
|
import { RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
import { LogService } from '../../services/log.service';
|
import { LogService } from '../../services/log.service';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { Track } from '../models/viewer.model';
|
import { Track } from '../models/viewer.model';
|
||||||
import { TranslationService } from '../../services/translation.service';
|
import { TranslationService } from '../../services/translation.service';
|
||||||
|
import { ApiClientsService } from '../../api/api-clients.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -33,7 +34,7 @@ export class ViewUtilService {
|
|||||||
* Content groups based on categorization of files that can be viewed in the web browser. This
|
* Content groups based on categorization of files that can be viewed in the web browser. This
|
||||||
* implementation or grouping is tied to the definition the ng component: ViewerComponent
|
* implementation or grouping is tied to the definition the ng component: ViewerComponent
|
||||||
*/
|
*/
|
||||||
// tslint:disable-next-line:variable-name
|
// tslint:disable-next-line:variable-name
|
||||||
static ContentGroup = {
|
static ContentGroup = {
|
||||||
IMAGE: 'image',
|
IMAGE: 'image',
|
||||||
MEDIA: 'media',
|
MEDIA: 'media',
|
||||||
@@ -80,10 +81,8 @@ export class ViewUtilService {
|
|||||||
return this._renditionsApi;
|
return this._renditionsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
_contentApi: ContentApi;
|
get contentApi() {
|
||||||
get contentApi(): ContentApi {
|
return this.apiClientsService.get('ContentCustomClient.content');
|
||||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
|
||||||
return this._contentApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_versionsApi: VersionsApi;
|
_versionsApi: VersionsApi;
|
||||||
@@ -92,10 +91,11 @@ export class ViewUtilService {
|
|||||||
return this._versionsApi;
|
return this._versionsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService,
|
constructor(
|
||||||
private logService: LogService,
|
private apiService: AlfrescoApiService,
|
||||||
private translateService: TranslationService) {
|
private logService: LogService,
|
||||||
}
|
private translateService: TranslationService,
|
||||||
|
private apiClientsService: ApiClientsService) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method takes a url to trigger the print dialog against, and the type of artifact that it
|
* This method takes a url to trigger the print dialog against, and the type of artifact that it
|
||||||
|
@@ -22,12 +22,13 @@ import {
|
|||||||
AppConfigService,
|
AppConfigService,
|
||||||
FormOutcomeModel,
|
FormOutcomeModel,
|
||||||
FormModel,
|
FormModel,
|
||||||
FormFieldOption
|
FormFieldOption,
|
||||||
|
ApiClientsService
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { Observable, from, EMPTY } from 'rxjs';
|
import { Observable, from, EMPTY } from 'rxjs';
|
||||||
import { expand, map, reduce, switchMap } from 'rxjs/operators';
|
import { expand, map, reduce, switchMap } from 'rxjs/operators';
|
||||||
import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model';
|
import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model';
|
||||||
import { CompleteFormRepresentation, UploadApi } from '@alfresco/js-api';
|
import { CompleteFormRepresentation } from '@alfresco/js-api';
|
||||||
import { TaskVariableCloud } from '../models/task-variable-cloud.model';
|
import { TaskVariableCloud } from '../models/task-variable-cloud.model';
|
||||||
import { BaseCloudService } from '../../services/base-cloud.service';
|
import { BaseCloudService } from '../../services/base-cloud.service';
|
||||||
import { FormContent } from '../../services/form-fields.interfaces';
|
import { FormContent } from '../../services/form-fields.interfaces';
|
||||||
@@ -38,15 +39,14 @@ import { FormCloudServiceInterface } from './form-cloud.service.interface';
|
|||||||
})
|
})
|
||||||
export class FormCloudService extends BaseCloudService implements FormCloudServiceInterface {
|
export class FormCloudService extends BaseCloudService implements FormCloudServiceInterface {
|
||||||
|
|
||||||
private _uploadApi;
|
get uploadApi() {
|
||||||
get uploadApi(): UploadApi {
|
return this.apiClientsService.get('ContentCustomClient.upload');
|
||||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
|
||||||
return this._uploadApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
apiService: AlfrescoApiService,
|
apiService: AlfrescoApiService,
|
||||||
appConfigService: AppConfigService
|
appConfigService: AppConfigService,
|
||||||
|
private apiClientsService: ApiClientsService
|
||||||
) {
|
) {
|
||||||
super(apiService, appConfigService);
|
super(apiService, appConfigService);
|
||||||
}
|
}
|
||||||
|
@@ -22,19 +22,18 @@ import {
|
|||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
LogService,
|
LogService,
|
||||||
ContentService,
|
ContentService,
|
||||||
DownloadService
|
DownloadService,
|
||||||
|
ApiClientsService
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { AuthenticationApi, Node, UploadApi } from '@alfresco/js-api';
|
import { AuthenticationApi, Node } from '@alfresco/js-api';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ProcessCloudContentService {
|
export class ProcessCloudContentService {
|
||||||
|
|
||||||
private _uploadApi;
|
get uploadApi() {
|
||||||
get uploadApi(): UploadApi {
|
return this.apiClientsService.get('ContentCustomClient.upload');
|
||||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
|
||||||
return this._uploadApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _authenticationApi;
|
private _authenticationApi;
|
||||||
@@ -44,6 +43,7 @@ export class ProcessCloudContentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private apiClientsService: ApiClientsService,
|
||||||
private apiService: AlfrescoApiService,
|
private apiService: AlfrescoApiService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
public contentService: ContentService,
|
public contentService: ContentService,
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { EventEmitter, Injectable, Output } from '@angular/core';
|
import { EventEmitter, Injectable, Output } from '@angular/core';
|
||||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, ApiClientsService, TranslationService } from '@alfresco/adf-core';
|
||||||
import { Observable, of, Subject } from 'rxjs';
|
import { Observable, of, Subject } from 'rxjs';
|
||||||
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
||||||
import { AlfrescoEndpointRepresentation, Node, ContentApi } from '@alfresco/js-api';
|
import { AlfrescoEndpointRepresentation, Node } from '@alfresco/js-api';
|
||||||
import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component';
|
import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component';
|
||||||
import { switchMap } from 'rxjs/operators';
|
import { switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
@@ -35,9 +35,11 @@ export class AttachFileWidgetDialogService {
|
|||||||
|
|
||||||
private externalApis: { [key: string]: AlfrescoApiService } = {};
|
private externalApis: { [key: string]: AlfrescoApiService } = {};
|
||||||
|
|
||||||
constructor(private dialog: MatDialog,
|
constructor(
|
||||||
private translation: TranslationService) {
|
private dialog: MatDialog,
|
||||||
}
|
private translation: TranslationService,
|
||||||
|
private apiClientsService: ApiClientsService
|
||||||
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to choose a file to upload.
|
* Opens a dialog to choose a file to upload.
|
||||||
@@ -65,20 +67,16 @@ export class AttachFileWidgetDialogService {
|
|||||||
|
|
||||||
downloadURL(repository: AlfrescoEndpointRepresentation, sourceId: string): Observable<string> {
|
downloadURL(repository: AlfrescoEndpointRepresentation, sourceId: string): Observable<string> {
|
||||||
const { accountIdentifier } = this.constructPayload(repository);
|
const { accountIdentifier } = this.constructPayload(repository);
|
||||||
|
const contentApi = this.apiClientsService.get('ContentCustomClient.content');
|
||||||
|
|
||||||
if (this.externalApis[accountIdentifier]?.getInstance()) {
|
if (this.externalApis[accountIdentifier]?.getInstance()) {
|
||||||
const contentApi = new ContentApi(this.externalApis[accountIdentifier].getInstance());
|
|
||||||
|
|
||||||
if (this.externalApis[accountIdentifier].getInstance().isLoggedIn()) {
|
if (this.externalApis[accountIdentifier].getInstance().isLoggedIn()) {
|
||||||
return of(contentApi.getContentUrl(sourceId));
|
return of(contentApi.getContentUrl(sourceId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.showExternalHostLoginDialog(repository).pipe(
|
return this.showExternalHostLoginDialog(repository).pipe(
|
||||||
switchMap(() => {
|
switchMap(() => of(contentApi.getContentUrl(sourceId)))
|
||||||
const contentApi = new ContentApi(this.externalApis[accountIdentifier].getInstance());
|
|
||||||
return of(contentApi.getContentUrl(sourceId));
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user