[ADF-4409] DemoShell - ADF compatibility with Activiti 7 (#4646)

* [ADF-4409] PorcessServicesCloud - add community page

* [ADF-4409] - add process and task details page

* [ADF-4409] fix lint and reset package-lock

* [ADF-4409] - PR changes

* [ADF-4409] -  PR changes

* [ADF-4409] - fix start task/process redirection

* [ADF-4409] - fix unit tests
This commit is contained in:
Silviu Popa
2019-04-30 12:13:10 +03:00
committed by Eugenio Romano
parent 5f3d665ab5
commit 860529058c
39 changed files with 1074 additions and 78 deletions

View File

@@ -0,0 +1,36 @@
<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-navigation>
<ng-template>
<adf-sidebar-action-menu [expanded]="true" [width]="205" title="{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.CREATE' | translate}}">
<mat-icon adf-sidebar-menu-title-icon>arrow_drop_down</mat-icon>
<div adf-sidebar-menu-options>
<button mat-menu-item data-automation-id="btn-start-task" (click)="onStartTask()">
<mat-icon>assessment</mat-icon>
<span>{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.NEW_TASK' | translate}}</span>
</button>
</div>
<div adf-sidebar-menu-options>
<button mat-menu-item data-automation-id="btn-start-process" (click)="onStartProcess()">
<mat-icon>assessment</mat-icon>
<span>{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.NEW_PROCESS' | translate}}</span>
</button>
</div>
</adf-sidebar-action-menu>
<app-community-cloud-filters-demo></app-community-cloud-filters-demo>
</ng-template>
</adf-sidenav-layout-navigation>
<adf-sidenav-layout-content>
<ng-template>
<router-outlet></router-outlet>
</ng-template>
</adf-sidenav-layout-content>
</adf-sidenav-layout>
</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

@@ -0,0 +1,68 @@
/*!
* @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.
*/
import { Component, ViewEncapsulation } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { CloudLayoutService } from '../services/cloud-layout.service';
@Component({
templateUrl: './community-cloud.component.html',
styles: [`.adf-cloud-layout-overflow {
overflow: auto;
}
.adf-cloud-layout-tab-body .mat-tab-body-wrapper {
height: 100% !important;
}
`],
encapsulation: ViewEncapsulation.None
})
export class CommunityCloudComponent {
appName: string = '';
constructor(
private router: Router,
private route: ActivatedRoute,
private cloudLayoutService: CloudLayoutService
) { }
ngOnInit() {
let root: string = '';
if (this.route.snapshot && this.route.snapshot.firstChild) {
root = this.route.snapshot.firstChild.url[0].path;
}
this.route.queryParams.subscribe((params) => {
if (root === 'tasks' && params.id) {
this.cloudLayoutService.setCurrentTaskFilterParam({ id: params.id });
}
if (root === 'processes' && params.id) {
this.cloudLayoutService.setCurrentProcessFilterParam({ id: params.id });
}
});
}
onStartTask() {
this.router.navigate([`/cloud/community/start-task/`]);
}
onStartProcess() {
this.router.navigate([`/cloud/community/start-process/`]);
}
}

View File

@@ -0,0 +1,31 @@
<mat-accordion>
<mat-expansion-panel [expanded]="expandTaskFilter" (opened)="onTaskFilterOpen()" (closed)="onTaskFilterClose()" data-automation-id='Task Filters'>
<mat-expansion-panel-header>
<mat-panel-title>
Task Filters
</mat-panel-title>
</mat-expansion-panel-header>
<adf-cloud-task-filters
*ngIf="expandTaskFilter"
[appName]="appName"
[showIcons]="true"
[filterParam]="currentTaskFilter$ | async"
(filterClick)="onTaskFilterSelected($event)">
</adf-cloud-task-filters>
</mat-expansion-panel>
<mat-expansion-panel [expanded]="expandProcessFilter" (opened)="onProcessFilterOpen()" (closed)="onProcessFilterClose()" data-automation-id='Process Filters'>
<mat-expansion-panel-header>
<mat-panel-title>
Process Filters
</mat-panel-title>
</mat-expansion-panel-header>
<adf-cloud-process-filters
*ngIf="expandProcessFilter"
[appName]="appName"
[showIcons]="true"
[filterParam]="currentProcessFilter$ | async"
(filterClick)="onProcessFilterSelected($event)">
</adf-cloud-process-filters>
</mat-expansion-panel>
</mat-accordion>

View File

@@ -0,0 +1,94 @@
/*!
* @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.
*/
import { Component, ViewEncapsulation, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { Router, ActivatedRoute } from '@angular/router';
import { CloudLayoutService } from '../services/cloud-layout.service';
@Component({
selector: 'app-community-cloud-filters-demo',
templateUrl: './community-filters.component.html',
encapsulation: ViewEncapsulation.None
})
export class CommunityCloudFiltersDemoComponent implements OnInit {
@Input()
appName: string = 'community';
currentTaskFilter$: Observable<any>;
currentProcessFilter$: Observable<any>;
toggleTaskFilter = true;
toggleProcessFilter = true;
expandTaskFilter = true;
expandProcessFilter = false;
constructor(
private cloudLayoutService: CloudLayoutService,
private router: Router,
private route: ActivatedRoute
) {}
ngOnInit() {
this.currentTaskFilter$ = this.cloudLayoutService.getCurrentTaskFilterParam();
this.currentProcessFilter$ = this.cloudLayoutService.getCurrentProcessFilterParam();
let root = '';
if (this.route.snapshot && this.route.snapshot.firstChild) {
root = this.route.snapshot.firstChild.url[0].path;
if (root === 'tasks') {
this.expandTaskFilter = true;
this.expandProcessFilter = false;
} else if (root === 'processes') {
this.expandProcessFilter = true;
this.expandTaskFilter = false;
}
}
}
onTaskFilterSelected(filter) {
this.cloudLayoutService.setCurrentTaskFilterParam({id: filter.id});
const currentFilter = Object.assign({}, filter);
this.router.navigate([`/cloud/community/tasks/`], { queryParams: currentFilter });
}
onProcessFilterSelected(filter) {
this.cloudLayoutService.setCurrentProcessFilterParam({id: filter.id});
const currentFilter = Object.assign({}, filter);
this.router.navigate([`/cloud/community/processes/`], { queryParams: currentFilter });
}
onTaskFilterOpen(): boolean {
this.expandTaskFilter = true;
this.expandProcessFilter = false;
return this.toggleTaskFilter;
}
onTaskFilterClose(): boolean {
return !this.toggleTaskFilter;
}
onProcessFilterOpen(): boolean {
this.expandProcessFilter = true;
this.expandTaskFilter = false;
return this.toggleProcessFilter;
}
onProcessFilterClose(): boolean {
return !this.toggleProcessFilter;
}
}

View File

@@ -0,0 +1,24 @@
<button data-automation-id="go-back" mat-icon-button (click)="onGoBack()">
<mat-icon>arrow_back</mat-icon> Go Back
</button>
<h4 data-automation-id="process-details-header">Simple page to show the process instance: {{ processInstanceId }} of the app: {{ appName }}</h4>
<div class="adf-process-cloud-container">
<adf-cloud-task-list
fxFlex
class="adf-cloud-layout-overflow"
[processInstanceId]="processInstanceId"
(rowClick)="onRowClick($event)"
#taskCloud>
</adf-cloud-task-list>
<adf-cloud-process-header
class="adf-process-cloud-header"
[appName]="''"
[processInstanceId]="processInstanceId">
</adf-cloud-process-header>
</div>

View File

@@ -0,0 +1,14 @@
.adf {
&-process-cloud-container {
display: flex;
}
&-cloud-layout-overflow {
width:67%;
}
&-process-cloud-header {
margin-left: 10px;
width: 25%;
}
}

View File

@@ -0,0 +1,49 @@
/*!
* @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.
*/
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
@Component({
templateUrl: './community-process-details-cloud.component.html',
styleUrls: ['./community-process-details-cloud.component.scss']
})
export class CommunityProcessDetailsCloudDemoComponent {
processInstanceId: string;
appName: string;
constructor(private route: ActivatedRoute, private router: Router) {
this.route.params.subscribe((params) => {
this.processInstanceId = params.processInstanceId;
});
this.route.parent.params.subscribe((params) => {
this.appName = params.appName;
});
}
onGoBack() {
this.router.navigate([`/cloud/community/`]);
}
onRowClick(taskId: string) {
if (taskId) {
this.router.navigate([`/cloud/community/task-details/${taskId}`]);
}
}
}

View File

@@ -0,0 +1,44 @@
<div fxLayout="column" fxFill fxLayoutGap="2px">
<adf-cloud-edit-process-filter
[id]="filterId"
[appName]="'community'"
[filterProperties]="processFilterProperties.filterProperties"
[sortProperties]="processFilterProperties.sortProperties"
[actions]="processFilterProperties.actions"
(filterChange)="onFilterChange($event)"
(action)="onProcessFilterAction($event)">
</adf-cloud-edit-process-filter>
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter">
<adf-cloud-process-list #processCloud
fxFlex
[appName]="''"
class="adf-cloud-layout-overflow"
[initiator]="editedFilter.initiator"
[processDefinitionId]="editedFilter.processDefinitionId"
[processDefinitionKey]="editedFilter.processDefinitionKey"
[id]="editedFilter.processInstanceId"
[status]="editedFilter.status"
[name]="editedFilter.processName"
[businessKey]="editedFilter.businessKey"
[lastModifiedFrom]="editedFilter.lastModifiedFrom"
[lastModifiedTo]="editedFilter.lastModifiedTo"
[sorting]="sortArray"
[selectionMode]="selectionMode"
[multiselect]="multiselect"
(rowClick)="onRowClick($event)"
(rowsSelected)="onRowsSelected($event)">
</adf-cloud-process-list>
<adf-pagination
[target]="processCloud"
(changePageSize)="onChangePageSize($event)"
(nextPage)="resetSelectedRows()"
(prevPage)="resetSelectedRows()">
</adf-pagination>
<div *ngIf="testingMode">
Selected rows:
<ul>
<li *ngFor="let row of selectedRows">{{ row.id }}</li>
</ul>
</div>
</div>
</div>

View File

@@ -0,0 +1,134 @@
/*!
* @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.
*/
import { Component, ViewChild, OnInit } from '@angular/core';
import {
ProcessListCloudComponent,
ProcessFilterCloudModel,
ProcessListCloudSortingModel,
ProcessFiltersCloudComponent,
ProcessFilterCloudService
} from '@alfresco/adf-process-services-cloud';
import { ActivatedRoute, Router } from '@angular/router';
import { UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
import { CloudLayoutService } from '../services/cloud-layout.service';
@Component({
templateUrl: './community-processes-cloud.component.html'
})
export class CommunityProcessesCloudDemoComponent implements OnInit {
public static ACTION_SAVE_AS = 'saveAs';
static PROCESS_FILTER_PROPERTY_KEYS = 'adf-edit-process-filter';
@ViewChild('processCloud')
processCloud: ProcessListCloudComponent;
@ViewChild('processFiltersCloud')
processFiltersCloud: ProcessFiltersCloudComponent;
appName: string = '';
isFilterLoaded: boolean;
filterId: string = '';
sortArray: any = [];
selectedRow: any;
multiselect: boolean;
selectionMode: string;
selectedRows: string[] = [];
testingMode: boolean;
processFilterProperties: any = { filterProperties: [], sortProperties: [], actions: [] };
editedFilter: ProcessFilterCloudModel;
constructor(
private route: ActivatedRoute,
private router: Router,
private cloudLayoutService: CloudLayoutService,
private userPreference: UserPreferencesService,
private processFilterCloudService: ProcessFilterCloudService,
private appConfig: AppConfigService) {
const properties = this.appConfig.get<Array<any>>(CommunityProcessesCloudDemoComponent.PROCESS_FILTER_PROPERTY_KEYS);
if (properties) {
this.processFilterProperties = properties;
}
}
ngOnInit() {
this.isFilterLoaded = false;
this.route.parent.params.subscribe((params) => {
this.appName = params.appName;
});
this.route.queryParams.subscribe((params) => {
if (Object.keys(params).length > 0) {
this.isFilterLoaded = true;
this.onFilterChange(params);
this.filterId = params.id;
} else {
this.loadDefaultFilters();
}
});
this.cloudLayoutService.getCurrentSettings()
.subscribe((settings) => this.setCurrentSettings(settings));
}
loadDefaultFilters() {
this.processFilterCloudService.getProcessFilters('community').subscribe( (filters: ProcessFilterCloudModel[]) => {
this.onFilterChange(filters[0]);
});
}
setCurrentSettings(settings) {
if (settings) {
this.multiselect = settings.multiselect;
this.testingMode = settings.testingMode;
this.selectionMode = settings.selectionMode;
}
}
onChangePageSize(event) {
this.userPreference.paginationSize = event.maxItems;
}
resetSelectedRows() {
this.selectedRows = [];
}
onRowClick(processInstanceId) {
this.router.navigate([`/cloud/community/process-details/${processInstanceId}`]);
}
onFilterChange(query: any) {
this.editedFilter = Object.assign({}, query);
this.sortArray = [new ProcessListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
}
onProcessFilterAction(filterAction: any) {
this.cloudLayoutService.setCurrentProcessFilterParam({ id: filterAction.filter.id });
if (filterAction.actionType === CommunityProcessesCloudDemoComponent.ACTION_SAVE_AS) {
this.router.navigate([`/cloud/community/processes/`], { queryParams: filterAction.filter });
}
}
onRowsSelected(nodes) {
this.resetSelectedRows();
this.selectedRows = nodes.map((node) => node.obj.entry);
}
}

View File

@@ -0,0 +1,7 @@
<adf-cloud-start-process
[name]="processName"
[appName]="''"
(error)="openSnackMessage($event)"
(success)="onStartProcessSuccess()"
(cancel)="onCancelStartProcess()">
</adf-cloud-start-process>

View File

@@ -0,0 +1,56 @@
/*!
* @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.
*/
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NotificationService, AppConfigService } from '@alfresco/adf-core';
import { CloudLayoutService } from '../services/cloud-layout.service';
@Component({
templateUrl: './community-start-process-cloud.component.html'
})
export class CommunityStartProcessCloudDemoComponent implements OnInit {
processName: string;
constructor(private appConfig: AppConfigService,
private cloudLayoutService: CloudLayoutService,
private notificationService: NotificationService,
private router: Router) {
}
ngOnInit() {
this.processName = this.appConfig.get<string>('adf-start-process.name');
}
onStartProcessSuccess() {
this.cloudLayoutService.setCurrentProcessFilterParam({ key: 'running-processes' });
this.router.navigate([`/cloud/community/processes`]);
}
onCancelStartProcess() {
this.cloudLayoutService.setCurrentProcessFilterParam({ key: 'all-processes' });
this.router.navigate([`/cloud/community/processes`]);
}
openSnackMessage(event: any) {
this.notificationService.openSnackMessage(
event.response.body.message,
4000
);
}
}

View File

@@ -0,0 +1,5 @@
<adf-cloud-start-task
(error)="openSnackMessage($event)"
(success)="onStartTaskSuccess()"
(cancel)="onCancelStartTask()">
</adf-cloud-start-task>

View File

@@ -0,0 +1,49 @@
/*!
* @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.
*/
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { NotificationService } from '@alfresco/adf-core';
import { CloudLayoutService } from '../services/cloud-layout.service';
@Component({
templateUrl: './community-start-task-cloud.component.html'
})
export class CommunityStartTaskCloudDemoComponent {
constructor(
private cloudLayoutService: CloudLayoutService,
private notificationService: NotificationService,
private router: Router) {
}
onStartTaskSuccess() {
this.cloudLayoutService.setCurrentTaskFilterParam({key: 'community'});
this.router.navigate([`/cloud/community/tasks`]);
}
onCancelStartTask() {
this.cloudLayoutService.setCurrentTaskFilterParam({key: 'community'});
this.router.navigate([`/cloud/community/tasks`]);
}
openSnackMessage(event: any) {
this.notificationService.openSnackMessage(
event.response.body.message,
4000
);
}
}

View File

@@ -0,0 +1,48 @@
<div fxLayout="column" fxFill fxLayoutGap="2px">
<adf-cloud-edit-task-filter
[id]="filterId"
[appName]="'community'"
[filterProperties]="taskFilterProperties.filterProperties"
[sortProperties]="taskFilterProperties.sortProperties"
[actions]="taskFilterProperties.actions"
(action)="onTaskFilterAction($event)"
(filterChange)="onFilterChange($event)">
</adf-cloud-edit-task-filter>
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter">
<adf-cloud-task-list #taskCloud
fxFlex
[appName]="''"
class="adf-cloud-layout-overflow"
[processDefinitionId]="editedFilter.processDefinitionId"
[processInstanceId]="editedFilter.processInstanceId"
[name]="editedFilter.taskName"
[id]="editedFilter.taskId"
[parentTaskId]="editedFilter.parentTaskId"
[priority]="editedFilter.priority"
[owner]="editedFilter.owner"
[lastModifiedFrom]="editedFilter.lastModifiedFrom"
[lastModifiedTo]="editedFilter.lastModifiedTo"
[status]="editedFilter.status"
[assignee]="editedFilter.assignee"
[createdDate]="editedFilter.createdDate"
[dueDate]="editedFilter.dueDate"
[sorting]="sortArray"
[multiselect]="multiselect"
[selectionMode]="selectionMode"
(rowClick)="onRowClick($event)"
(rowsSelected)="onRowsSelected($event)">
</adf-cloud-task-list>
<adf-pagination
[target]="taskCloud"
(changePageSize)="onChangePageSize($event)"
(nextPage)="resetSelectedRows()"
(prevPage)="resetSelectedRows()">
</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>

View File

@@ -0,0 +1,131 @@
/*!
* @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.
*/
import { Component, ViewChild, OnInit } from '@angular/core';
import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel, TaskFilterCloudService } from '@alfresco/adf-process-services-cloud';
import { UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
import { ActivatedRoute, Router } from '@angular/router';
import { CloudLayoutService } from '../services/cloud-layout.service';
@Component({
templateUrl: './community-task-cloud.component.html',
styles: [`.adf-cloud-layout-tab-body .mat-tab-body-wrapper {
height: 100%;
}
`]
})
export class CommunityTasksCloudDemoComponent implements OnInit {
public static ACTION_SAVE_AS = 'saveAs';
static TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
@ViewChild('taskCloud')
taskCloud: TaskListCloudComponent;
isFilterLoaded = false;
selectedRow: any;
sortArray: TaskListCloudSortingModel[];
editedFilter: TaskFilterCloudModel;
taskFilterProperties: any = { filterProperties: [], sortProperties: [], actions: [] };
filterId;
multiselect: boolean;
selectedRows: string[] = [];
testingMode: boolean;
selectionMode: string;
taskDetailsRedirection: boolean;
constructor(
private cloudLayoutService: CloudLayoutService,
private route: ActivatedRoute,
private router: Router,
private taskFilterCloudService: TaskFilterCloudService,
private userPreference: UserPreferencesService,
private appConfig: AppConfigService) {
const properties = this.appConfig.get<Array<any>>(CommunityTasksCloudDemoComponent.TASK_FILTER_PROPERTY_KEYS);
if (properties) {
this.taskFilterProperties = properties;
}
}
ngOnInit() {
this.isFilterLoaded = false;
this.route.queryParams.subscribe((params) => {
if (Object.keys(params).length > 0) {
this.isFilterLoaded = true;
this.onFilterChange(params);
this.filterId = params.id;
} else {
setTimeout( () => {
this.loadDefaultFilters();
});
}
});
this.cloudLayoutService.getCurrentSettings()
.subscribe((settings) => this.setCurrentSettings(settings));
}
loadDefaultFilters() {
this.taskFilterCloudService.getTaskListFilters('community').subscribe( (filters: TaskFilterCloudModel[]) => {
this.onFilterChange(filters[0]);
});
}
setCurrentSettings(settings) {
if (settings) {
this.multiselect = settings.multiselect;
this.testingMode = settings.testingMode;
this.selectionMode = settings.selectionMode;
this.taskDetailsRedirection = settings.taskDetailsRedirection;
}
}
onChangePageSize(event) {
this.userPreference.paginationSize = event.maxItems;
}
resetSelectedRows() {
this.selectedRows = [];
}
onRowClick(taskId) {
if (!this.multiselect && this.selectionMode !== 'multiple' && this.taskDetailsRedirection) {
this.router.navigate([`/cloud/community/task-details/${taskId}`]);
}
}
onRowsSelected(nodes) {
this.resetSelectedRows();
this.selectedRows = nodes.map((node) => node.obj.entry);
}
onFilterChange(filter: any) {
this.editedFilter = Object.assign({}, filter);
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
}
onTaskFilterAction(filterAction: any) {
this.cloudLayoutService.setCurrentTaskFilterParam({ id: filterAction.filter.id });
if (filterAction.actionType === CommunityTasksCloudDemoComponent.ACTION_SAVE_AS) {
this.router.navigate([`/cloud/community/tasks/`], { queryParams: filterAction.filter });
}
}
}

View File

@@ -0,0 +1,21 @@
<h4 data-automation-id="task-details-header">Simple page to show the taskId: {{ taskId }} of the app: {{ appName }}</h4>
<div fxLayout="column" fxFill fxLayoutGap="2px">
<div fxLayout="row" fxFill>
<div fxLayout="column" fxFlex="80%">
<adf-task-form-cloud
[appName]="''"
[taskId]="taskId"
(cancelClick)="goBack()"
(taskClaimed)="onClaimTask()"
(taskCompleted)="onTaskCompleted()"
(taskUnclaimed)="onUnclaimTask()"
(formSaved)="onFormSaved()">
</adf-task-form-cloud>
</div>
<adf-cloud-task-header fxFlex
[appName]="''"
[taskId]="taskId">
</adf-cloud-task-header>
</div>
</div>

View File

@@ -0,0 +1,20 @@
.adf {
&-task-detail-container {
display: flex;
}
&-task-tiitle {
margin-left:15px;
}
&-task-control {
width:70%;
}
&-demop-card-container {
width:30%;
font-family: inherit;
}
}

View File

@@ -0,0 +1,75 @@
/*!
* @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.
*/
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UploadCloudWidgetComponent } from '@alfresco/adf-process-services-cloud';
import { NotificationService, FormRenderingService } from '@alfresco/adf-core';
@Component({
templateUrl: './community-task-details-cloud.component.html',
styleUrls: ['./community-task-details-cloud.component.scss']
})
export class CommunityTaskDetailsCloudDemoComponent {
taskId: string;
appName: string;
constructor(
private route: ActivatedRoute,
private router: Router,
private formRenderingService: FormRenderingService,
private notificationService: NotificationService
) {
this.route.params.subscribe((params) => {
this.taskId = params.taskId;
});
this.route.parent.params.subscribe((params) => {
this.appName = params.appName;
});
this.formRenderingService.setComponentTypeResolver('upload', () => UploadCloudWidgetComponent, true);
}
isTaskValid(): boolean {
return this.appName !== undefined && this.taskId !== undefined;
}
goBack() {
this.router.navigate([`/cloud/community/`]);
}
onCompletedTask() {
this.goBack();
}
onUnclaimTask() {
this.goBack();
}
onClaimTask() {
this.goBack();
}
onTaskCompleted() {
this.goBack();
}
onFormSaved() {
this.notificationService.openSnackMessage('Task has been saved successfully');
}
}