mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2854] Fix demoshell task/process filter and routing (#3360)
* Fix demoshell task/process filter and routing * Use the correct js api model * Fix unit test
This commit is contained in:
committed by
Eugenio Romano
parent
5c97fd99de
commit
ecd7c85de5
@@ -140,6 +140,11 @@ export const appRoutes: Routes = [
|
||||
component: ShowDiagramComponent,
|
||||
canActivate: [AuthGuardBpm]
|
||||
},
|
||||
{
|
||||
path: 'activiti/apps/:appId/report',
|
||||
component: ProcessServiceComponent,
|
||||
canActivate: [AuthGuardBpm]
|
||||
},
|
||||
// TODO: check if neeeded
|
||||
{
|
||||
path: 'activiti/appId/:appId',
|
||||
|
@@ -29,7 +29,7 @@ import {
|
||||
Output
|
||||
} from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ProcessInstanceFilterRepresentation, Pagination } from 'alfresco-js-api';
|
||||
import { ProcessInstanceFilterRepresentation, Pagination, UserProcessInstanceFilterRepresentation } from 'alfresco-js-api';
|
||||
import {
|
||||
FORM_FIELD_VALIDATORS, FormEvent, FormFieldEvent, FormRenderingService, FormService,
|
||||
DynamicTableRow, ValidateDynamicTableRowEvent, AppConfigService, PaginationComponent, UserPreferenceValues
|
||||
@@ -63,10 +63,15 @@ import { Subscription } from 'rxjs/Subscription';
|
||||
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
|
||||
import { DemoFieldValidator } from './demo-field-validator';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
const currentProcessIdNew = '__NEW__';
|
||||
const currentTaskIdNew = '__NEW__';
|
||||
|
||||
const TASK_ROUTE = 0;
|
||||
const PROCESS_ROUTE = 1;
|
||||
const REPORT_ROUTE = 2;
|
||||
|
||||
@Component({
|
||||
selector: 'app-process-service',
|
||||
templateUrl: './process-service.component.html',
|
||||
@@ -108,7 +113,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
@Input()
|
||||
appId: number = null;
|
||||
|
||||
@Input()
|
||||
filterSelected: object = null;
|
||||
|
||||
@Output()
|
||||
@@ -137,8 +141,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
|
||||
taskFilter: FilterRepresentationModel;
|
||||
report: any;
|
||||
processFilter: ProcessInstanceFilterRepresentation;
|
||||
|
||||
processFilter: UserProcessInstanceFilterRepresentation;
|
||||
sub: Subscription;
|
||||
blobFile: any;
|
||||
flag = true;
|
||||
@@ -162,6 +165,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
private preview: PreviewService,
|
||||
formRenderingService: FormRenderingService,
|
||||
formService: FormService,
|
||||
private location: Location,
|
||||
private preferenceService: UserPreferencesService) {
|
||||
this.dataTasks = new ObjectDataTableAdapter();
|
||||
this.dataTasks.setSorting(new DataSorting('created', 'desc'));
|
||||
@@ -237,7 +241,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
onTaskFilterClick(filter: FilterRepresentationModel): void {
|
||||
this.applyTaskFilter(filter);
|
||||
this.resetTaskPaginationPage();
|
||||
this.router.navigate(['/activiti/apps', this.appId || 0, 'tasks', filter.id]);
|
||||
}
|
||||
|
||||
resetTaskPaginationPage() {
|
||||
@@ -245,13 +248,14 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
}
|
||||
|
||||
onTabChange(event: any): void {
|
||||
this.showProcessPagination = event.index === 1;
|
||||
this.paginationPageSize = this.preferenceService.paginationSize;
|
||||
if (this.processList) {
|
||||
this.processList.reload();
|
||||
}
|
||||
if (this.taskList) {
|
||||
this.taskList.reload();
|
||||
const index = event.index;
|
||||
this.showProcessPagination = index === PROCESS_ROUTE;
|
||||
if (index === TASK_ROUTE) {
|
||||
this.relocateLocationToTask();
|
||||
} else if (index === PROCESS_ROUTE) {
|
||||
this.relocateLocationToProcess();
|
||||
} else if (index === REPORT_ROUTE) {
|
||||
this.relocateLocationToReport();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,10 +273,12 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
}
|
||||
|
||||
applyTaskFilter(filter: FilterRepresentationModel) {
|
||||
this.taskFilter = filter;
|
||||
this.taskFilter = Object.assign({}, filter);
|
||||
|
||||
if (filter && this.taskList) {
|
||||
this.taskList.hasCustomDataSource = false;
|
||||
}
|
||||
this.relocateLocationToTask();
|
||||
}
|
||||
|
||||
onStartTaskSuccess(event: any): void {
|
||||
@@ -289,9 +295,10 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
this.currentTaskId = this.taskList.getCurrentId();
|
||||
}
|
||||
|
||||
onProcessFilterClick(event: ProcessInstanceFilterRepresentation): void {
|
||||
onProcessFilterClick(event: UserProcessInstanceFilterRepresentation): void {
|
||||
this.processFilter = event;
|
||||
this.resetProcessPaginationPage();
|
||||
this.relocateLocationToProcess();
|
||||
}
|
||||
|
||||
resetProcessPaginationPage() {
|
||||
@@ -385,6 +392,18 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
this.router.navigate([`/activiti/apps/${this.appId}/processes/`]);
|
||||
}
|
||||
|
||||
relocateLocationToProcess(): void {
|
||||
this.location.go(`/activiti/apps/${this.appId || 0}/processes/${this.processFilter.id}`);
|
||||
}
|
||||
|
||||
relocateLocationToTask(): void {
|
||||
this.location.go(`/activiti/apps/${this.appId || 0}/tasks/${this.taskFilter.id}`);
|
||||
}
|
||||
|
||||
relocateLocationToReport(): void {
|
||||
this.location.go(`/activiti/apps/${this.appId || 0}/report/`);
|
||||
}
|
||||
|
||||
onContentClick(content: any): void {
|
||||
if (content.contentBlob) {
|
||||
this.preview.showBlob(content.name, content.contentBlob);
|
||||
|
Reference in New Issue
Block a user