[ADF-2035] Drag and drop is not working on Processes - attachment List (#2736)

* fix upload for process attachment list
export ActivitiContentService
ProcessService.createOrUpdateProcessInstanceVariables has incorrect method signature

* fix signature methods

* fix test parameters
This commit is contained in:
Eugenio Romano
2017-11-27 14:39:33 +00:00
committed by GitHub
parent 2f07fa339d
commit bdc06e3eed
13 changed files with 113 additions and 55 deletions

View File

@@ -1,15 +1,17 @@
<div id="attachment-process-list" *ngIf="processInstanceId">
<h5>Attachments</h5>
<div class="adf-no-form-container">
<adf-upload-drag-area
[parentId]="processInstanceId"
[disabled]="isCompletedProcess()">
<adf-process-attachment-list #processAttachList
*ngIf="processInstanceId"
[disabled]="isCompletedProcess()"
[processInstanceId]="processInstanceId"
(attachmentClick)="onAttachmentClick($event)">
*ngIf="processInstanceId"
[disabled]="isCompletedProcess()"
[processInstanceId]="processInstanceId"
(attachmentClick)="onAttachmentClick($event)">
</adf-process-attachment-list>
</adf-upload-drag-area>
<adf-create-process-attachment

View File

@@ -28,15 +28,16 @@ import { UploadService } from '@alfresco/adf-core';
export class ProcessAttachmentsComponent implements OnInit, OnChanges {
@Input()
processInstanceId: string;
@ViewChild(ProcessAttachmentListComponent)
processAttachList: ProcessAttachmentListComponent;
fileShowed: boolean = false;
@Input()
processInstanceId: string;
fileShowed = false;
content: Blob;
contentName: string;
processInstance: ProcessInstance;
constructor(private uploadService: UploadService, private processService: ProcessService) {
@@ -48,7 +49,8 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges {
ngOnChanges() {
if (this.processInstanceId) {
this.processService.getProcess(this.processInstanceId).subscribe((processInstance: ProcessInstance) => {
this.processService.getProcess(this.processInstanceId)
.subscribe((processInstance: ProcessInstance) => {
this.processInstance = processInstance;
});
}

View File

@@ -104,8 +104,8 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
@Input()
appId: number = null;
fileShowed: boolean = false;
selectFirstReport: boolean = false;
fileShowed = false;
selectFirstReport = false;
private tabs = { tasks: 0, processes: 1, reports: 2 };
@@ -122,7 +122,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
maxItems: 10,
totalItems: 0
};
taskPage: number = 0;
taskPage = 0;
processSchemaColumns: any[] = [];
activeTab: number = this.tabs.tasks; // tasks|processes|reports
@@ -133,11 +133,11 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
sub: Subscription;
blobFile: any;
flag: boolean = true;
flag = true;
dataTasks: ObjectDataTableAdapter;
dataProcesses: ObjectDataTableAdapter;
presetColoum: string = 'default';
presetColoum = 'default';
fieldValidators = [
...FORM_FIELD_VALIDATORS,
@@ -170,12 +170,12 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
});
formService.validateDynamicTableRow.subscribe(
(e: ValidateDynamicTableRowEvent) => {
const row: DynamicTableRow = e.row;
(validateDynamicTableRowEvent: ValidateDynamicTableRowEvent) => {
const row: DynamicTableRow = validateDynamicTableRowEvent.row;
if (row && row.value && row.value.name === 'admin') {
e.summary.isValid = false;
e.summary.message = 'Sorry, wrong value. You cannot use "admin".';
e.preventDefault();
validateDynamicTableRowEvent.summary.isValid = false;
validateDynamicTableRowEvent.summary.message = 'Sorry, wrong value. You cannot use "admin".';
validateDynamicTableRowEvent.preventDefault();
}
}
);
@@ -240,7 +240,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.activeTab = this.tabs.processes;
}
this.sub = this.route.params.subscribe(params => {
let applicationId = params['appId'];
const applicationId = params['appId'];
if (applicationId && applicationId !== '0') {
this.appId = params['appId'];
}
@@ -417,10 +417,10 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
loadStencilScriptsInPageFromProcessService() {
this.apiService.getInstance().activiti.scriptFileApi.getControllers().then(response => {
if (response) {
let s = document.createElement('script');
s.type = 'text/javascript';
s.text = response;
this.elementRef.nativeElement.appendChild(s);
const stencilSript = document.createElement('script');
stencilSript.type = 'text/javascript';
stencilSript.text = response;
this.elementRef.nativeElement.appendChild(stencilSript);
}
});
}

View File

@@ -1,17 +1,24 @@
<div id="attachment-task-list" *ngIf="taskId">
<div class="adf-no-form-container">
<adf-upload-drag-area
[parentId]="taskId">
<adf-task-attachment-list #taskAttachList
[disabled]="isCompletedTask()"
(attachmentClick)="onAttachmentClick($event)"
[taskId]="taskId">
[taskId]="taskId"
(attachmentClick)="onAttachmentClick($event)">
<div adf-empty-list>
<div adf-empty-list-header class="adf-empty-list-header"> {{'ADF_TASK_LIST.ATTACHMENT.EMPTY.HEADER' | translate}} </div>
<div adf-empty-list-header class="adf-empty-list-header"> {{'ADF_TASK_LIST.ATTACHMENT.EMPTY.HEADER'
| translate}}
</div>
<div adf-empty-list-body>
<div fxHide.lt-md="true" class="adf-empty-list-drag_drop">{{'ADF_TASK_LIST.ATTACHMENT.EMPTY.DRAG-AND-DROP.TITLE' | translate}}</div>
<div fxHide.lt-md="true" class="adf-empty-list__any-files-here-to-add"> {{'ADF_TASK_LIST.ATTACHMENT.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate}} </div>
<div fxHide.lt-md="true" class="adf-empty-list-drag_drop">
{{'ADF_TASK_LIST.ATTACHMENT.EMPTY.DRAG-AND-DROP.TITLE' | translate}}
</div>
<div fxHide.lt-md="true" class="adf-empty-list__any-files-here-to-add">
{{'ADF_TASK_LIST.ATTACHMENT.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate}}
</div>
</div>
</div>
</adf-task-attachment-list>

View File

@@ -16,7 +16,7 @@
*/
import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
import { TaskListService, TaskAttachmentListComponent } from '@alfresco/adf-process-services';
import { TaskListService, TaskAttachmentListComponent, TaskDetailsModel } from '@alfresco/adf-process-services';
import { UploadService } from '@alfresco/adf-core';
@Component({
@@ -33,15 +33,13 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges {
@Input()
taskId: string;
fileShowed: boolean = false;
fileShowed = false;
content: Blob;
contentName: string;
taskDetails: any;
constructor(private uploadService: UploadService,
private activitiTaskList: TaskListService) {
constructor(private uploadService: UploadService, private activitiTaskList: TaskListService) {
}
ngOnInit() {
@@ -50,9 +48,9 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges {
ngOnChanges() {
if (this.taskId) {
this.activitiTaskList.getTaskDetails(this.taskId).map((res) => res).subscribe(
(res: any) => {
this.taskDetails = res;
this.activitiTaskList.getTaskDetails(this.taskId).map((res) => res)
.subscribe((taskDetails: TaskDetailsModel) => {
this.taskDetails = taskDetails;
});
}
}