[AAE-4379] i18n fixes (#6515)

* add missing translations

* add missing translations

* fix unit tests

* reduce overhead

* update e2e

* update e2e

* cleanup e2e

* cleanup e2e

* cleanup e2e

* update e2e

* update e2e

* update code

* update code

* update code

* update code

* code fixes

* code fixes

* code fixes
This commit is contained in:
Denys Vuika
2021-01-11 09:30:45 +00:00
committed by GitHub
parent d369fa6925
commit f8526c4dc0
38 changed files with 1373 additions and 1143 deletions

View File

@@ -122,17 +122,47 @@
"ADF_CLOUD_TASK_FILTERS": {
"MY_TASKS": "My Tasks",
"QUEUED_TASKS": "Queued Tasks",
"COMPLETED_TASKS": "Completed Tasks"
"COMPLETED_TASKS": "Completed Tasks",
"STATUS": {
"ALL": "All",
"CREATED": "Created",
"ASSIGNED": "Assigned",
"SUSPENDED": "Suspended",
"CANCELLED": "Cancelled",
"COMPLETED": "Completed"
},
"DIRECTION": {
"ASCENDING": "Ascending",
"DESCENDING": "Descending"
}
},
"ADF_CLOUD_SERVICE_TASK_FILTERS": {
"ALL_SERVICE_TASKS": "All Service Tasks",
"ERRORED_TASKS": "Errored Tasks",
"COMPLETED_TASKS": "Completed Tasks"
"COMPLETED_TASKS": "Completed Tasks",
"STATUS": {
"ALL": "All",
"STARTED": "Started",
"COMPLETED": "Completed",
"CANCELLED": "Cancelled",
"ERROR": "Error"
}
},
"ADF_CLOUD_PROCESS_FILTERS": {
"ALL_PROCESSES": "All",
"RUNNING_PROCESSES": "Running",
"COMPLETED_PROCESSES": "Completed"
"COMPLETED_PROCESSES": "Completed",
"STATUS": {
"ALL": "All",
"RUNNING": "Running",
"SUSPENDED": "Suspended",
"CANCELLED": "Cancelled",
"COMPLETED": "Completed"
},
"DIRECTION": {
"ASCENDING": "Ascending",
"DESCENDING": "Descending"
}
},
"ADF_CLOUD_START_TASK": {
"ERROR": {

View File

@@ -390,9 +390,9 @@ describe('EditProcessFilterCloudComponent', () => {
expect(stateElement).toBeDefined();
expect(sortElement).toBeDefined();
expect(orderElement).toBeDefined();
expect(stateElement.innerText.trim()).toEqual('RUNNING');
expect(stateElement.innerText.trim()).toEqual('ADF_CLOUD_PROCESS_FILTERS.STATUS.RUNNING');
expect(sortElement.innerText.trim()).toEqual('ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.ID');
expect(orderElement.innerText.trim()).toEqual('ASC');
expect(orderElement.innerText.trim()).toEqual('ADF_CLOUD_PROCESS_FILTERS.DIRECTION.ASCENDING');
});
}));

View File

@@ -32,6 +32,11 @@ import { ProcessCloudService } from '../../services/process-cloud.service';
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
import { ApplicationVersionModel } from '../../../models/application-version.model';
export interface DropdownOption {
value: string;
label: string;
}
@Component({
selector: 'adf-cloud-edit-process-filter',
templateUrl: './edit-process-filter-cloud.component.html',
@@ -94,21 +99,26 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
processFilter: ProcessFilterCloudModel;
changedProcessFilter: ProcessFilterCloudModel;
status = [
{ label: 'ALL', value: '' },
{ label: 'RUNNING', value: 'RUNNING' },
{ label: 'SUSPENDED', value: 'SUSPENDED' },
{ label: 'CANCELLED', value: 'CANCELLED' },
{ label: 'COMPLETED', value: 'COMPLETED' }
status: Array<DropdownOption> = [
{ value: '', label: 'ADF_CLOUD_PROCESS_FILTERS.STATUS.ALL' },
{ value: 'RUNNING', label: 'ADF_CLOUD_PROCESS_FILTERS.STATUS.RUNNING' },
{ value: 'SUSPENDED', label: 'ADF_CLOUD_PROCESS_FILTERS.STATUS.SUSPENDED' },
{ value: 'CANCELLED', label: 'ADF_CLOUD_PROCESS_FILTERS.STATUS.CANCELLED' },
{ value: 'COMPLETED', label: 'ADF_CLOUD_PROCESS_FILTERS.STATUS.COMPLETED' }
];
directions: Array<DropdownOption> = [
{ value: 'ASC', label: 'ADF_CLOUD_PROCESS_FILTERS.DIRECTION.ASCENDING' },
{ value: 'DESC', label: 'ADF_CLOUD_PROCESS_FILTERS.DIRECTION.DESCENDING' }
];
directions = [{ label: 'ASC', value: 'ASC' }, { label: 'DESC', value: 'DESC' }];
actionDisabledForDefault = [
EditProcessFilterCloudComponent.ACTION_SAVE,
EditProcessFilterCloudComponent.ACTION_DELETE
];
applicationNames: any[] = [];
allProcessDefinitionNamesOption = { label: 'All', value: '' };
allProcessDefinitionNamesOption: DropdownOption = {
label: 'ADF_CLOUD_PROCESS_FILTERS.STATUS.ALL',
value: ''
};
processDefinitionNames: any[] = [];
formHasBeenChanged = false;
editProcessFilterForm: FormGroup;

View File

@@ -73,7 +73,7 @@ export class ProcessListCloudService extends BaseCloudService {
return queryParam;
}
private buildFilterForAllStatus() {
private buildFilterForAllStatus(): string[] {
return ['RUNNING', 'SUSPENDED', 'CANCELLED', 'COMPLETED'];
}

View File

@@ -29,6 +29,11 @@ import { IdentityGroupModel, IdentityUserModel, TranslationService, UserPreferen
import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component';
import { MatDialog } from '@angular/material/dialog';
export interface DropdownOption {
value: string;
label: string;
}
@Directive()
// tslint:disable-next-line: directive-class-suffix
export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnChanges, OnDestroy {
@@ -44,10 +49,6 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
public static ORDER: string = 'order';
public static DEFAULT_ACTIONS = ['save', 'saveAs', 'delete'];
public static FORMAT_DATE: string = 'DD/MM/YYYY';
public static DIRECTIONS = [
{ label: 'ASC', value: 'ASC' },
{ label: 'DESC', value: 'DESC' }
];
public static ACTIONS_DISABLED_BY_DEFAULT = [
BaseEditTaskFilterCloudComponent.ACTION_SAVE,
BaseEditTaskFilterCloudComponent.ACTION_DELETE
@@ -93,14 +94,22 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
@Output()
action = new EventEmitter<TaskFilterAction>();
protected applicationNames: any[] = [];
protected processDefinitionNames: any[] = [];
protected applicationNames: DropdownOption[] = [];
protected processDefinitionNames: DropdownOption[] = [];
protected formHasBeenChanged = false;
editTaskFilterForm: FormGroup;
taskFilterProperties: TaskFilterProperties[] = [];
taskFilterActions: TaskFilterAction[] = [];
toggleFilterActions: boolean = false;
allProcessDefinitionNamesOption = { label: 'All', value: '' };
sortDirections: DropdownOption[] = [
{ value: 'ASC', label: 'ADF_CLOUD_TASK_FILTERS.DIRECTION.ASCENDING' },
{ value: 'DESC', label: 'ADF_CLOUD_TASK_FILTERS.DIRECTION.DESCENDING' }
];
allProcessDefinitionNamesOption: DropdownOption = {
value: '',
label: 'ADF_CLOUD_TASK_FILTERS.STATUS.ALL'
};
taskFilter: T;
changedTaskFilter: T;
@@ -314,7 +323,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
this.checkMandatorySortProperties();
return this.sortProperties.map((property: string) => {
return { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
return { label: property, value: property };
});
}

View File

@@ -381,14 +381,13 @@ describe('EditServiceTaskFilterCloudComponent', () => {
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
const orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
expect(assigneeElement).toBeDefined();
expect(stateElement.textContent.trim()).toBe('COMPLETED');
expect(sortElement.textContent.trim()).toBe('Id');
expect(orderElement.textContent.trim()).toBe('ASC');
expect(stateElement.textContent.trim()).toBe('ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.COMPLETED');
expect(sortElement.textContent.trim()).toBe('id');
expect(orderElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.DIRECTION.ASCENDING');
});
}));
it('should display all the statuses that are defined in the task filter', async(() => {
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
@@ -399,11 +398,11 @@ describe('EditServiceTaskFilterCloudComponent', () => {
const statusOptions = fixture.debugElement.queryAll(By.css('[data-automation-id="adf-cloud-edit-task-property-options-status"]'));
expect(statusOptions[0].nativeElement.textContent.trim()).toBe('ALL');
expect(statusOptions[1].nativeElement.textContent.trim()).toBe('STARTED');
expect(statusOptions[2].nativeElement.textContent.trim()).toBe('COMPLETED');
expect(statusOptions[3].nativeElement.textContent.trim()).toBe('CANCELLED');
expect(statusOptions[4].nativeElement.textContent.trim()).toBe('ERROR');
expect(statusOptions[0].nativeElement.textContent.trim()).toBe('ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.ALL');
expect(statusOptions[1].nativeElement.textContent.trim()).toBe('ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.STARTED');
expect(statusOptions[2].nativeElement.textContent.trim()).toBe('ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.COMPLETED');
expect(statusOptions[3].nativeElement.textContent.trim()).toBe('ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.CANCELLED');
expect(statusOptions[4].nativeElement.textContent.trim()).toBe('ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.ERROR');
}));
it('should display sort drop down', async(() => {

View File

@@ -28,7 +28,7 @@ import { TranslationService, UserPreferencesService } from '@alfresco/adf-core';
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
import { TaskCloudService } from '../../../services/task-cloud.service';
import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service';
import { BaseEditTaskFilterCloudComponent } from './base-edit-task-filter-cloud.component';
import { BaseEditTaskFilterCloudComponent, DropdownOption } from './base-edit-task-filter-cloud.component';
@Component({
selector: 'adf-cloud-edit-service-task-filter',
@@ -91,17 +91,19 @@ export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloud
return this.serviceTaskFilterCloudService.getTaskListFilters(this.appName);
}
private getDefaultProperties() {
private getStatusOptions(): DropdownOption[] {
return [
{ label: 'ALL', value: '' },
{ label: 'STARTED', value: 'STARTED' },
{ label: 'COMPLETED', value: 'COMPLETED' },
{ label: 'CANCELLED', value: 'CANCELLED' },
{ label: 'ERROR', value: 'ERROR' }
{ value: '', label: 'ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.ALL' },
{ value: 'STARTED', label: 'ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.STARTED' },
{ value: 'COMPLETED', label: 'ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.COMPLETED' },
{ value: 'CANCELLED', label: 'ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.CANCELLED' },
{ value: 'ERROR', label: 'ADF_CLOUD_SERVICE_TASK_FILTERS.STATUS.ERROR' }
];
}
createTaskFilterProperties(): TaskFilterProperties[] {
const statusOptions = this.getStatusOptions();
return [
{
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.APP_NAME',
@@ -145,15 +147,15 @@ export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloud
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.DIRECTION',
type: 'select',
key: 'order',
value: this.taskFilter.order || EditServiceTaskFilterCloudComponent.DIRECTIONS[0].value,
options: EditServiceTaskFilterCloudComponent.DIRECTIONS
value: this.taskFilter.order || this.sortDirections[0].value,
options: [...this.sortDirections]
},
{
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.STATUS',
type: 'select',
key: 'status',
value: this.taskFilter.status || this.getDefaultProperties()[0].value,
options: this.getDefaultProperties()
value: this.taskFilter.status || statusOptions[0].value,
options: statusOptions
},
{
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.STARTED_DATE',

View File

@@ -396,9 +396,9 @@ describe('EditTaskFilterCloudComponent', () => {
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
const orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
expect(assigneeElement).toBeDefined();
expect(stateElement.textContent.trim()).toBe('CREATED');
expect(sortElement.textContent.trim()).toBe('Id');
expect(orderElement.textContent.trim()).toBe('ASC');
expect(stateElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.CREATED');
expect(sortElement.textContent.trim()).toBe('id');
expect(orderElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.DIRECTION.ASCENDING');
});
}));
@@ -414,12 +414,12 @@ describe('EditTaskFilterCloudComponent', () => {
const statusOptions = fixture.debugElement.queryAll(By.css('[data-automation-id="adf-cloud-edit-task-property-options-status"]'));
expect(statusOptions[0].nativeElement.textContent.trim()).toBe('ALL');
expect(statusOptions[1].nativeElement.textContent.trim()).toBe('CREATED');
expect(statusOptions[2].nativeElement.textContent.trim()).toBe('ASSIGNED');
expect(statusOptions[3].nativeElement.textContent.trim()).toBe('SUSPENDED');
expect(statusOptions[4].nativeElement.textContent.trim()).toBe('CANCELLED');
expect(statusOptions[5].nativeElement.textContent.trim()).toBe('COMPLETED');
expect(statusOptions[0].nativeElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.ALL');
expect(statusOptions[1].nativeElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.CREATED');
expect(statusOptions[2].nativeElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.ASSIGNED');
expect(statusOptions[3].nativeElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.SUSPENDED');
expect(statusOptions[4].nativeElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.CANCELLED');
expect(statusOptions[5].nativeElement.textContent.trim()).toBe('ADF_CLOUD_TASK_FILTERS.STATUS.COMPLETED');
}));
it('should display sort drop down', async(() => {

View File

@@ -30,7 +30,7 @@ import { TranslationService, UserPreferencesService } from '@alfresco/adf-core';
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
import { DateCloudFilterType } from '../../../../models/date-cloud-filter.model';
import { TaskCloudService } from '../../../services/task-cloud.service';
import { BaseEditTaskFilterCloudComponent } from './base-edit-task-filter-cloud.component';
import { BaseEditTaskFilterCloudComponent, DropdownOption } from './base-edit-task-filter-cloud.component';
@Component({
selector: 'adf-cloud-edit-task-filter',
@@ -140,18 +140,21 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
];
}
private getDefaultProperties() {
private getStatusOptions(): DropdownOption[] {
return [
{ label: 'ALL', value: '' },
{ label: 'CREATED', value: 'CREATED' },
{ label: 'ASSIGNED', value: 'ASSIGNED' },
{ label: 'SUSPENDED', value: 'SUSPENDED' },
{ label: 'CANCELLED', value: 'CANCELLED' },
{ label: 'COMPLETED', value: 'COMPLETED' }
{ value: '', label: 'ADF_CLOUD_TASK_FILTERS.STATUS.ALL' },
{ value: 'CREATED', label: 'ADF_CLOUD_TASK_FILTERS.STATUS.CREATED' },
{ value: 'ASSIGNED', label: 'ADF_CLOUD_TASK_FILTERS.STATUS.ASSIGNED' },
{ value: 'SUSPENDED', label: 'ADF_CLOUD_TASK_FILTERS.STATUS.SUSPENDED' },
{ value: 'CANCELLED', label: 'ADF_CLOUD_TASK_FILTERS.STATUS.CANCELLED' },
{ value: 'COMPLETED', label: 'ADF_CLOUD_TASK_FILTERS.STATUS.COMPLETED' }
];
}
createTaskFilterProperties(): TaskFilterProperties[] {
const statusOptions = this.getStatusOptions();
const sortProperties = this.createSortProperties;
return [
{
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.APP_NAME',
@@ -170,8 +173,8 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STATUS',
type: 'select',
key: 'status',
value: this.taskFilter.status || this.getDefaultProperties()[0].value,
options: this.getDefaultProperties()
value: this.taskFilter.status || statusOptions[0].value,
options: statusOptions
},
{
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT',
@@ -233,15 +236,15 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
type: 'select',
key: 'sort',
value: this.taskFilter.sort || this.createSortProperties[0].value,
options: this.createSortProperties
value: this.taskFilter.sort || sortProperties[0].value,
options: sortProperties
},
{
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DIRECTION',
type: 'select',
key: 'order',
value: this.taskFilter.order || EditTaskFilterCloudComponent.DIRECTIONS[0].value,
options: EditTaskFilterCloudComponent.DIRECTIONS
value: this.taskFilter.order || this.sortDirections[0].value,
options: [...this.sortDirections]
},
{
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STAND_ALONE',

View File

@@ -175,7 +175,7 @@ export class DataTableComponentPage {
sortedList = sortedList.sort(this.sortPriority);
}
if (sortOrder.toLocaleLowerCase() === 'desc') {
if (['desc', 'descending'].includes(sortOrder.toLocaleLowerCase())) {
sortedList = sortedList.reverse();
}

View File

@@ -21,6 +21,15 @@ import { BrowserActions } from '../../core/utils/browser-actions';
import { DropdownPage } from '../../core/pages/material/dropdown.page';
import { PeopleCloudComponentPage } from './people-cloud-component.page';
export interface FilterProps {
name?: string;
status?: string;
sort?: string;
order?: string;
initiator?: string;
processName?: string;
}
export class EditProcessFilterCloudComponentPage {
customiseFilter = element(by.id('adf-edit-process-filter-sub-title-id'));
@@ -205,14 +214,14 @@ export class EditProcessFilterCloudComponentPage {
await BrowserActions.click(this.saveButton);
}
async setFilter({ name = '', status = '', sort = '', order = '', initiator = '', processName = '' }): Promise<void> {
async setFilter(props: FilterProps): Promise<void> {
await this.openFilter();
if (name) { await this.setProcessName(name); }
if (status) { await this.setStatusFilterDropDown(status); }
if (sort) { await this.setSortFilterDropDown(sort); }
if (order) { await this.setOrderFilterDropDown(order); }
if (initiator) { await this.setInitiator(initiator); }
if (processName) { await this.setProcessName(processName); }
if (props.name) { await this.setProcessName(props.name); }
if (props.status) { await this.setStatusFilterDropDown(props.status); }
if (props.sort) { await this.setSortFilterDropDown(props.sort); }
if (props.order) { await this.setOrderFilterDropDown(props.order); }
if (props.initiator) { await this.setInitiator(props.initiator); }
if (props.processName) { await this.setProcessName(props.processName); }
await this.openFilter();
}
}

View File

@@ -23,6 +23,8 @@ import { DropdownPage } from '../../core/pages/material/dropdown.page';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { PeopleCloudComponentPage } from './people-cloud-component.page';
export type StatusType = 'All' | 'Created' | 'Assigned' | 'Cancelled' | 'Suspended' | 'Completed';
export class EditTaskFilterCloudComponentPage {
customiseFilter = element(by.id('adf-edit-task-filter-sub-title-id'));
@@ -72,7 +74,7 @@ export class EditTaskFilterCloudComponentPage {
await browser.driver.sleep(1000);
}
async setStatusFilterDropDown(option: string): Promise<void> {
async setStatusFilterDropDown(option: StatusType): Promise<void> {
await this.statusDropdown.selectDropdownOption(option);
await this.dataTable.waitTillContentLoaded();
}