Fix process cloud page (#4075)

* Fix process cloud page

* Use FilterParamModel

* Rollback method

* Fix core unit test related to identity service

* Fix process filters cloud
Get user info from different keys

* Select the my-task filter in case the task has been created

* Add family_name and given_name to the jwt token
This commit is contained in:
Maurizio Vitale
2018-12-12 15:43:57 +00:00
committed by Eugenio Romano
parent 511087f6b1
commit e241779f3a
29 changed files with 261 additions and 240 deletions

View File

@@ -5,7 +5,12 @@
Task Filters
</mat-panel-title>
</mat-expansion-panel-header>
<adf-cloud-task-filters *ngIf="panelOpenStateTask" [appName]="appName" [showIcons]="true" (filterClick)="onTaskFilterSelected($event)">
<adf-cloud-task-filters
*ngIf="panelOpenStateTask"
[appName]="appName"
[showIcons]="true"
[filterParam]="currentTaskFilter$ | async"
(filterClick)="onTaskFilterSelected($event)">
</adf-cloud-task-filters>
</mat-expansion-panel>
@@ -15,7 +20,12 @@
Process Filters
</mat-panel-title>
</mat-expansion-panel-header>
<adf-cloud-process-filters *ngIf="panelOpenStateProcess" [appName]="appName" [showIcons]="true" (filterClick)="onProcessFilterSelected($event)">
<adf-cloud-process-filters
*ngIf="panelOpenStateProcess"
[appName]="appName"
[showIcons]="true"
[filterParam]="currentProcessFilter$ | async"
(filterClick)="onProcessFilterSelected($event)">
</adf-cloud-process-filters>
</mat-expansion-panel>
</mat-accordion>

View File

@@ -15,34 +15,45 @@
* limitations under the License.
*/
import { Component, EventEmitter, ViewEncapsulation, Output, Input } from '@angular/core';
import { Component, ViewEncapsulation, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { CloudLayoutService } from './services/cloud-layout.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-cloud-fillters-demo',
selector: 'app-cloud-filters-demo',
templateUrl: './cloud-filters-demo.component.html',
styleUrls: ['cloud-filters-demo.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class CloudFiltersDemoComponent {
export class CloudFiltersDemoComponent implements OnInit {
@Input()
appName: string;
@Output()
taskFilterSelect: EventEmitter<any> = new EventEmitter<any>();
@Output()
processFilterSelect: EventEmitter<any> = new EventEmitter<any>();
panelOpenStateTask: boolean;
panelOpenStateProcess: boolean;
currentTaskFilter$: Observable<any>;
currentProcessFilter$: Observable<any>;
constructor(private cloudLayoutService: CloudLayoutService, private router: Router) {
}
ngOnInit() {
this.currentTaskFilter$ = this.cloudLayoutService.getCurrentTaskFilterParam();
this.currentProcessFilter$ = this.cloudLayoutService.getCurrentProcessFilterParam();
}
onTaskFilterSelected(filter) {
this.taskFilterSelect.emit(filter);
this.cloudLayoutService.setCurrentTaskFilterParam({id: filter.id});
const currentFilter = Object.assign({}, filter);
this.router.navigate([`/cloud/${this.appName}/tasks/`], { queryParams: currentFilter });
}
onProcessFilterSelected(filter) {
this.processFilterSelect.emit(filter);
this.cloudLayoutService.setCurrentProcessFilterParam({id: filter.id});
const currentFilter = Object.assign({}, filter);
this.router.navigate([`/cloud/${this.appName}/processes/`], { queryParams: currentFilter });
}
}

View File

@@ -17,7 +17,7 @@
</button>
</div>
</adf-sidebar-action-menu>
<app-cloud-fillters-demo [appName]="applicationName" (taskFilterSelect)="onTaskFilterSelected($event)" (processFilterSelect)="onProcessFilterSelected($event)"></app-cloud-fillters-demo>
<app-cloud-filters-demo [appName]="applicationName"></app-cloud-filters-demo>
</ng-template>
</adf-sidenav-layout-navigation>
<adf-sidenav-layout-content>

View File

@@ -36,17 +36,7 @@ export class CloudLayoutComponent implements OnInit {
});
}
onTaskFilterSelected(filter) {
const currentFilter = Object.assign({}, filter);
this.router.navigate([`/cloud/${this.applicationName}/tasks/`], { queryParams: currentFilter });
}
onStartTask() {
this.router.navigate([`/cloud/${this.applicationName}/start-task/`]);
}
onProcessFilterSelected(filter) {
const currentFilter = Object.assign({}, filter);
this.router.navigate([`/cloud/${this.applicationName}/processes/`], { queryParams: currentFilter });
}
}

View File

@@ -3,7 +3,7 @@
[appName]="applicationName"
[id]="filterId"
(filterChange)="onFilterChange($event)"
(action)="onEditActions($event)">
(action)="onProcessFilterAction($event)">
</adf-cloud-edit-process-filter>
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter">
<adf-cloud-process-list fxFlex class="adf-cloud-layout-overflow"

View File

@@ -19,13 +19,13 @@ import { Component, ViewChild, OnInit } from '@angular/core';
import {
ProcessListCloudComponent,
ProcessFilterCloudModel,
EditProcessFilterCloudComponent,
ProcessListCloudSortingModel,
ProcessFiltersCloudComponent
} from '@alfresco/adf-process-services-cloud';
import { ActivatedRoute } from '@angular/router';
import { UserPreferencesService } from '@alfresco/adf-core';
import { CloudLayoutService } from './services/cloud-layout.service';
@Component({
templateUrl: './processes-cloud-demo.component.html',
@@ -48,8 +48,10 @@ export class ProcessesCloudDemoComponent implements OnInit {
editedFilter: ProcessFilterCloudModel;
constructor(private route: ActivatedRoute,
private userPreference: UserPreferencesService) {
constructor(
private route: ActivatedRoute,
private cloudLayoutService: CloudLayoutService,
private userPreference: UserPreferencesService) {
}
ngOnInit() {
@@ -78,27 +80,7 @@ export class ProcessesCloudDemoComponent implements OnInit {
this.sortArray = [new ProcessListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
}
onEditActions(event: any) {
if (event.actionType === EditProcessFilterCloudComponent.ACTION_SAVE) {
this.save(event.id);
} else if (event.actionType === EditProcessFilterCloudComponent.ACTION_SAVE_AS) {
this.saveAs(event.id);
} else if (event.actionType === EditProcessFilterCloudComponent.ACTION_DELETE) {
this.deleteFilter();
}
}
saveAs(filterId) {
this.processFiltersCloud.filterParam = <any> {id : filterId};
this.processFiltersCloud.getFilters(this.applicationName);
}
save(filterId) {
this.processFiltersCloud.filterParam = <any> {id : filterId};
this.processFiltersCloud.getFilters(this.applicationName);
}
deleteFilter() {
this.processFiltersCloud.getFilters(this.applicationName);
}
onProcessFilterAction(filter: any) {
this.cloudLayoutService.setCurrentProcessFilterParam({id: filter.id});
}
}

View File

@@ -0,0 +1,52 @@
/*!
* @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 { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class CloudLayoutService {
private filterTaskSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0});
private filterTask$: Observable<any>;
private filterProcessSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0});
private filterProcess$: Observable<any>;
constructor() {
this.filterTask$ = this.filterTaskSubject.asObservable();
this.filterProcess$ = this.filterProcessSubject.asObservable();
}
getCurrentTaskFilterParam() {
return this.filterTask$;
}
setCurrentTaskFilterParam(param) {
this.filterTaskSubject.next(param);
}
getCurrentProcessFilterParam() {
return this.filterProcess$;
}
setCurrentProcessFilterParam(param) {
this.filterProcessSubject.next(param);
}
}

View File

@@ -18,7 +18,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NotificationService } from '@alfresco/adf-core';
import { CloudLayoutService } from './services/cloud-layout.service';
@Component({
templateUrl: './start-task-cloud-demo.component.html',
styleUrls: ['./start-task-cloud-demo.component.scss']
@@ -28,6 +28,7 @@ export class StartTaskCloudDemoComponent implements OnInit {
applicationName;
constructor(
private cloudLayoutService: CloudLayoutService,
private route: ActivatedRoute,
private notificationService: NotificationService,
private router: Router) {
@@ -41,6 +42,7 @@ export class StartTaskCloudDemoComponent implements OnInit {
onStartTaskSuccess() {
this.router.navigate([`/cloud/${this.applicationName}`]);
this.cloudLayoutService.setCurrentTaskFilterParam({key: 'my-tasks'});
}
onCancelStartTask() {

View File

@@ -2,6 +2,7 @@
<adf-cloud-edit-task-filter
[appName]="applicationName"
[id]="filterId"
(action)="onTaskFilterAction($event)"
(filterChange)="onFilterChange($event)">
</adf-cloud-edit-task-filter>

View File

@@ -19,7 +19,7 @@ import { Component, ViewChild, OnInit } from '@angular/core';
import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel } from '@alfresco/adf-process-services-cloud';
import { UserPreferencesService } from '@alfresco/adf-core';
import { ActivatedRoute } from '@angular/router';
import { CloudLayoutService } from './services/cloud-layout.service';
@Component({
templateUrl: 'tasks-cloud-demo.component.html',
styleUrls: ['tasks-cloud-demo.component.scss']
@@ -41,6 +41,7 @@ export class TasksCloudDemoComponent implements OnInit {
filterId;
constructor(
private cloudLayoutService: CloudLayoutService,
private route: ActivatedRoute,
private userPreference: UserPreferencesService) {
}
@@ -70,4 +71,8 @@ export class TasksCloudDemoComponent implements OnInit {
this.editedFilter = Object.assign({}, filter);
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order})];
}
onTaskFilterAction(filter: any) {
this.cloudLayoutService.setCurrentTaskFilterParam({id: filter.id});
}
}