mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Cleanup process services project structure (#9838)
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, inject, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ProcessAttachmentListComponent, ProcessService, ProcessUploadService } from '@alfresco/adf-process-services';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
@@ -27,12 +27,7 @@ import { ProcessInstanceRepresentation } from '@alfresco/js-api';
|
||||
selector: 'app-process-attachments',
|
||||
templateUrl: './process-attachments.component.html',
|
||||
styleUrls: ['./process-attachments.component.css'],
|
||||
providers: [
|
||||
{
|
||||
provide: UploadService,
|
||||
useClass: ProcessUploadService
|
||||
}
|
||||
],
|
||||
providers: [{ provide: UploadService, useClass: ProcessUploadService }],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@@ -44,9 +39,11 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
|
||||
processInstance: ProcessInstanceRepresentation;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
private uploadService = inject(UploadService);
|
||||
private processService = inject(ProcessService);
|
||||
private preview = inject(PreviewService);
|
||||
|
||||
constructor(private uploadService: UploadService, private processService: ProcessService, private preview: PreviewService) {}
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
ngOnInit() {
|
||||
this.uploadService.fileUploadComplete.pipe(takeUntil(this.onDestroy$)).subscribe((value) => this.onFileUploadComplete(value.data));
|
||||
|
@@ -15,39 +15,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, inject, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { TaskAttachmentListComponent, TaskListService, TaskUploadService } from '@alfresco/adf-process-services';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { TaskRepresentation } from '@alfresco/js-api';
|
||||
|
||||
/**
|
||||
* Provide a task upload service factory
|
||||
*
|
||||
* @param api api client
|
||||
* @param config config service
|
||||
* @param discoveryApiService discovery service
|
||||
* @returns factory function
|
||||
*/
|
||||
export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
return new TaskUploadService(api, config, discoveryApiService);
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-attachments',
|
||||
templateUrl: './task-attachments.component.html',
|
||||
styleUrls: ['./task-attachments.component.css'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
providers: [
|
||||
{
|
||||
provide: UploadService,
|
||||
useFactory: taskUploadServiceFactory,
|
||||
deps: [AlfrescoApiService, AppConfigService, DiscoveryApiService]
|
||||
}
|
||||
]
|
||||
providers: [{ provide: UploadService, useClass: TaskUploadService }]
|
||||
})
|
||||
export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@ViewChild('taskAttachList')
|
||||
@@ -58,9 +39,11 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
taskDetails: TaskRepresentation;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
private uploadService = inject(UploadService);
|
||||
private taskListService = inject(TaskListService);
|
||||
private previewService = inject(PreviewService);
|
||||
|
||||
constructor(private uploadService: UploadService, private taskListService: TaskListService, private previewService: PreviewService) {}
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
ngOnInit() {
|
||||
this.uploadService.fileUploadComplete.pipe(takeUntil(this.onDestroy$)).subscribe((event) => this.onFileUploadComplete(event.data));
|
||||
|
Reference in New Issue
Block a user