mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACA-3722] - rename process name sort option (#5931)
* [ACA-3722] - rename process name sort option * rework unit test * remove unnecesary property * fix e2e * PR changes * fix e2e * fix e2e * fix e2e Co-authored-by: Silviu Popa <p3701014@L3700101120.ness.com>
This commit is contained in:
parent
3b02233481
commit
2d0b09f3e4
@ -131,8 +131,8 @@ describe('Edit process filters cloud', () => {
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().checkCustomiseFilterHeaderIsExpanded();
|
||||
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('New');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Id');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().setSortFilterDropDown('Name');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Name');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().setSortFilterDropDown('Process Name');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Process Name');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().clickSaveAsButton();
|
||||
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().editProcessFilterDialog().setFilterName('New');
|
||||
@ -143,7 +143,7 @@ describe('Edit process filters cloud', () => {
|
||||
await browser.driver.sleep(1000);
|
||||
|
||||
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('New');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Name');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Process Name');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().clickDeleteButton();
|
||||
|
||||
await browser.driver.sleep(1000);
|
||||
@ -168,8 +168,8 @@ describe('Edit process filters cloud', () => {
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().openFilter();
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().checkCustomiseFilterHeaderIsExpanded();
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Id');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().setSortFilterDropDown('Name');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Name');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().setSortFilterDropDown('Process Name');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Process Name');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().clickSaveButton();
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().openFilter();
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().checkCustomiseFilterHeaderIsExpanded();
|
||||
@ -177,7 +177,7 @@ describe('Edit process filters cloud', () => {
|
||||
await browser.driver.sleep(1000);
|
||||
|
||||
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('New');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Name');
|
||||
await expect(await processCloudDemoPage.editProcessFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Process Name');
|
||||
await processCloudDemoPage.editProcessFilterCloudComponent().clickDeleteButton();
|
||||
});
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
<mat-form-field class="adf-cloud-date-range-picker">
|
||||
<mat-label>{{ 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.DATE_RANGE_TITLE' | translate }}</mat-label>
|
||||
<mat-date-range-input [formGroup]="dateRangeForm" [rangePicker]="picker">
|
||||
<input matStartDate formControlName="from" placeholder="Start date">
|
||||
<input matEndDate formControlName="to" placeholder="End date">
|
||||
<input matStartDate formControlName="from" placeholder="{{ 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.START_DATE' | translate }}">
|
||||
<input matEndDate formControlName="to" placeholder="{{ 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.END_DATE' | translate }}">
|
||||
</mat-date-range-input>
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-date-range-picker #picker (closed)="onDateRangeClosed()"></mat-date-range-picker>
|
||||
|
@ -180,8 +180,10 @@
|
||||
"RANGE": "Date within"
|
||||
},
|
||||
"DATE_RANGE_TITLE": "Start date - End date",
|
||||
"START_DATE": "Start date",
|
||||
"END_DATE": "End date"
|
||||
"START_DATE": "Start Date",
|
||||
"END_DATE": "End date",
|
||||
"ID": "Id",
|
||||
"BUSINESS_KEY": "Business Key"
|
||||
},
|
||||
"ERROR": {
|
||||
"DATE": "Date format DD/MM/YYYY",
|
||||
|
@ -30,7 +30,7 @@
|
||||
[formControlName]="processFilterProperty.key"
|
||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key">
|
||||
<mat-option *ngFor="let propertyOption of processFilterProperty.options" [value]="propertyOption.value" [attr.data-automation-id]="'adf-cloud-edit-process-property-options-' + processFilterProperty.key">
|
||||
{{ propertyOption.label }}
|
||||
{{ propertyOption.label | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
@ -380,7 +380,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
expect(sortElement).toBeDefined();
|
||||
expect(orderElement).toBeDefined();
|
||||
expect(stateElement.innerText.trim()).toEqual('RUNNING');
|
||||
expect(sortElement.innerText.trim()).toEqual('Id');
|
||||
expect(sortElement.innerText.trim()).toEqual('ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.ID');
|
||||
expect(orderElement.innerText.trim()).toEqual('ASC');
|
||||
});
|
||||
}));
|
||||
@ -556,7 +556,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
processDefinitionId: 'process-definition-id',
|
||||
priority: '12'
|
||||
}));
|
||||
component.sortProperties = ['id', 'processName', 'processDefinitionId'];
|
||||
component.sortProperties = ['id', 'name', 'processDefinitionId'];
|
||||
fixture.detectChanges();
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
@ -578,6 +578,29 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display the process name label for the name property', async () => {
|
||||
getProcessFilterByIdSpy.and.returnValue(of({
|
||||
id: 'filter-id',
|
||||
processName: 'process-name',
|
||||
sort: 'my-custom-sort',
|
||||
processDefinitionId: 'process-definition-id',
|
||||
priority: '12'
|
||||
}));
|
||||
component.sortProperties = ['name'];
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-process-property-sort"]');
|
||||
sortElement.click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
|
||||
expect(sortOptions[0].nativeElement.textContent).toEqual(' ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME ');
|
||||
});
|
||||
|
||||
describe('edit filter actions', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -25,7 +25,7 @@ import moment from 'moment-es6';
|
||||
import { Moment } from 'moment';
|
||||
|
||||
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||
import { ProcessFilterCloudModel, ProcessFilterProperties, ProcessFilterAction, ProcessFilterOptions } from '../models/process-filter-cloud.model';
|
||||
import { ProcessFilterCloudModel, ProcessFilterProperties, ProcessFilterAction, ProcessFilterOptions, ProcessSortFilterProperties } from '../models/process-filter-cloud.model';
|
||||
import { TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||
import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component';
|
||||
@ -260,9 +260,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
get createSortProperties(): ProcessFilterOptions[] {
|
||||
this.checkMandatorySortProperties();
|
||||
const sortProperties = this.sortProperties.map((property: string) => {
|
||||
return <ProcessFilterOptions> { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
|
||||
});
|
||||
const defaultSortProperties = this.createProcessSortProperties();
|
||||
const sortProperties = defaultSortProperties.filter((sortProperty: ProcessFilterProperties) => this.isValidProperty(this.sortProperties, sortProperty));
|
||||
return sortProperties;
|
||||
}
|
||||
|
||||
@ -538,6 +537,71 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
];
|
||||
}
|
||||
|
||||
createProcessSortProperties(): ProcessSortFilterProperties[] {
|
||||
return [
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.ID',
|
||||
key: 'id',
|
||||
value: 'id'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME',
|
||||
key: 'name',
|
||||
value: 'name'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.START_DATE',
|
||||
key: 'startDate',
|
||||
value: 'startDate'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STATUS',
|
||||
key: 'status',
|
||||
value: 'status'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.INITIATOR',
|
||||
key: 'initiator',
|
||||
value: 'initiator'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_NAME',
|
||||
key: 'appName',
|
||||
value: 'appName'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_VERSION',
|
||||
key: 'appVersion',
|
||||
value: 'appVersion'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_INS_ID',
|
||||
key: 'processInstanceId',
|
||||
value: 'processInstanceId'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_ID',
|
||||
key: 'processDefinitionId',
|
||||
value: 'processDefinitionId'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_KEY',
|
||||
key: 'processDefinitionKey',
|
||||
value: 'processDefinitionKey'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.LAST_MODIFIED',
|
||||
key: 'lastModified',
|
||||
value: 'lastModified'
|
||||
},
|
||||
{
|
||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.BUSINESS_KEY',
|
||||
key: 'businessKey',
|
||||
value: 'businessKey'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
createProcessFilterProperties(currentProcessFilter: ProcessFilterCloudModel): ProcessFilterProperties[] {
|
||||
return [
|
||||
new ProcessFilterProperties({
|
||||
|
@ -99,3 +99,9 @@ export class ProcessFilterProperties {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProcessSortFilterProperties {
|
||||
label: string;
|
||||
value: string;
|
||||
key: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user