diff --git a/demo-shell/src/app/components/process-service/process-attachments.component.ts b/demo-shell/src/app/components/process-service/process-attachments.component.ts index 13fbb9817c..79c7d8bed2 100644 --- a/demo-shell/src/app/components/process-service/process-attachments.component.ts +++ b/demo-shell/src/app/components/process-service/process-attachments.component.ts @@ -19,13 +19,23 @@ import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core'; import { ProcessInstance, ProcessService , ProcessAttachmentListComponent, ProcessUploadService } from '@alfresco/adf-process-services'; import { UploadService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; + +export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) { + return new ProcessUploadService(api, config); +} @Component({ selector: 'app-process-attachments', templateUrl: './process-attachments.component.html', styleUrls: ['./process-attachments.component.css'], providers: [ - { provide: UploadService, useClass: ProcessUploadService } + { + provide: UploadService, + useFactory: (processUploadServiceFactory), + deps: [AlfrescoApiService, AppConfigService] + } ] }) diff --git a/demo-shell/src/app/components/process-service/process-service.component.html b/demo-shell/src/app/components/process-service/process-service.component.html index 6f03049fe4..fa89bf410d 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.html +++ b/demo-shell/src/app/components/process-service/process-service.component.html @@ -121,6 +121,7 @@
= new EventEmitter(); - @ViewChild(DataTableComponent) + @ViewChild('dataTable') dataTable: DataTableComponent; errorMessage; diff --git a/lib/content-services/search/search.module.ts b/lib/content-services/search/search.module.ts index 7cb5b6faa6..14095f3d1b 100644 --- a/lib/content-services/search/search.module.ts +++ b/lib/content-services/search/search.module.ts @@ -21,7 +21,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; -import { PipeModule, SearchService } from '@alfresco/adf-core'; +import { PipeModule } from '@alfresco/adf-core'; import { SearchTriggerDirective } from './components/search-trigger.directive'; @@ -36,10 +36,6 @@ export const ALFRESCO_SEARCH_DIRECTIVES: any[] = [ EmptySearchResultComponent ]; -export const ALFRESCO_SEARCH_PROVIDERS: any[] = [ - SearchService -]; - @NgModule({ imports: [ CommonModule, @@ -52,9 +48,6 @@ export const ALFRESCO_SEARCH_PROVIDERS: any[] = [ declarations: [ ...ALFRESCO_SEARCH_DIRECTIVES ], - providers: [ - ...ALFRESCO_SEARCH_PROVIDERS - ], exports: [ ...ALFRESCO_SEARCH_DIRECTIVES ] diff --git a/lib/core/core.module.ts b/lib/core/core.module.ts index 953e130f36..d0776c6153 100644 --- a/lib/core/core.module.ts +++ b/lib/core/core.module.ts @@ -71,7 +71,7 @@ import { SitesService } from './services/sites.service'; import { StorageService } from './services/storage.service'; import { ThumbnailService } from './services/thumbnail.service'; import { TranslateLoaderService } from './services/translate-loader.service'; -import { TRANSLATION_PROVIDER, TranslationService } from './services/translation.service'; +import { TranslationService } from './services/translation.service'; import { UploadService } from './services/upload.service'; import { UserPreferencesService } from './services/user-preferences.service'; import { SearchConfigurationService } from './services/search-configuration.service'; @@ -241,14 +241,6 @@ export class CoreModuleLazy { TranslateModule ], providers: [ - { - provide: TRANSLATION_PROVIDER, - multi: true, - useValue: { - name: 'adf-core', - source: 'assets/adf-core' - } - }, ...providers() ] }) @@ -257,14 +249,6 @@ export class CoreModule { return { ngModule: CoreModule, providers: [ - { - provide: TRANSLATION_PROVIDER, - multi: true, - useValue: { - name: 'adf-core', - source: 'assets/adf-core' - } - }, ...providers() ] }; @@ -275,4 +259,8 @@ export class CoreModule { ngModule: CoreModuleLazy }; } + + constructor(translation: TranslationService) { + translation.addTranslationFolder('adf-core', 'assets/adf-core'); + } } diff --git a/lib/core/services/upload.service.ts b/lib/core/services/upload.service.ts index 6d4376f33e..8d53c42cd6 100644 --- a/lib/core/services/upload.service.ts +++ b/lib/core/services/upload.service.ts @@ -52,8 +52,10 @@ export class UploadService { fileUploadDeleted: Subject = new Subject(); fileDeleted: Subject = new Subject(); - constructor(private apiService: AlfrescoApiService, private appConfigService: AppConfigService) { - this.excludedFileList = this.appConfigService.get('files.excluded'); + constructor( + protected apiService: AlfrescoApiService, + appConfigService: AppConfigService) { + this.excludedFileList = appConfigService.get('files.excluded'); } /** diff --git a/lib/process-services/attachment/create-process-attachment.component.spec.ts b/lib/process-services/attachment/create-process-attachment.component.spec.ts index 2b1e782b62..3bd39c97c0 100644 --- a/lib/process-services/attachment/create-process-attachment.component.spec.ts +++ b/lib/process-services/attachment/create-process-attachment.component.spec.ts @@ -17,8 +17,7 @@ import { SimpleChange } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProcessContentService } from '@alfresco/adf-core'; -import { TranslationService } from '@alfresco/adf-core'; +import { ProcessContentService, CoreModule } from '@alfresco/adf-core'; import { CreateProcessAttachmentComponent } from './create-process-attachment.component'; declare let jasmine: any; @@ -50,12 +49,12 @@ describe('Activiti Process Create Attachment', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ + CoreModule.forRoot() ], declarations: [ CreateProcessAttachmentComponent ], providers: [ - { provide: TranslationService }, ProcessContentService ] }).compileComponents(); diff --git a/lib/process-services/task-list/services/process-upload.service.ts b/lib/process-services/task-list/services/process-upload.service.ts index b78daab0d7..2b0e51db5e 100644 --- a/lib/process-services/task-list/services/process-upload.service.ts +++ b/lib/process-services/task-list/services/process-upload.service.ts @@ -23,11 +23,8 @@ import 'rxjs/add/observable/throw'; @Injectable() export class ProcessUploadService extends UploadService { - instanceApi: AlfrescoApiService; - constructor(apiService: AlfrescoApiService, appConfigService: AppConfigService) { super(apiService, appConfigService); - this.instanceApi = apiService; } getUploadPromise(file: any): any { @@ -35,7 +32,7 @@ export class ProcessUploadService extends UploadService { isRelatedContent: true }; let processInstanceId = file.options.parentId; - let promise = this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts); + let promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts); promise.catch(err => this.handleError(err)); diff --git a/lib/process-services/task-list/services/task-upload.service.ts b/lib/process-services/task-list/services/task-upload.service.ts index dd879a1b1a..dc1722391b 100644 --- a/lib/process-services/task-list/services/task-upload.service.ts +++ b/lib/process-services/task-list/services/task-upload.service.ts @@ -23,11 +23,8 @@ 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 { @@ -35,7 +32,7 @@ export class TaskUploadService extends UploadService { isRelatedContent: true }; let taskId = file.options.parentId; - let promise = this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts); + let promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts); promise.catch(err => this.handleError(err));