[ADF-5260] Fix Service task list initialization in DemoShell (#6184)

* [ADF-5260] Fix Service task list initialization in DemoShell

* Improve layout
This commit is contained in:
davidcanonieto
2020-09-29 15:09:22 +02:00
committed by GitHub
parent c06310d13c
commit 8453f932aa
5 changed files with 73 additions and 36 deletions

View File

@@ -1,29 +1,43 @@
<div fxLayout="column" fxFill fxLayoutGap="2px"> <div fxLayout="row"
<adf-cloud-edit-service-task-filter fxFill
[id]="'myFilter'" fxLayoutGap="2px">
[filterProperties]="taskFilterProperties.filterProperties" <adf-cloud-service-task-filters [appName]="appName"
[sortProperties]="taskFilterProperties.sortProperties" [filterParam]="{index: 0}"
[actions]="taskFilterProperties.actions" (filterClick)="onTaskFilterSelected($event)">
(filterChange)="onFilterChange($event)">
</adf-cloud-edit-service-task-filter> </adf-cloud-service-task-filters>
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter"> <div fxLayout="column"
<adf-cloud-service-task-list #taskCloud fxFill
fxFlex fxLayoutGap="2px">
[queryParams]="editedFilter"
class="app-cloud-layout-overflow" <adf-cloud-edit-service-task-filter [id]="filterId"
[appName]="editedFilter.appName" [appName]="appName"
[sorting]="sortArray" [filterProperties]="taskFilterProperties.filterProperties"
[multiselect]="multiselect" [sortProperties]="taskFilterProperties.sortProperties"
[selectionMode]="selectionMode" [actions]="taskFilterProperties.actions"
[stickyHeader]="true" (filterChange)="onFilterChange($event)">
[showActions]="actionMenu" </adf-cloud-edit-service-task-filter>
[showContextMenu]="contextMenu"> <div fxLayout="column"
</adf-cloud-service-task-list> fxFlex
<adf-pagination fxLayoutAlign="space-between"
[target]="taskCloud" *ngIf="editedFilter">
(changePageSize)="onChangePageSize($event)" <adf-cloud-service-task-list #taskCloud
(nextPage)="resetSelectedRows()" fxFlex
(prevPage)="resetSelectedRows()"> [queryParams]="editedFilter"
</adf-pagination> class="app-cloud-layout-overflow"
[appName]="editedFilter.appName"
[sorting]="sortArray"
[multiselect]="multiselect"
[selectionMode]="selectionMode"
[stickyHeader]="true"
[showActions]="actionMenu"
[showContextMenu]="contextMenu">
</adf-cloud-service-task-list>
<adf-pagination [target]="taskCloud"
(changePageSize)="onChangePageSize($event)"
(nextPage)="resetSelectedRows()"
(prevPage)="resetSelectedRows()">
</adf-pagination>
</div>
</div> </div>
</div> </div>

View File

@@ -34,6 +34,8 @@ export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
@ViewChild('taskCloud') @ViewChild('taskCloud')
taskCloud: ServiceTaskListCloudComponent; taskCloud: ServiceTaskListCloudComponent;
appName = 'simpleapp';
isFilterLoaded = false; isFilterLoaded = false;
selectedRow: any; selectedRow: any;
@@ -50,6 +52,7 @@ export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
selectedAction: { id: number, name: string, actionType: string}; selectedAction: { id: number, name: string, actionType: string};
selectedContextAction: { id: number, name: string, actionType: string}; selectedContextAction: { id: number, name: string, actionType: string};
selectionMode: string; selectionMode: string;
filterId: string;
private onDestroy$ = new Subject<boolean>(); private onDestroy$ = new Subject<boolean>();
@@ -86,6 +89,11 @@ export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
} }
} }
onTaskFilterSelected(filter: ServiceTaskFilterCloudModel) {
this.filterId = filter.id;
this.editedFilter = filter;
}
onChangePageSize(event: PaginationModel) { onChangePageSize(event: PaginationModel) {
this.userPreference.paginationSize = event.maxItems; this.userPreference.paginationSize = event.maxItems;
} }
@@ -95,6 +103,7 @@ export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
} }
onFilterChange(filter: ServiceTaskFilterCloudModel) { onFilterChange(filter: ServiceTaskFilterCloudModel) {
this.appName = filter.appName;
this.editedFilter = Object.assign({}, filter); this.editedFilter = Object.assign({}, filter);
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })]; this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
} }

View File

@@ -236,7 +236,7 @@ export class ServiceTaskFilterCloudService {
* @returns String of task filters preference key * @returns String of task filters preference key
*/ */
private prepareKey(appName: string): string { private prepareKey(appName: string): string {
return `task-filters-${appName}-${this.identityUserService.getCurrentUserInfo().username}`; return `service-task-filters-${appName}-${this.identityUserService.getCurrentUserInfo().username}`;
} }
/** /**
@@ -262,7 +262,7 @@ export class ServiceTaskFilterCloudService {
key: 'my-service-tasks', key: 'my-service-tasks',
icon: 'inbox', icon: 'inbox',
appName, appName,
status: 'ALL', status: '',
sort: 'startedDate', sort: 'startedDate',
order: 'DESC' order: 'DESC'
} as ServiceTaskFilterCloudModel, } as ServiceTaskFilterCloudModel,

View File

@@ -248,7 +248,7 @@ export abstract class BaseTaskListCloudComponent extends DataTableSchema impleme
} }
isValidSorting(sorting: TaskListCloudSortingModel[]) { isValidSorting(sorting: TaskListCloudSortingModel[]) {
return sorting.length && sorting[0].orderBy && sorting[0].direction; return sorting && sorting.length && sorting[0].orderBy && sorting[0].direction;
} }
abstract load(requestNode); abstract load(requestNode);

View File

@@ -34,7 +34,7 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
static PRESET_KEY = 'adf-cloud-service-task-list.presets'; static PRESET_KEY = 'adf-cloud-service-task-list.presets';
@Input() @Input()
queryParams: { [key: string]: string } = {}; queryParams: { [key: string]: any } = {};
constructor(private taskListCloudService: TaskListCloudService, constructor(private taskListCloudService: TaskListCloudService,
appConfigService: AppConfigService, appConfigService: AppConfigService,
@@ -57,13 +57,27 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
} }
createRequestNode(): ServiceTaskQueryCloudRequestModel { createRequestNode(): ServiceTaskQueryCloudRequestModel {
const requestNode = { const requestNode: ServiceTaskQueryCloudRequestModel = {
...this.queryParams,
appName: this.appName, appName: this.appName,
maxItems: this.size, maxItems: this.size,
skipCount: this.skipCount, skipCount: this.skipCount,
sorting: this.sorting sorting: this.sorting,
}; id: this.queryParams.serviceTaskId,
return <ServiceTaskQueryCloudRequestModel> requestNode; activityName: this.queryParams.activityName,
activityType: this.queryParams.activityType,
completedDate: this.queryParams.completedDate,
elementId: this.queryParams.elementId,
executionId: this.queryParams.executionId,
processDefinitionId: this.queryParams.processDefinitionId,
processDefinitionKey: this.queryParams.processDefinitionKey,
processDefinitionVersion: this.queryParams.processDefinitionVersion,
processInstanceId: this.queryParams.processInstanceId,
serviceFullName: this.queryParams.serviceFullName,
serviceName: this.queryParams.serviceName,
serviceVersion: this.queryParams.serviceVersion,
startedDate: this.queryParams.startedDate,
status: this.queryParams.status
} as ServiceTaskQueryCloudRequestModel;
return requestNode;
} }
} }