[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

@@ -33,12 +33,14 @@ import { FormRenderingService } from './src/services/form-rendering.service';
import { FormService } from './src/services/form.service';
import { NodeService } from './src/services/node.service';
import { WidgetVisibilityService } from './src/services/widget-visibility.service';
import { ProcessUploadService } from './src/services/process-upload.service';
export * from './src/components/activiti-form.component';
export * from './src/components/adf-form-list.component';
export * from './src/components/activiti-content.component';
export * from './src/components/activiti-start-form.component';
export * from './src/services/form.service';
export * from './src/services/process-upload.service';
export * from './src/services/activiti-content-service';
export * from './src/components/widgets/index';
export * from './src/services/ecm-model.service';
@@ -57,6 +59,7 @@ export const ACTIVITI_FORM_DIRECTIVES: any[] = [
export const ACTIVITI_FORM_PROVIDERS: any[] = [
FormService,
ProcessUploadService,
ActivitiContentService,
EcmModelService,
NodeService,

View File

@@ -0,0 +1,39 @@
/*!
* @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 { Injectable } from '@angular/core';
import { AlfrescoApiService, AppConfigService, UploadService } from 'ng2-alfresco-core';
@Injectable()
export class ProcessUploadService extends UploadService {
instanceApi: AlfrescoApiService;
constructor(apiService: AlfrescoApiService, appConfigService: AppConfigService) {
super(apiService, appConfigService);
this.instanceApi = apiService;
}
getUploadPromise(file: any) {
let opts = {
isRelatedContent: true
};
let taskId = file.options.parentId;
return this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
}
}