mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1356] Single configuration of i18n service per project (#2199)
* rework i18n layer init * fix unit tests * fix tests * test fixes * remove obsolete tests
This commit is contained in:
committed by
Mario Romano
parent
bb53844f92
commit
003b0c133b
@@ -24,15 +24,15 @@ import {
|
||||
MdSelectModule } from '@angular/material';
|
||||
import { ActivitiFormModule } from 'ng2-activiti-form';
|
||||
import { ActivitiTaskListModule } from 'ng2-activiti-tasklist';
|
||||
import { CardViewUpdateService, CoreModule } from 'ng2-alfresco-core';
|
||||
import { CardViewUpdateService, CoreModule, TRANSLATION_PROVIDER } from 'ng2-alfresco-core';
|
||||
import { DataTableModule } from 'ng2-alfresco-datatable';
|
||||
|
||||
import { CreateProcessAttachmentComponent } from './src/components/create-process-attachment.component';
|
||||
import { ProcessAttachmentListComponent } from './src/components/process-attachment-list.component';
|
||||
import { ProcessAuditDirective } from './src/components/process-audit.directive';
|
||||
import { ProcessCommentsComponent } from './src/components/process-comments.component';
|
||||
import { ProcessFiltersComponent } from './src/components/process-filters.component';
|
||||
import { ProcessInstanceDetailsComponent } from './src/components/process-instance-details.component';
|
||||
import { ProcessAuditDirective } from './src/components/process-audit.directive';
|
||||
import { ProcessInstanceHeaderComponent } from './src/components/process-instance-header.component';
|
||||
import { ProcessInstanceTasksComponent } from './src/components/process-instance-tasks.component';
|
||||
import { ProcessInstanceVariablesComponent } from './src/components/process-instance-variables.component';
|
||||
@@ -136,7 +136,15 @@ export const ACTIVITI_PROCESSLIST_PROVIDERS: [any] = [
|
||||
...ACTIVITI_PROCESSLIST_DIRECTIVES
|
||||
],
|
||||
providers: [
|
||||
...ACTIVITI_PROCESSLIST_PROVIDERS
|
||||
...ACTIVITI_PROCESSLIST_PROVIDERS,
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'ng2-activiti-processlist',
|
||||
source: 'assets/ng2-activiti-processlist'
|
||||
}
|
||||
}
|
||||
],
|
||||
exports: [
|
||||
...ACTIVITI_PROCESSLIST_DIRECTIVES
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { ActivitiContentService } from 'ng2-activiti-form';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-create-process-attachment',
|
||||
@@ -35,12 +34,7 @@ export class CreateProcessAttachmentComponent implements OnChanges {
|
||||
@Output()
|
||||
success: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
constructor(translateService: AlfrescoTranslationService,
|
||||
private activitiContentService: ActivitiContentService) {
|
||||
|
||||
if (translateService) {
|
||||
translateService.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist/src');
|
||||
}
|
||||
constructor(private activitiContentService: ActivitiContentService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { ActivitiContentService } from 'ng2-activiti-form';
|
||||
import { AlfrescoTranslationService, ContentService, ThumbnailService } from 'ng2-alfresco-core';
|
||||
import { ContentService, ThumbnailService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-process-attachment-list',
|
||||
@@ -41,14 +41,9 @@ export class ProcessAttachmentListComponent implements OnChanges {
|
||||
attachments: any[] = [];
|
||||
isLoading: boolean = true;
|
||||
|
||||
constructor(translateService: AlfrescoTranslationService,
|
||||
private activitiContentService: ActivitiContentService,
|
||||
constructor(private activitiContentService: ActivitiContentService,
|
||||
private contentService: ContentService,
|
||||
private thumbnailService: ThumbnailService) {
|
||||
|
||||
if (translateService) {
|
||||
translateService.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { TaskListService } from 'ng2-activiti-tasklist';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { ProcessService } from './../services/process.service';
|
||||
|
||||
@Component({
|
||||
@@ -37,16 +36,6 @@ export class ProcessCommentsComponent {
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param translate Translation service
|
||||
*/
|
||||
constructor(translate: AlfrescoTranslationService) {
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
}
|
||||
|
||||
onError(error: any) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ describe('ActivitiFilters', () => {
|
||||
beforeEach(() => {
|
||||
logService = new LogServiceMock();
|
||||
activitiService = new ProcessService(null, logService);
|
||||
filterList = new ProcessFiltersComponent(null, activitiService);
|
||||
filterList = new ProcessFiltersComponent(activitiService);
|
||||
});
|
||||
|
||||
it('should return the filter task list', (done) => {
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
import { FilterParamsModel, FilterProcessRepresentationModel } from './../models/filter-process.model';
|
||||
import { ProcessService } from './../services/process.service';
|
||||
@@ -56,13 +55,8 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
|
||||
|
||||
filters: FilterProcessRepresentationModel [] = [];
|
||||
|
||||
constructor(translate: AlfrescoTranslationService,
|
||||
private activiti: ProcessService) {
|
||||
constructor(private activiti: ProcessService) {
|
||||
this.filter$ = new Observable<FilterProcessRepresentationModel>(observer => this.filterObserver = observer).share();
|
||||
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { TaskDetailsEvent } from 'ng2-activiti-tasklist';
|
||||
import { AlfrescoTranslationService, LogService } from 'ng2-alfresco-core';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
|
||||
import { ProcessInstance } from '../models/process-instance.model';
|
||||
import { ProcessService } from './../services/process.service';
|
||||
@@ -66,13 +66,8 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
|
||||
* @param translate Translation service
|
||||
* @param activitiProcess Process service
|
||||
*/
|
||||
constructor(translate: AlfrescoTranslationService,
|
||||
private activitiProcess: ProcessService,
|
||||
constructor(private activitiProcess: ProcessService,
|
||||
private logService: LogService) {
|
||||
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService, CardViewDateItemModel, CardViewItem, CardViewTextItemModel } from 'ng2-alfresco-core';
|
||||
import { CardViewDateItemModel, CardViewItem, CardViewTextItemModel } from 'ng2-alfresco-core';
|
||||
import { ProcessInstance } from '../models/process-instance.model';
|
||||
|
||||
@Component({
|
||||
@@ -31,13 +31,6 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
|
||||
|
||||
properties: CardViewItem [];
|
||||
|
||||
constructor(translate: AlfrescoTranslationService) {
|
||||
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.refreshData();
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { TaskDetailsEvent, TaskDetailsModel } from 'ng2-activiti-tasklist';
|
||||
import { AlfrescoTranslationService, LogService } from 'ng2-alfresco-core';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
import { ProcessInstance } from '../models/process-instance.model';
|
||||
import { ProcessService } from './../services/process.service';
|
||||
@@ -65,13 +65,8 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges {
|
||||
@Output()
|
||||
taskClick: EventEmitter<TaskDetailsEvent> = new EventEmitter<TaskDetailsEvent>();
|
||||
|
||||
constructor(translate: AlfrescoTranslationService,
|
||||
private activitiProcess: ProcessService,
|
||||
constructor(private activitiProcess: ProcessService,
|
||||
private logService: LogService) {
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
|
||||
this.task$ = new Observable<TaskDetailsModel>(observer => this.taskObserver = observer).share();
|
||||
this.completedTask$ = new Observable<TaskDetailsModel>(observer => this.completedTaskObserver = observer).share();
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, DebugElement, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { DataCellEvent, DataTableAdapter, ObjectDataRow, ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||
import { ProcessInstanceVariable } from './../models/process-instance-variable.model';
|
||||
import { ProcessService } from './../services/process.service';
|
||||
@@ -67,13 +66,7 @@ export class ProcessInstanceVariablesComponent implements OnInit, OnChanges {
|
||||
* @param translate Translation service
|
||||
* @param activitiProcess Process service
|
||||
*/
|
||||
constructor(translate: AlfrescoTranslationService,
|
||||
private activitiProcess: ProcessService) {
|
||||
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
|
||||
constructor(private activitiProcess: ProcessService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService, DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { DataColumn, DataRowEvent, DataSorting, DataTableAdapter, ObjectDataRow, ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||
import { ProcessFilterRequestRepresentation } from '../models/process-instance-filter.model';
|
||||
import { ProcessInstance } from '../models/process-instance.model';
|
||||
@@ -69,11 +69,7 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit
|
||||
{ type: 'text', key: 'created', title: 'Created', cssClass: 'hidden', sortable: true }
|
||||
];
|
||||
|
||||
constructor(private processService: ProcessService,
|
||||
translate: AlfrescoTranslationService) {
|
||||
if (translate !== null) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
constructor(private processService: ProcessService) {
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { RestVariable } from 'alfresco-js-api';
|
||||
import { StartFormComponent } from 'ng2-activiti-form';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { ProcessDefinitionRepresentation } from './../models/process-definition.model';
|
||||
import { ProcessInstance } from './../models/process-instance.model';
|
||||
import { ProcessService } from './../services/process.service';
|
||||
@@ -56,12 +55,7 @@ export class StartProcessInstanceComponent implements OnChanges {
|
||||
|
||||
errorMessageId: string = '';
|
||||
|
||||
constructor(translate: AlfrescoTranslationService,
|
||||
private activitiProcess: ProcessService) {
|
||||
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
|
||||
}
|
||||
constructor(private activitiProcess: ProcessService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
Reference in New Issue
Block a user