[ADF-1002] Move the UploadService from the upload to core component and share it with the Process service (#2055)

* use the same upload component between the content and process service

* Create a BaseUploadServe inside the core
The AlfrescoUpload should extend the BaseUpload

* Improve the code

* Move the process service from the demo shell to form component

* Merge [ADF-917] added exlcluded files into app config to prevent special files

* Remove typo

* Fix import

* Fix FileModel import

* Fix Denys comment

* Fix unit test with the new path of UploadService

* Add missing implementation
This commit is contained in:
Maurizio Vitale
2017-07-07 15:58:59 +01:00
committed by Eugenio Romano
parent dd61cf7b45
commit 183dd3c990
24 changed files with 141 additions and 57 deletions

View File

@@ -81,15 +81,17 @@
<i class="material-icons">add</i>
</button>
</div>
<adf-task-attachment-list #taskAttach
*ngIf="currentTaskId"
[taskId]="currentTaskId"
(attachmentClick)="onAttachmentClick($event)">
</adf-task-attachment-list>
<adf-upload-drag-area [parentId]="currentTaskId">
<adf-task-attachment-list #taskAttach
*ngIf="currentTaskId"
[taskId]="currentTaskId"
(attachmentClick)="onAttachmentClick($event)">
</adf-task-attachment-list>
</adf-upload-drag-area>
<div *ngIf="isCreateTaskAttachVisible()">
<adf-create-task-attachment *ngIf="currentTaskId"
[taskId]="currentTaskId"
(success)="onCreateTaskSuccess()">
(success)="onFileUploadComplete($event)">
</adf-create-task-attachment>
</div>
</div>

View File

@@ -42,8 +42,8 @@ import {
ObjectDataRow,
DataSorting
} from 'ng2-alfresco-datatable';
import { AlfrescoApiService } from 'ng2-alfresco-core';
import { FormService, FormRenderingService, FormEvent, FormFieldEvent } from 'ng2-activiti-form';
import { AlfrescoApiService, UploadService } from 'ng2-alfresco-core';
import { FormService, FormRenderingService, FormEvent, FormFieldEvent, ProcessUploadService } from 'ng2-activiti-form';
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
declare var componentHandler;
@@ -53,7 +53,10 @@ const currentProcessIdNew = '__NEW__';
@Component({
selector: 'activiti-demo',
templateUrl: './activiti-demo.component.html',
styleUrls: ['./activiti-demo.component.css']
styleUrls: ['./activiti-demo.component.css'],
providers: [
{ provide: UploadService, useClass: ProcessUploadService }
]
})
export class ActivitiDemoComponent implements AfterViewInit {
@@ -122,6 +125,7 @@ export class ActivitiDemoComponent implements AfterViewInit {
private route: ActivatedRoute,
private router: Router,
private apiService: AlfrescoApiService,
private uploadService: UploadService,
private formRenderingService: FormRenderingService,
private formService: FormService) {
this.dataTasks = new ObjectDataTableAdapter();
@@ -170,6 +174,9 @@ export class ActivitiDemoComponent implements AfterViewInit {
this.currentProcessInstanceId = null;
});
this.layoutType = ActivitiApps.LAYOUT_GRID;
this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data));
}
ngOnDestroy() {
@@ -274,6 +281,10 @@ export class ActivitiDemoComponent implements AfterViewInit {
this.contentName = content.name;
}
onFileUploadComplete(content: any) {
this.taskAttachList.add(content);
}
onAttachmentClick(content: any): void {
this.fileShowed = true;
this.content = content.contentBlob;

View File

@@ -18,9 +18,8 @@
import { Component, Input, OnInit, Optional, ViewChild, ChangeDetectorRef } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { MdDialog } from '@angular/material';
import { AlfrescoContentService, FolderCreatedEvent, NotificationService } from 'ng2-alfresco-core';
import { AlfrescoContentService, FolderCreatedEvent, NotificationService, FileUploadCompleteEvent, UploadService } from 'ng2-alfresco-core';
import { DocumentListComponent } from 'ng2-alfresco-documentlist';
import { UploadService, FileUploadCompleteEvent } from 'ng2-alfresco-upload';
import { CreateFolderDialog } from '../../dialogs/create-folder.dialog';