mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
refactor content
This commit is contained in:
@@ -35,18 +35,19 @@ import { map, catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class ActivitiContentService {
|
||||
|
||||
get integrationAlfrescoOnPremiseApi(): IntegrationAlfrescoOnPremiseApi {
|
||||
return new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
}
|
||||
get contentApi(): ActivitiContentApi {
|
||||
return new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
contentApi: ActivitiContentApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private sitesService: SitesService) {
|
||||
|
||||
this.integrationAlfrescoOnPremiseApi = new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
this.contentApi = new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -30,20 +30,22 @@ import {
|
||||
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
||||
import { WidgetVisibilityModel, WidgetTypeEnum } from '../models/widget-visibility.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { TaskFormsApi } from '@alfresco/js-api';
|
||||
import { RuntimeAppDefinitionsApi, TaskFormsApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WidgetVisibilityService {
|
||||
|
||||
private taskFormsApi: TaskFormsApi;
|
||||
get taskFormsApi(): TaskFormsApi {
|
||||
return new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
private processVarList: TaskProcessVariableModel[];
|
||||
private form: FormModel;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.taskFormsApi = new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
public refreshVisibility(form: FormModel, processVarList?: TaskProcessVariableModel[]) {
|
||||
|
@@ -206,11 +206,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
|
||||
/** Emitted when user clicks 'Navigate Before' ("<") button. */
|
||||
@Output()
|
||||
navigateBefore = new EventEmitter<MouseEvent|KeyboardEvent>();
|
||||
navigateBefore = new EventEmitter<MouseEvent | KeyboardEvent>();
|
||||
|
||||
/** Emitted when user clicks 'Navigate Next' (">") button. */
|
||||
@Output()
|
||||
navigateNext = new EventEmitter<MouseEvent|KeyboardEvent>();
|
||||
navigateNext = new EventEmitter<MouseEvent | KeyboardEvent>();
|
||||
|
||||
/** Emitted when the shared link used is not valid. */
|
||||
@Output()
|
||||
@@ -257,10 +257,21 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
private shouldCloseViewer = true;
|
||||
private keyDown$ = fromEvent<KeyboardEvent>(document, 'keydown');
|
||||
|
||||
private sharedLinksApi: SharedlinksApi;
|
||||
private versionsApi: VersionsApi;
|
||||
private nodesApi: NodesApi;
|
||||
private contentApi: ContentApi;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
return new SharedlinksApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get versionsApi(): VersionsApi {
|
||||
return new VersionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get nodesApi(): NodesApi {
|
||||
return new NodesApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get contentApi(): ContentApi {
|
||||
return new ContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private viewUtilService: ViewUtilService,
|
||||
@@ -270,10 +281,6 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
private uploadService: UploadService,
|
||||
private el: ElementRef,
|
||||
public dialog: MatDialog) {
|
||||
this.sharedLinksApi = new SharedlinksApi(this.apiService.getInstance());
|
||||
this.versionsApi = new VersionsApi(this.apiService.getInstance());
|
||||
this.nodesApi = new NodesApi(this.apiService.getInstance());
|
||||
this.contentApi = new ContentApi(this.apiService.getInstance());
|
||||
viewUtilService.maxRetries = this.maxRetries;
|
||||
}
|
||||
|
||||
@@ -563,11 +570,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
this.close();
|
||||
}
|
||||
|
||||
onNavigateBeforeClick(event: MouseEvent|KeyboardEvent) {
|
||||
onNavigateBeforeClick(event: MouseEvent | KeyboardEvent) {
|
||||
this.navigateBefore.next(event);
|
||||
}
|
||||
|
||||
onNavigateNextClick(event: MouseEvent|KeyboardEvent) {
|
||||
onNavigateNextClick(event: MouseEvent | KeyboardEvent) {
|
||||
this.navigateNext.next(event);
|
||||
}
|
||||
|
||||
@@ -754,7 +761,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
skipWhile(() => !this.overlayMode),
|
||||
filter((e: KeyboardEvent) => e.keyCode === 27),
|
||||
takeUntil(this.onDestroy$)
|
||||
).subscribe( (event: KeyboardEvent) => {
|
||||
).subscribe((event: KeyboardEvent) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (this.shouldCloseViewer) {
|
||||
|
@@ -74,16 +74,21 @@ export class ViewUtilService {
|
||||
viewerTypeChange: Subject<string> = new Subject<string>();
|
||||
urlFileContentChange: Subject<string> = new Subject<string>();
|
||||
|
||||
renditionsApi: RenditionsApi;
|
||||
contentApi: ContentApi;
|
||||
versionsApi: VersionsApi;
|
||||
get renditionsApi(): RenditionsApi {
|
||||
return new RenditionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get contentApi(): ContentApi {
|
||||
return new ContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
get versionsApi(): VersionsApi {
|
||||
return new VersionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private translateService: TranslationService) {
|
||||
this.renditionsApi = new RenditionsApi(this.apiService.getInstance());
|
||||
this.contentApi = new ContentApi(this.apiService.getInstance());
|
||||
this.versionsApi = new VersionsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user