#1107 Fixes demo and documentation

This commit is contained in:
mauriziovitale84
2016-11-18 16:36:54 +00:00
committed by Mario Romano
parent 1501e2c2cc
commit e127837bcc
6 changed files with 43 additions and 40 deletions

View File

@@ -36,8 +36,8 @@
</div> </div>
<div class="mdl-cell mdl-cell--3-col task-column mdl-shadow--2dp"> <div class="mdl-cell mdl-cell--3-col task-column mdl-shadow--2dp">
<span>Task List</span> <span>Task List</span>
<activiti-tasklist *ngIf="taskFilter && taskFilter.hasFilter()" [appId]="taskFilter.appId" <activiti-tasklist *ngIf="taskFilter?.hasFilter()" [appId]="taskFilter.appId"
[processDefinitionId]="taskFilter.filter.processDefinitionId" [processDefinitionKey]="taskFilter.filter.processDefinitionKey"
[name]="taskFilter.filter.name" [name]="taskFilter.filter.name"
[assignment]="taskFilter.filter.assignment" [assignment]="taskFilter.filter.assignment"
[state]="taskFilter.filter.state" [state]="taskFilter.filter.state"
@@ -71,7 +71,12 @@
</div> </div>
<div class="mdl-cell mdl-cell--3-col task-column"> <div class="mdl-cell mdl-cell--3-col task-column">
<span>Process List</span> <span>Process List</span>
<activiti-process-instance-list [filter]="processFilter" [data]="dataProcesses" <activiti-process-instance-list *ngIf="processFilter?.hasFilter()" [appId]="processFilter.appId"
[processDefinitionKey]="processFilter.filter.processDefinitionKey"
[name]="processFilter.filter.name"
[state]="processFilter.filter.state"
[sort]="processFilter.filter.sort"
[data]="dataProcesses"
(rowClick)="onProcessRowClick($event)" (onSuccess)="onSuccessProcessList($event)" (rowClick)="onProcessRowClick($event)" (onSuccess)="onSuccessProcessList($event)"
#activitiprocesslist></activiti-process-instance-list> #activitiprocesslist></activiti-process-instance-list>
</div> </div>

View File

@@ -81,9 +81,9 @@ export class ActivitiDemoComponent implements AfterViewChecked {
taskSchemaColumns: any [] = []; taskSchemaColumns: any [] = [];
processSchemaColumns: any [] = []; processSchemaColumns: any [] = [];
taskFilter: any; taskFilter: FilterRepresentationModel;
report: any; report: any;
processFilter: any; processFilter: FilterRepresentationModel;
sub: Subscription; sub: Subscription;
@@ -103,11 +103,10 @@ export class ActivitiDemoComponent implements AfterViewChecked {
this.dataProcesses = new ObjectDataTableAdapter( this.dataProcesses = new ObjectDataTableAdapter(
[], [],
[ [
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column'},
{type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true} {type: 'text', key: 'started', title: 'Started', cssClass: 'hidden'}
] ]
); );
this.dataProcesses.setSorting(new DataSorting('started', 'desc'));
// Uncomment this line to replace all 'text' field editors with custom component // Uncomment this line to replace all 'text' field editors with custom component
// formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true); // formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true);
@@ -163,10 +162,10 @@ export class ActivitiDemoComponent implements AfterViewChecked {
} }
onSuccessTaskList(event: FilterRepresentationModel) { onSuccessTaskList(event: FilterRepresentationModel) {
this.currentTaskId = this.activititasklist.getCurrentTaskId(); this.currentTaskId = this.activititasklist.getCurrentId();
} }
onProcessFilterClick(event: any) { onProcessFilterClick(event: FilterRepresentationModel) {
this.processFilter = event; this.processFilter = event;
} }
@@ -175,7 +174,7 @@ export class ActivitiDemoComponent implements AfterViewChecked {
} }
onSuccessProcessList(event: any) { onSuccessProcessList(event: any) {
this.currentProcessInstanceId = this.activitiprocesslist.getCurrentProcessId(); this.currentProcessInstanceId = this.activitiprocesslist.getCurrentId();
} }
onTaskRowClick(taskId) { onTaskRowClick(taskId) {

View File

@@ -108,10 +108,10 @@ Follow the 3 steps below:
### Activiti Process Instance List ### Activiti Process Instance List
This component renders a list containing all the process instances matched by the filter specified. This component renders a list containing all the process instances matched by the parameters specified.
```html ```html
<activiti-process-instance-list [filter]="processFilterModel"></activiti-tasklist> <activiti-process-instance-list [appId]="'1'" [state]="'open'"></activiti-tasklist>
``` ```
Usage example of this component : Usage example of this component :
@@ -130,14 +130,16 @@ import { ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable';
@Component({ @Component({
selector: 'alfresco-app-demo', selector: 'alfresco-app-demo',
template: `<activiti-process-instance-list [filter]="filterRepresentationModel" [data]="dataProcesses" template: `<activiti-process-instance-list [appId]="appId" [state]="state" [data]="dataProcesses"
#activitiprocesslist></activiti-process-instance-list>` #activitiprocesslist></activiti-process-instance-list>`
}) })
class MyDemoApp { class MyDemoApp {
dataProcesses: ObjectDataTableAdapter; dataProcesses: ObjectDataTableAdapter;
filterRepresentationModel: FilterRepresentationModel; appId: string = '1';
state: string = 'open';
constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
settingsService.bpmHost = 'http://localhost:9999'; settingsService.bpmHost = 'http://localhost:9999';
@@ -190,7 +192,10 @@ platformBrowserDynamic().bootstrapModule(AppModule);
| Name | Description | | Name | Description |
| --- | --- | | --- | --- |
|`filter`| { UserProcessInstanceFilterRepresentationModel } (required) UserProcessInstanceFilterRepresentationModel object that is passed to the process instance list API to filter the returned list. | |`appId`| { appId } The id of the app. |
|`processDefinitionKey`| { processDefinitionKey } The processDefinitionKey of the process. |
|`state`| { state } Define state of the processes. Possible values are running, completed and all |
|`sort`| { sort } Define sort of the processes. Possible values are created-desc, created-asc, ended-desc, ended-asc |
Example: Example:

View File

@@ -22,7 +22,7 @@ import { AppDefinitionRepresentationModel, ActivitiTaskListModule } from 'ng2-ac
import { CoreModule } from 'ng2-alfresco-core'; import { CoreModule } from 'ng2-alfresco-core';
import { ActivitiProcessListModule } from 'ng2-activiti-processlist'; import { ActivitiProcessListModule } from 'ng2-activiti-processlist';
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core'; import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
import { ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable'; import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
@Component({ @Component({
selector: 'alfresco-app-demo', selector: 'alfresco-app-demo',
@@ -144,11 +144,12 @@ class MyDemoApp implements OnInit {
this.dataProcesses = new ObjectDataTableAdapter( this.dataProcesses = new ObjectDataTableAdapter(
[], [],
[ [
{type: 'text', key: 'id', title: 'Id'},
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
{type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true} {type: 'text', key: 'started', title: 'Started', sortable: true},
{type: 'text', key: 'startedBy.email', title: 'Started By', sortable: true}
] ]
); );
this.dataProcesses.setSorting(new DataSorting('started', 'desc'));
} }
public updateTicket(): void { public updateTicket(): void {
@@ -195,7 +196,7 @@ class MyDemoApp implements OnInit {
} }
onSuccessProcessList(event: any) { onSuccessProcessList(event: any) {
this.currentProcessInstanceId = this.activitiprocesslist.getCurrentProcessId(); this.currentProcessInstanceId = this.activitiprocesslist.getCurrentId();
} }
onProcessRowClick(processInstanceId) { onProcessRowClick(processInstanceId) {

View File

@@ -137,7 +137,7 @@ Follow the 3 steps below:
## Basic usage example Activiti Task List ## Basic usage example Activiti Task List
The component shows the list of all the tasks filter by the FilterParamRepresentationModel passed in input. This component renders a list containing all the tasks matched by the parameters specified.
```html ```html
<activiti-tasklist [appId]="'1'" [state]="'open'" [assignment]="'assignee'"></activiti-tasklist> <activiti-tasklist [appId]="'1'" [state]="'open'" [assignment]="'assignee'"></activiti-tasklist>
@@ -218,22 +218,16 @@ platformBrowserDynamic().bootstrapModule(AppModule);
| Name | Description | | Name | Description |
| --- | --- | | --- | --- |
| `taskFilter` | { FilterParamRepresentationModel } required) FilterParamRepresentationModel object that is passed to the task list API to filter the task list. | |`appId`| { appId } The id of the app. |
|`processDefinitionKey`| { processDefinitionKey } The processDefinitionKey of the process. |
Example: |`assignment`| { assignment } The assignment of the process.
Possible values are:
```json assignee : where the current user is the assignee
{ candidate: where the current user is a task candidate
appId: '3003', group_x: where the task is assigned to a group where the current user is a member of. The groups can be fetched through the profile REST endpoint
filter:{ no value: where the current user is involved |
processDefinitionKey: null, |`state`| { state } Define state of the processes. Possible values are: completed, active |
name:null, |`sort`| { sort } Define the sort of the processes. Possible values are created-desc, created-asc, due-desc, due-asc |
assignment: 'involved',
state:'running',
sort: 'created-desc'
}
}
```
| Name | Description | | Name | Description |
| --- | --- | | --- | --- |

View File

@@ -27,7 +27,7 @@ import {
} from 'ng2-activiti-tasklist'; } from 'ng2-activiti-tasklist';
import { CoreModule } from 'ng2-alfresco-core'; import { CoreModule } from 'ng2-alfresco-core';
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core'; import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
import { ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable'; import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
@Component({ @Component({
selector: 'alfresco-app-demo', selector: 'alfresco-app-demo',
@@ -159,7 +159,6 @@ class MyDemoApp implements OnInit {
{type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true} {type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true}
] ]
); );
this.dataTasks.setSorting(new DataSorting('started', 'desc'));
} }
public updateTicket(): void { public updateTicket(): void {
@@ -209,7 +208,7 @@ class MyDemoApp implements OnInit {
onSuccessTaskList(event: FilterRepresentationModel) { onSuccessTaskList(event: FilterRepresentationModel) {
this.currentTaskId = this.activititasklist.getCurrentId(); this.currentTaskId = this.activititasklist.getCurrentId();
} }
main
onTaskRowClick(taskId) { onTaskRowClick(taskId) {
this.currentTaskId = taskId; this.currentTaskId = taskId;
} }