[ADF-3829] Add multiple select checkbox to tasks and process cloud APS2 (#4210)

* [ADF-3829] Add multiple select checkbox to tasks and process cloud components in Demo-Shell

* [ADF-3829] A settings tab has been added to Process Cloud

* [ADF-3829] Remove unused imports

* [ADF-3829] Improve streamer of settings

* [ADF-3829] Create new cloud settings component with all its attributes for better structure and understanding

* [ADF-3829] Add localization for cloud settings component
This commit is contained in:
davidcanonieto
2019-02-04 14:34:55 +00:00
committed by Eugenio Romano
parent febd8b6ab1
commit f00fd1ad01
15 changed files with 265 additions and 39 deletions

View File

@@ -191,6 +191,10 @@
"TASK-AUDIT-LOG": "Task Audit log", "TASK-AUDIT-LOG": "Task Audit log",
"TASK-SHOW-HEADER": "Show details header" "TASK-SHOW-HEADER": "Show details header"
}, },
"PS_CLOUD_TAB": {
"APPS_TAB": "App",
"SETTINGS_TAB": "Settings"
},
"FORM-LIST": { "FORM-LIST": {
"STORE": "Store", "STORE": "Store",
"RESTORE": "Restore" "RESTORE": "Restore"
@@ -300,5 +304,10 @@
"RUNTIME": "Runtime", "RUNTIME": "Runtime",
"DESCRIPTION": "Description" "DESCRIPTION": "Description"
} }
},
"SETTINGS_CLOUD": {
"MULTISELECTION": "Multiselection",
"TESTING_MODE": "Testing Mode",
"SELECTION_MODE": "Selection Mode"
} }
} }

View File

@@ -77,6 +77,7 @@ import { CloudFiltersDemoComponent } from './components/app-layout/cloud/cloud-f
import { StartProcessCloudDemoComponent } from './components/app-layout/cloud/start-process-cloud-demo.component'; import { StartProcessCloudDemoComponent } from './components/app-layout/cloud/start-process-cloud-demo.component';
import { DocumentListDemoComponent } from './components/document-list/document-list-demo.component'; import { DocumentListDemoComponent } from './components/document-list/document-list-demo.component';
import { PeopleGroupCloudDemoComponent } from './components/app-layout/cloud/people-groups-cloud-demo.component'; import { PeopleGroupCloudDemoComponent } from './components/app-layout/cloud/people-groups-cloud-demo.component';
import { CloudSettingsComponent } from './components/app-layout/cloud/cloud-settings.component';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -138,7 +139,8 @@ import { PeopleGroupCloudDemoComponent } from './components/app-layout/cloud/peo
CloudBreadcrumbsComponent, CloudBreadcrumbsComponent,
CloudFiltersDemoComponent, CloudFiltersDemoComponent,
DocumentListDemoComponent, DocumentListDemoComponent,
PeopleGroupCloudDemoComponent PeopleGroupCloudDemoComponent,
CloudSettingsComponent
], ],
providers: [ providers: [
{ {

View File

@@ -1,7 +1,8 @@
<adf-toolbar> <adf-toolbar>
<div fxLayout="column" fxLayoutAlign="center" > <div fxLayout="column" fxLayoutAlign="center">
<div fxLayout="row"> <div fxLayout="row">
<div class="adf-app-crumb">{{applicationName + ' >'}} </div> <div class="adf-filter-crumb"> {{filterName | translate}}</div> <div class="adf-app-crumb">{{applicationName + ' >'}} </div>
<div class="adf-filter-crumb"> {{filterName | translate}}</div>
</div> </div>
</div> </div>
</adf-toolbar> </adf-toolbar>

View File

@@ -1,4 +1,6 @@
<div fxFill fxLayout> <mat-tab-group fxFill class="adf-cloud-layout-tab-body">
<mat-tab label="{{'PS_CLOUD_TAB.APPS_TAB' | translate}}">
<div fxFill fxLayout>
<adf-sidenav-layout fxFlex [sidenavMin]="70" [sidenavMax]="270" [stepOver]="780"> <adf-sidenav-layout fxFlex [sidenavMin]="70" [sidenavMax]="270" [stepOver]="780">
<adf-sidenav-layout-header> <adf-sidenav-layout-header>
<ng-template> <ng-template>
@@ -7,8 +9,7 @@
</adf-sidenav-layout-header> </adf-sidenav-layout-header>
<adf-sidenav-layout-navigation> <adf-sidenav-layout-navigation>
<ng-template> <ng-template>
<adf-sidebar-action-menu [expanded]="true" [width]="205" <adf-sidebar-action-menu [expanded]="true" [width]="205" title="{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.CREATE' | translate}}">
title="{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.CREATE' | translate}}">
<mat-icon adf-sidebar-menu-title-icon>arrow_drop_down</mat-icon> <mat-icon adf-sidebar-menu-title-icon>arrow_drop_down</mat-icon>
<div adf-sidebar-menu-options> <div adf-sidebar-menu-options>
<button mat-menu-item data-automation-id="btn-start-task" (click)="onStartTask()"> <button mat-menu-item data-automation-id="btn-start-task" (click)="onStartTask()">
@@ -32,4 +33,9 @@
</ng-template> </ng-template>
</adf-sidenav-layout-content> </adf-sidenav-layout-content>
</adf-sidenav-layout> </adf-sidenav-layout>
</div> </div>
</mat-tab>
<mat-tab label="{{'PS_CLOUD_TAB.SETTINGS_TAB' | translate}}">
<app-cloud-settings></app-cloud-settings>
</mat-tab>
</mat-tab-group>

View File

@@ -1,3 +1,7 @@
.adf-cloud-layout-overflow { .adf-cloud-layout-overflow {
overflow: auto; overflow: auto;
} }
.adf-cloud-layout-tab-body .mat-tab-body-wrapper {
height: 100%;
}

View File

@@ -32,7 +32,7 @@ export class CloudLayoutComponent implements OnInit {
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private cloudLayoutService: CloudLayoutService private cloudLayoutService: CloudLayoutService
) {} ) { }
ngOnInit() { ngOnInit() {
let root: string = ''; let root: string = '';

View File

@@ -0,0 +1,18 @@
<div fxFlex fxLayout="column" class="adf-settings-container">
<mat-checkbox [color]="'primary'" [checked]="multiselect" (change)="toggleMultiselect()" data-automation-id="multiSelection">
{{ 'SETTINGS_CLOUD.MULTISELECTION' | translate }}
</mat-checkbox>
<mat-checkbox [color]="'primary'" [checked]="testingMode" (change)="toggleTestingMode()" data-automation-id="testingMode">
{{ 'SETTINGS_CLOUD.TESTING_MODE' | translate }}
</mat-checkbox>
<mat-form-field>
<mat-label>
{{ 'SETTINGS_CLOUD.SELECTION_MODE' | translate }}
</mat-label>
<mat-select [(ngModel)]="selectionMode" (selectionChange)="onSelectionModeChange()">
<mat-option *ngFor="let option of selectionModeOptions" [value]="option.value">
{{ option.title }}
</mat-option>
</mat-select>
</mat-form-field>
</div>

View File

@@ -0,0 +1,7 @@
.adf-settings-container {
padding: 20px 30px;
}
.adf-settings-container mat-form-field {
max-width: 200px;
}

View File

@@ -0,0 +1,78 @@
/*!
* @license
* Copyright 2016 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.
*/
import { Component, OnInit } from '@angular/core';
import { CloudLayoutService } from './services/cloud-layout.service';
@Component({
selector: 'app-cloud-settings',
templateUrl: './cloud-settings.component.html',
styleUrls: ['./cloud-settings.component.scss']
})
export class CloudSettingsComponent implements OnInit {
multiselect: boolean;
selectionMode: string;
testingMode: boolean;
selectionModeOptions = [
{ value: '', title: 'None' },
{ value: 'single', title: 'Single' },
{ value: 'multiple', title: 'Multiple' }
];
constructor(private cloudLayoutService: CloudLayoutService) { }
ngOnInit() {
this.cloudLayoutService.getCurrentSettings()
.subscribe((settings) => this.setCurrentSettings(settings));
}
setCurrentSettings(settings) {
if (settings.multiselect !== undefined) {
this.multiselect = settings.multiselect;
}
if (settings.testingMode !== undefined) {
this.testingMode = settings.testingMode;
}
if (settings.selectionMode !== undefined) {
this.selectionMode = settings.selectionMode;
}
}
toggleMultiselect() {
this.multiselect = !this.multiselect;
this.setSetting();
}
toggleTestingMode() {
this.testingMode = !this.testingMode;
this.setSetting();
}
onSelectionModeChange() {
this.setSetting();
}
setSetting() {
this.cloudLayoutService.setCurrentSettings({
multiselect: this.multiselect,
testingMode: this.testingMode,
selectionMode: this.selectionMode
});
}
}

View File

@@ -16,10 +16,23 @@
[status]="editedFilter.state" [status]="editedFilter.state"
[name]="editedFilter.processName" [name]="editedFilter.processName"
[sorting]="sortArray" [sorting]="sortArray"
[selectionMode]="selectionMode"
[multiselect]="multiselect"
(rowClick)="onRowClick($event)" (rowClick)="onRowClick($event)"
(rowsSelected)="onRowsSelected($event)"
#processCloud> #processCloud>
</adf-cloud-process-list> </adf-cloud-process-list>
<adf-pagination [target]="processCloud" (changePageSize)="onChangePageSize($event)"> <adf-pagination
[target]="processCloud"
(changePageSize)="onChangePageSize($event)"
(nextPage)="resetSelectedRows()"
(prevPage)="resetSelectedRows()">
</adf-pagination> </adf-pagination>
<div *ngIf="testingMode">
Selected rows:
<ul>
<li *ngFor="let row of selectedRows">{{ row.id }}</li>
</ul>
</div>
</div> </div>
</div> </div>

View File

@@ -48,6 +48,10 @@ export class ProcessesCloudDemoComponent implements OnInit {
filterId: string = ''; filterId: string = '';
sortArray: any = []; sortArray: any = [];
selectedRow: any; selectedRow: any;
multiselect: boolean;
selectionMode: string;
selectedRows: string[] = [];
testingMode: boolean;
processFilterProperties: any[] = []; processFilterProperties: any[] = [];
editedFilter: ProcessFilterCloudModel; editedFilter: ProcessFilterCloudModel;
@@ -75,12 +79,31 @@ export class ProcessesCloudDemoComponent implements OnInit {
this.onFilterChange(params); this.onFilterChange(params);
this.filterId = params.id; this.filterId = params.id;
}); });
this.cloudLayoutService.getCurrentSettings()
.subscribe((settings) => this.setCurrentSettings(settings));
}
setCurrentSettings(settings) {
if (settings.multiselect !== undefined) {
this.multiselect = settings.multiselect;
}
if (settings.testingMode !== undefined) {
this.testingMode = settings.testingMode;
}
if (settings.selectionMode !== undefined) {
this.selectionMode = settings.selectionMode;
}
} }
onChangePageSize(event) { onChangePageSize(event) {
this.userPreference.paginationSize = event.maxItems; this.userPreference.paginationSize = event.maxItems;
} }
resetSelectedRows() {
this.selectedRows = [];
}
onRowClick($event) { onRowClick($event) {
this.selectedRow = $event; this.selectedRow = $event;
} }
@@ -91,9 +114,14 @@ export class ProcessesCloudDemoComponent implements OnInit {
} }
onProcessFilterAction(filterAction: any) { onProcessFilterAction(filterAction: any) {
this.cloudLayoutService.setCurrentProcessFilterParam({id: filterAction.filter.id}); this.cloudLayoutService.setCurrentProcessFilterParam({ id: filterAction.filter.id });
if (filterAction.actionType === ProcessesCloudDemoComponent.ACTION_SAVE_AS) { if (filterAction.actionType === ProcessesCloudDemoComponent.ACTION_SAVE_AS) {
this.router.navigate([`/cloud/${this.applicationName}/processes/`], { queryParams: filterAction.filter }); this.router.navigate([`/cloud/${this.applicationName}/processes/`], { queryParams: filterAction.filter });
} }
} }
onRowsSelected(nodes) {
this.resetSelectedRows();
this.selectedRows = nodes.map((node) => node.obj.entry);
}
} }

View File

@@ -23,14 +23,23 @@ import { Observable, BehaviorSubject } from 'rxjs';
}) })
export class CloudLayoutService { export class CloudLayoutService {
private settings = {
multiselect: false,
testingMode: false,
selectionMode: 'single'
};
private filterTaskSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0}); private filterTaskSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0});
private filterTask$: Observable<any>; private filterTask$: Observable<any>;
private filterProcessSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0}); private filterProcessSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0});
private filterProcess$: Observable<any>; private filterProcess$: Observable<any>;
private settingsSubject: BehaviorSubject<any> = new BehaviorSubject(this.settings);
private settings$: Observable<any>;
constructor() { constructor() {
this.filterTask$ = this.filterTaskSubject.asObservable(); this.filterTask$ = this.filterTaskSubject.asObservable();
this.filterProcess$ = this.filterProcessSubject.asObservable(); this.filterProcess$ = this.filterProcessSubject.asObservable();
this.settings$ = this.settingsSubject.asObservable();
} }
getCurrentTaskFilterParam() { getCurrentTaskFilterParam() {
@@ -48,4 +57,12 @@ export class CloudLayoutService {
setCurrentProcessFilterParam(param) { setCurrentProcessFilterParam(param) {
this.filterProcessSubject.next(param); this.filterProcessSubject.next(param);
} }
getCurrentSettings() {
return this.settings$;
}
setCurrentSettings(param) {
this.settingsSubject.next(param);
}
} }

View File

@@ -16,10 +16,21 @@
[status]="editedFilter.state" [status]="editedFilter.state"
[assignee]="editedFilter.assignment" [assignee]="editedFilter.assignment"
[sorting]="sortArray" [sorting]="sortArray"
(rowClick)="onRowClick($event)"> [multiselect]="multiselect"
[selectionMode]="selectionMode"
(rowClick)="onRowClick($event)"
(rowsSelected)="onRowsSelected($event)">
</adf-cloud-task-list> </adf-cloud-task-list>
<adf-pagination [target]="taskCloud" <adf-pagination [target]="taskCloud"
(changePageSize)="onChangePageSize($event)"> (changePageSize)="onChangePageSize($event)"
(nextPage)="resetSelectedRows()"
(prevPage)="resetSelectedRows()">
</adf-pagination> </adf-pagination>
<div *ngIf="testingMode">
Selected rows:
<ul>
<li *ngFor="let row of selectedRows" [attr.data-automation-id]="row.id">{{ row.name }}</li>
</ul>
</div>
</div> </div>
</div> </div>

View File

@@ -44,6 +44,10 @@ export class TasksCloudDemoComponent implements OnInit {
taskFilterProperties: any[] = []; taskFilterProperties: any[] = [];
filterId; filterId;
multiselect: boolean;
selectedRows: string[] = [];
testingMode: boolean;
selectionMode: string;
constructor( constructor(
private cloudLayoutService: CloudLayoutService, private cloudLayoutService: CloudLayoutService,
@@ -69,15 +73,41 @@ export class TasksCloudDemoComponent implements OnInit {
this.onFilterChange(params); this.onFilterChange(params);
this.filterId = params.id; this.filterId = params.id;
}); });
this.cloudLayoutService.getCurrentSettings()
.subscribe((settings) => this.setCurrentSettings(settings));
}
setCurrentSettings(settings) {
if (settings.multiselect !== undefined) {
this.multiselect = settings.multiselect;
}
if (settings.testingMode !== undefined) {
this.testingMode = settings.testingMode;
}
if (settings.selectionMode !== undefined) {
this.selectionMode = settings.selectionMode;
}
} }
onChangePageSize(event) { onChangePageSize(event) {
this.userPreference.paginationSize = event.maxItems; this.userPreference.paginationSize = event.maxItems;
} }
resetSelectedRows() {
this.selectedRows = [];
}
onRowClick(taskId) { onRowClick(taskId) {
if (!this.multiselect && this.selectionMode !== 'multiple') {
this.router.navigate([`/cloud/${this.applicationName}/task-details/${taskId}`]); this.router.navigate([`/cloud/${this.applicationName}/task-details/${taskId}`]);
} }
}
onRowsSelected(nodes) {
this.resetSelectedRows();
this.selectedRows = nodes.map((node) => node.obj.entry);
}
onFilterChange(filter: any) { onFilterChange(filter: any) {
this.editedFilter = Object.assign({}, filter); this.editedFilter = Object.assign({}, filter);

View File

@@ -5,6 +5,8 @@
[selectionMode]="selectionMode" [selectionMode]="selectionMode"
[multiselect]="multiselect" [multiselect]="multiselect"
(rowClick)="onRowClick($event)" (rowClick)="onRowClick($event)"
(row-select)="onRowSelect($event)"
(row-unselect)="onRowUnselect($event)"
(row-keyup)="onRowKeyUp($event)"> (row-keyup)="onRowKeyUp($event)">
<adf-loading-content-template> <adf-loading-content-template>
<ng-template> <ng-template>