diff --git a/e2e/process-services-cloud/task-list-properties-sort.e2e.ts b/e2e/process-services-cloud/task-list-properties-sort.e2e.ts
index d243964aba..a425c57632 100644
--- a/e2e/process-services-cloud/task-list-properties-sort.e2e.ts
+++ b/e2e/process-services-cloud/task-list-properties-sort.e2e.ts
@@ -39,9 +39,8 @@ describe('Edit task filters and task list properties', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
- let createdTask, notDisplayedTask, priorityTask, subTask,
+ let createdTask, notDisplayedTask, noPriorityTask, lowPriorityTask, normalPriorityTask, hightPriorityTask, subTask,
otherOwnerTask, testUser, groupInfo;
- const priority = 1;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
@@ -59,8 +58,14 @@ describe('Edit task filters and task list properties', () => {
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
- priorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: priority });
- await tasksService.claimTask(priorityTask.entry.id, simpleApp);
+ noPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 0 });
+ lowPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 1 });
+ normalPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 2 });
+ hightPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 3 });
+ await tasksService.claimTask(noPriorityTask.entry.id, simpleApp);
+ await tasksService.claimTask(lowPriorityTask.entry.id, simpleApp);
+ await tasksService.claimTask(normalPriorityTask.entry.id, simpleApp);
+ await tasksService.claimTask(hightPriorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
@@ -193,15 +198,14 @@ describe('Edit task filters and task list properties', () => {
});
it('[C290087] Should display tasks ordered by priority when Priority is selected from sort dropdown', async () => {
- await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee();
await tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ALL');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setSortFilterDropDown('Priority');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('ASC');
- await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Priority', 'NUMBER')).toBe(true);
+ await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Priority', 'PRIORITY')).toBe(true);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
- await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Priority', 'NUMBER')).toBe(true);
+ await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Priority', 'PRIORITY')).toBe(true);
});
it('[C307115] Should display tasks sorted by owner when owner is selected from sort dropdown', async () => {
diff --git a/e2e/process-services-cloud/tasks-custom-filters.e2e.ts b/e2e/process-services-cloud/tasks-custom-filters.e2e.ts
index 3cb8fa51e9..abab5ddfe9 100644
--- a/e2e/process-services-cloud/tasks-custom-filters.e2e.ts
+++ b/e2e/process-services-cloud/tasks-custom-filters.e2e.ts
@@ -56,7 +56,7 @@ describe('Task filters cloud', () => {
assignedTaskName = StringUtil.generateRandomString(), deletedTaskName = StringUtil.generateRandomString();
let assignedTask, deletedTask, testUser, groupInfo;
const orderByNameAndPriority = ['cCreatedTask', 'dCreatedTask', 'eCreatedTask'];
- let priority = 30;
+ let priority = 1;
const nrOfTasks = 3;
beforeAll(async () => {
@@ -77,7 +77,7 @@ describe('Task filters cloud', () => {
await tasksService.deleteTask(deletedTask.entry.id, simpleApp);
for (let i = 0; i < nrOfTasks; i++) {
await tasksService.createStandaloneTask(orderByNameAndPriority[i], simpleApp, { priority: priority });
- priority = priority + 20;
+ priority = priority + 1;
}
const processDefinition = await processDefinitionService
diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json
index 49ea8a1a31..e8cb9672d4 100644
--- a/e2e/protractor.excludes.json
+++ b/e2e/protractor.excludes.json
@@ -14,6 +14,5 @@
"C277000": "ADF-5283 Fix Permission Flaky test",
"C277003": "ADF-5283 Fix Permission Flaky test",
"C277004": "ADF-5283 Fix Permission Flaky test",
- "C299187": "ADF-5285 Failing aspect test",
- "C290087": "https://alfresco.atlassian.net/browse/ADF-5292"
+ "C299187": "ADF-5285 Failing aspect test"
}
diff --git a/lib/core/datatable/components/datatable/datatable.component.html b/lib/core/datatable/components/datatable/datatable.component.html
index 89bcb7836f..94141161b7 100644
--- a/lib/core/datatable/components/datatable/datatable.component.html
+++ b/lib/core/datatable/components/datatable/datatable.component.html
@@ -137,8 +137,8 @@
{{ data.getValue(row, col) }}
-
+
-
+
-
+
-
+
-
+
{
const id1 = element.querySelector('[data-automation-id="text_1');
const id2 = element.querySelector('[data-automation-id="text_2');
- const names = element.querySelectorAll('[data-automation-id="text_undefined"]');
+ const namesId1 = element.querySelector('[data-automation-id="text_foo - bar"]');
+ const namesId2 = element.querySelector('[data-automation-id="text_bar - baz"]');
expect(id1.innerText).toEqual('1');
- expect(names[0].innerText).toEqual('foo - bar');
+ expect(namesId1.innerText).toEqual('foo - bar');
expect(id2.innerText).toEqual('2');
- expect(names[1].innerText).toEqual('bar - baz');
+ expect(namesId2.innerText).toEqual('bar - baz');
expect(dataTable.data.getRows().length).toEqual(2);
- expect(dataTable.resolverFn).toHaveBeenCalledTimes(4);
});
it('should update data columns when columns input changes', () => {
diff --git a/lib/process-services-cloud/src/lib/task/models/public-api.ts b/lib/process-services-cloud/src/lib/task/models/public-api.ts
new file mode 100644
index 0000000000..4ed6cb71fb
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/task/models/public-api.ts
@@ -0,0 +1,18 @@
+/*!
+ * @license
+ * Copyright 2019 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.
+ */
+
+ export * from './task.model';
diff --git a/lib/process-services-cloud/src/lib/task/public-api.ts b/lib/process-services-cloud/src/lib/task/public-api.ts
index e880b3e7d6..45db0b98ca 100644
--- a/lib/process-services-cloud/src/lib/task/public-api.ts
+++ b/lib/process-services-cloud/src/lib/task/public-api.ts
@@ -21,6 +21,7 @@ export * from './start-task/public-api';
export * from './task-header/public-api';
export * from './task-form/public-api';
export * from './directives/public-api';
+export * from './models/public-api';
export * from './services/task-cloud.service';
export * from './services/start-task-cloud.service';
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html
index f70b432ca3..e6a46c1f43 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html
@@ -11,6 +11,7 @@
[actions]="showActions"
[actionsPosition]="actionsPosition"
[contextMenu]="showContextMenu"
+ [resolverFn]="boundReplacePriorityValues"
(showRowActionsMenu)="onShowRowActionsMenu($event)"
(showRowContextMenu)="onShowRowContextMenu($event)"
(executeRowAction)="onExecuteRowAction($event)"
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts
index b94cba2c03..0430993739 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts
@@ -20,13 +20,14 @@ import {
AppConfigService, UserPreferencesService,
DataTableSchema, UserPreferenceValues,
PaginatedComponent, PaginationModel,
- DataRowEvent, CustomEmptyContentTemplateDirective, DataCellEvent, DataRowActionEvent
+ DataRowEvent, CustomEmptyContentTemplateDirective, DataCellEvent, DataRowActionEvent, DataRow, DataColumn
} from '@alfresco/adf-core';
import { taskPresetsCloudDefaultModel } from '../models/task-preset-cloud.model';
import { TaskQueryCloudRequestModel } from '../models/filter-cloud-model';
import { BehaviorSubject, Subject } from 'rxjs';
import { TaskListCloudSortingModel } from '../models/task-list-sorting.model';
import { takeUntil } from 'rxjs/operators';
+import { TaskCloudService } from '../../services/task-cloud.service';
@Directive()
// tslint:disable-next-line: directive-class-suffix
@@ -114,10 +115,12 @@ export abstract class BaseTaskListCloudComponent extends DataTableSchema impleme
selectedInstances: any[];
formattedSorting: any[];
private defaultSorting = { key: 'startDate', direction: 'desc' };
+ boundReplacePriorityValues: Function;
private onDestroy$ = new Subject();
constructor(appConfigService: AppConfigService,
+ private taskCloudService: TaskCloudService,
private userPreferences: UserPreferencesService,
presetKey: string) {
super(appConfigService, presetKey, taskPresetsCloudDefaultModel);
@@ -129,6 +132,7 @@ export abstract class BaseTaskListCloudComponent extends DataTableSchema impleme
totalItems: 0
});
+ this.boundReplacePriorityValues = this.replacePriorityValues.bind(this);
}
ngOnInit() {
@@ -251,6 +255,15 @@ export abstract class BaseTaskListCloudComponent extends DataTableSchema impleme
return sorting && sorting.length && sorting[0].orderBy && sorting[0].direction;
}
+ replacePriorityValues(row: DataRow, column: DataColumn) {
+ return column.key.split('.').reduce((source, key) => {
+ if (key === 'priority' && typeof(source[key]) === 'number') {
+ return source[key] = this.taskCloudService.getPriorityLabel(source[key]);
+ }
+ return source ? source[key] : '';
+ }, row.obj);
+ }
+
abstract load(requestNode);
abstract createRequestNode();
}
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts
index 80053db966..1c69411c7d 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts
@@ -22,6 +22,7 @@ import {
import { ServiceTaskQueryCloudRequestModel } from '../models/service-task-cloud.model';
import { BaseTaskListCloudComponent } from './base-task-list-cloud.component';
import { ServiceTaskListCloudService } from '../services/service-task-list-cloud.service';
+import { TaskCloudService } from '../../services/task-cloud.service';
@Component({
selector: 'adf-cloud-service-task-list',
@@ -38,8 +39,9 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
constructor(private serviceTaskListCloudService: ServiceTaskListCloudService,
appConfigService: AppConfigService,
+ taskCloudService: TaskCloudService,
userPreferences: UserPreferencesService) {
- super(appConfigService, userPreferences, ServiceTaskListCloudComponent.PRESET_KEY);
+ super(appConfigService, taskCloudService, userPreferences, ServiceTaskListCloudComponent.PRESET_KEY);
}
load(requestNode: ServiceTaskQueryCloudRequestModel) {
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts
index 625fc3610a..5cd91b4a9f 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts
@@ -208,7 +208,7 @@ describe('TaskListCloudComponent', () => {
expect(component.rows[0].entry['createdDate']).toBe(1538059139420);
expect(component.rows[0].entry['dueDate']).toBeNull();
expect(component.rows[0].entry['claimedDate']).toBeNull();
- expect(component.rows[0].entry['priority']).toBe('ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.NOT_SET');
+ expect(component.rows[0].entry['priority']).toBe(0);
expect(component.rows[0].entry['category']).toBeNull();
expect(component.rows[0].entry['processDefinitionId']).toBeNull();
expect(component.rows[0].entry['processInstanceId']).toBeNull();
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts
index d65c875e58..72fbe6ea83 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts
@@ -20,9 +20,7 @@ import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
import { TaskQueryCloudRequestModel } from '../models/filter-cloud-model';
import { TaskListCloudService } from '../services/task-list-cloud.service';
import { BaseTaskListCloudComponent } from './base-task-list-cloud.component';
-import { map } from 'rxjs/operators';
import { TaskCloudService } from '../../services/task-cloud.service';
-import { TaskCloudEntryModel, TaskCloudNodePaging } from '../models/task-cloud.model';
@Component({
selector: 'adf-cloud-task-list',
@@ -135,17 +133,15 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent {
candidateGroupId: string = '';
constructor(private taskListCloudService: TaskListCloudService,
- private taskCloudService: TaskCloudService,
appConfigService: AppConfigService,
+ taskCloudService: TaskCloudService,
userPreferences: UserPreferencesService) {
- super(appConfigService, userPreferences, TaskListCloudComponent.PRESET_KEY);
+ super(appConfigService, taskCloudService, userPreferences, TaskListCloudComponent.PRESET_KEY);
}
load(requestNode: TaskQueryCloudRequestModel) {
this.isLoading = true;
- this.taskListCloudService.getTaskByRequest(requestNode).pipe(
- map((tasks: TaskCloudNodePaging) => this.replacePriorityValues(tasks)
- )).subscribe(
+ this.taskListCloudService.getTaskByRequest(requestNode).subscribe(
(tasks) => {
this.rows = tasks.list.entries;
this.success.emit(tasks);
@@ -190,22 +186,4 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent {
};
return new TaskQueryCloudRequestModel(requestNode);
}
-
- private replacePriorityValues(tasks: TaskCloudNodePaging) {
- const entries = tasks.list.entries.map((item: TaskCloudEntryModel) => {
- return {
- entry: {
- ...item.entry,
- ['priority']: this.taskCloudService.getPriorityLabel(item.entry?.priority)
- }
- };
- });
-
- return {
- list: {
- ...tasks.list,
- entries: [...entries]
- }
- };
- }
}
diff --git a/lib/testing/src/lib/core/pages/data-table-component.page.ts b/lib/testing/src/lib/core/pages/data-table-component.page.ts
index f30cd9cd62..fc6672de0c 100644
--- a/lib/testing/src/lib/core/pages/data-table-component.page.ts
+++ b/lib/testing/src/lib/core/pages/data-table-component.page.ts
@@ -171,6 +171,8 @@ export class DataTableComponentPage {
sortedList = sortedList.sort();
} else if (listType.toLocaleLowerCase() === 'number') {
sortedList = sortedList.sort((a, b) => a - b);
+ } else if (listType.toLocaleLowerCase() === 'priority') {
+ sortedList = sortedList.sort(this.sortPriority);
}
if (sortOrder.toLocaleLowerCase() === 'desc') {
@@ -180,6 +182,34 @@ export class DataTableComponentPage {
return initialList.toString() === sortedList.toString();
}
+ sortPriority(a: string, b: string) {
+ if (a === b) {
+ return 0;
+ }
+
+ if (a.toLocaleLowerCase() === 'not set') {
+ return -1;
+ }
+
+ if (a.toLocaleLowerCase() === 'low') {
+ if (b === 'not set') {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+
+ if (a.toLocaleLowerCase() === 'normal') {
+ if (b.toLocaleLowerCase() === 'high') {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+
+ return 1;
+ }
+
async rightClickOnRow(columnName: string, columnValue: string): Promise {
await this.rightClickOnItem(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
@@ -198,7 +228,7 @@ export class DataTableComponentPage {
async rightClickOnItem(columnName: string, columnValue: string): Promise {
const row = this.getRow(columnName, columnValue);
await BrowserActions.rightClick(row);
- }
+ }
getFileHyperlink(filename: string): ElementFinder {
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));