mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -18,7 +18,7 @@
|
||||
import { ContentService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ProcessContentService, UploadService } from '@alfresco/adf-core';
|
||||
import { ProcessUploadService } from '../task-list/services/process-upload.service';
|
||||
import { TaskUploadService } from '../task-list/services/task-upload.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-task-attachment-list',
|
||||
@@ -26,7 +26,7 @@ import { ProcessUploadService } from '../task-list/services/process-upload.servi
|
||||
templateUrl: './task-attachment-list.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
providers: [
|
||||
{ provide: UploadService, useClass: ProcessUploadService }
|
||||
{ provide: UploadService, useClass: TaskUploadService }
|
||||
]
|
||||
})
|
||||
export class TaskAttachmentListComponent implements OnChanges, AfterViewInit {
|
||||
|
@@ -56,7 +56,7 @@ describe('ActivitiFilters', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
processFilterService = new ProcessFilterService(null, null);
|
||||
processFilterService = new ProcessFilterService(null);
|
||||
appsProcessService = new AppsProcessService(null, null);
|
||||
filterList = new ProcessFiltersComponent(processFilterService, appsProcessService);
|
||||
});
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { FilterProcessRepresentationModel } from '../models/filter-process.model';
|
||||
@@ -24,8 +24,7 @@ import 'rxjs/add/observable/throw';
|
||||
@Injectable()
|
||||
export class ProcessFilterService {
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
}
|
||||
|
||||
getProcessFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
|
||||
@@ -72,7 +71,7 @@ export class ProcessFilterService {
|
||||
* @param appId
|
||||
* @returns {FilterProcessRepresentationModel[]}
|
||||
*/
|
||||
public createDefaultFilters(appId: number): Observable<any[]> {
|
||||
public createDefaultFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
|
||||
let runningFilter = this.getRunningFilterInstance(appId);
|
||||
let runningObservable = this.addProcessFilter(runningFilter);
|
||||
|
||||
@@ -103,7 +102,7 @@ export class ProcessFilterService {
|
||||
observer.complete();
|
||||
},
|
||||
(err: any) => {
|
||||
this.logService.error(err);
|
||||
this.handleProcessError(err)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@@ -35,7 +35,6 @@ describe('ProcessService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
||||
providers: [
|
||||
ProcessService
|
||||
]
|
||||
|
@@ -126,24 +126,24 @@ export class ProcessService {
|
||||
.catch(err => this.handleProcessError(err));
|
||||
}
|
||||
|
||||
getProcessInstanceVariables(processDefinitionId: string): Observable<ProcessInstanceVariable[]> {
|
||||
getProcessInstanceVariables(processInstanceId: string): Observable<ProcessInstanceVariable[]> {
|
||||
return Observable.fromPromise(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processDefinitionId)
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)
|
||||
)
|
||||
.map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd)))
|
||||
.catch(err => this.handleProcessError(err));
|
||||
}
|
||||
|
||||
createOrUpdateProcessInstanceVariables(processDefinitionId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||
createOrUpdateProcessInstanceVariables(processInstanceId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||
return Observable.fromPromise(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processDefinitionId, variables)
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processInstanceId, variables)
|
||||
)
|
||||
.catch(err => this.handleProcessError(err));
|
||||
}
|
||||
|
||||
deleteProcessInstanceVariable(processDefinitionId: string, variableName: string): Observable<void> {
|
||||
deleteProcessInstanceVariable(processInstanceId: string, variableName: string): Observable<void> {
|
||||
return Observable.fromPromise(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processDefinitionId, variableName)
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processInstanceId, variableName)
|
||||
)
|
||||
.catch(err => this.handleProcessError(err));
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ export * from './components/start-task.component';
|
||||
|
||||
export * from './services/tasklist.service';
|
||||
export * from './services/process-upload.service';
|
||||
export * from './services/task-upload.service';
|
||||
export * from './services/task-filter.service';
|
||||
|
||||
export * from './models/filter.model';
|
||||
@@ -33,3 +34,4 @@ export * from './models/task-details.model';
|
||||
export * from './models/task-details.event';
|
||||
export * from './models/user-event.model';
|
||||
export * from './models/start-task.model';
|
||||
export * from './models/task-list.model';
|
||||
|
@@ -34,8 +34,8 @@ export class ProcessUploadService extends UploadService {
|
||||
let opts = {
|
||||
isRelatedContent: true
|
||||
};
|
||||
let taskId = file.options.parentId;
|
||||
let promise = this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
|
||||
let processInstanceId = file.options.parentId;
|
||||
let promise = this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts);
|
||||
|
||||
promise.catch(err => this.handleError(err));
|
||||
|
||||
|
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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 { AlfrescoApiService, AppConfigService, UploadService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/throw';
|
||||
|
||||
@Injectable()
|
||||
export class TaskUploadService extends UploadService {
|
||||
|
||||
instanceApi: AlfrescoApiService;
|
||||
|
||||
constructor(apiService: AlfrescoApiService, appConfigService: AppConfigService) {
|
||||
super(apiService, appConfigService);
|
||||
this.instanceApi = apiService;
|
||||
}
|
||||
|
||||
getUploadPromise(file: any): any {
|
||||
let opts = {
|
||||
isRelatedContent: true
|
||||
};
|
||||
let taskId = file.options.parentId;
|
||||
let promise = this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
|
||||
|
||||
promise.catch(err => this.handleError(err));
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user