mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Merge branch 'development' into dev-denys-1152
This commit is contained in:
@@ -122,6 +122,7 @@ export class ActivitiDemoComponent implements AfterViewInit {
|
|||||||
{type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true}
|
{type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
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);
|
||||||
|
@@ -21,7 +21,7 @@ import { Observable } from 'rxjs/Rx';
|
|||||||
import { ActivitiProcessInstanceListComponent } from './activiti-processlist.component';
|
import { ActivitiProcessInstanceListComponent } from './activiti-processlist.component';
|
||||||
|
|
||||||
import { AlfrescoTranslateService, CoreModule } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, CoreModule } from 'ng2-alfresco-core';
|
||||||
import { DataTableModule, ObjectDataRow, DataRowEvent, ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
import { DataTableModule, ObjectDataRow, DataRowEvent, ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
import { TranslationMock } from './../assets/translation.service.mock';
|
import { TranslationMock } from './../assets/translation.service.mock';
|
||||||
import { ProcessInstance } from '../models/process-instance.model';
|
import { ProcessInstance } from '../models/process-instance.model';
|
||||||
@@ -275,7 +275,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should reload the list when the sort parameter changes', (done) => {
|
it('should reload the list when the sort parameter changes', (done) => {
|
||||||
const sort = 'desc';
|
const sort = 'created-desc';
|
||||||
let change = new SimpleChange(null, sort);
|
let change = new SimpleChange(null, sort);
|
||||||
|
|
||||||
component.onSuccess.subscribe((res) => {
|
component.onSuccess.subscribe((res) => {
|
||||||
@@ -290,6 +290,21 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
component.ngOnChanges({'sort': change});
|
component.ngOnChanges({'sort': change});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should sort the list when the sort parameter changes', (done) => {
|
||||||
|
const sort = 'created-asc';
|
||||||
|
let change = new SimpleChange(null, sort);
|
||||||
|
let sortSpy = spyOn(component.data, 'setSorting');
|
||||||
|
|
||||||
|
component.onSuccess.subscribe((res) => {
|
||||||
|
expect(res).toBeDefined();
|
||||||
|
expect(sortSpy).toHaveBeenCalledWith(new DataSorting('started', 'asc'));
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
component.sort = sort;
|
||||||
|
component.ngOnChanges({'sort': change});
|
||||||
|
});
|
||||||
|
|
||||||
it('should reload the process list when the name parameter changes', (done) => {
|
it('should reload the process list when the name parameter changes', (done) => {
|
||||||
const name = 'FakeTaskName';
|
const name = 'FakeTaskName';
|
||||||
let change = new SimpleChange(null, name);
|
let change = new SimpleChange(null, name);
|
||||||
|
@@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
||||||
import { ObjectDataTableAdapter, DataTableAdapter, DataRowEvent, ObjectDataRow } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter, DataTableAdapter, DataRowEvent, ObjectDataRow, DataSorting } from 'ng2-alfresco-datatable';
|
||||||
import { TaskQueryRequestRepresentationModel } from 'ng2-activiti-tasklist';
|
import { TaskQueryRequestRepresentationModel } from 'ng2-activiti-tasklist';
|
||||||
|
import { ProcessFilterRequestRepresentation } from '../models/process-instance-filter.model';
|
||||||
import { ProcessInstance } from '../models/process-instance.model';
|
import { ProcessInstance } from '../models/process-instance.model';
|
||||||
import { ActivitiProcessService } from '../services/activiti-process.service';
|
import { ActivitiProcessService } from '../services/activiti-process.service';
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
|
|||||||
@Input()
|
@Input()
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
requestNode: TaskQueryRequestRepresentationModel;
|
requestNode: ProcessFilterRequestRepresentation;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
data: DataTableAdapter;
|
data: DataTableAdapter;
|
||||||
@@ -130,7 +130,7 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private load(requestNode: TaskQueryRequestRepresentationModel) {
|
private load(requestNode: ProcessFilterRequestRepresentation) {
|
||||||
this.processService.getProcessInstances(requestNode)
|
this.processService.getProcessInstances(requestNode)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(response) => {
|
(response) => {
|
||||||
@@ -168,9 +168,25 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
|
|||||||
*/
|
*/
|
||||||
private renderInstances(instances: any[]) {
|
private renderInstances(instances: any[]) {
|
||||||
instances = this.optimizeNames(instances);
|
instances = this.optimizeNames(instances);
|
||||||
|
this.setDatatableSorting();
|
||||||
this.data.setRows(instances);
|
this.data.setRows(instances);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the datatable rows based on current value of 'sort' property
|
||||||
|
*/
|
||||||
|
private setDatatableSorting() {
|
||||||
|
if (!this.sort) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let sortingParams: string[] = this.sort.split('-');
|
||||||
|
if (sortingParams.length === 2) {
|
||||||
|
let sortColumn = sortingParams[0] === 'created' ? 'started' : sortingParams[0];
|
||||||
|
let sortOrder = sortingParams[1];
|
||||||
|
this.data.setSorting(new DataSorting(sortColumn, sortOrder));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select the first instance of a list if present
|
* Select the first instance of a list if present
|
||||||
*/
|
*/
|
||||||
@@ -226,10 +242,9 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
|
|||||||
let requestNode = {
|
let requestNode = {
|
||||||
appDefinitionId: this.appId,
|
appDefinitionId: this.appId,
|
||||||
processDefinitionKey: this.processDefinitionKey,
|
processDefinitionKey: this.processDefinitionKey,
|
||||||
text: this.name,
|
|
||||||
state: this.state,
|
state: this.state,
|
||||||
sort: this.sort
|
sort: this.sort
|
||||||
};
|
};
|
||||||
return new TaskQueryRequestRepresentationModel(requestNode);
|
return new ProcessFilterRequestRepresentation(requestNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -329,6 +329,30 @@ The component shows all the available filters.
|
|||||||
|
|
||||||
No options
|
No options
|
||||||
|
|
||||||
|
## Basic usage example Activiti Checklist
|
||||||
|
|
||||||
|
The component shows the checklist task functionality.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<activiti-checklist></activiti-checklist>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
| Name | Type | Required | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `taskId` | {string} | required | The id of the parent task which sub tasks are attached on. |
|
||||||
|
| `readOnlyForm` | {boolean} | optional | Toggle readonly state of the form. Enforces all form widgets render readonly if enabled. |
|
||||||
|
| `assignee` | {string} | required | The assignee id where the subtasks are assigned to. |
|
||||||
|
|
||||||
|
## Basic usage example Activiti Checklist
|
||||||
|
|
||||||
|
The component shows all the available filters.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<activiti-checklist [readOnly]="false" [taskId]="taskId" [assignee]="taskAssignee.id" #activitichecklist></activiti-checklist>
|
||||||
|
```
|
||||||
|
|
||||||
## Build from sources
|
## Build from sources
|
||||||
|
|
||||||
Alternatively you can build component from sources with the following commands:
|
Alternatively you can build component from sources with the following commands:
|
||||||
|
@@ -38,6 +38,9 @@ export class ActivitiChecklist implements OnInit, OnChanges {
|
|||||||
@Input()
|
@Input()
|
||||||
readOnly: boolean = false;
|
readOnly: boolean = false;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
assignee: string;
|
||||||
|
|
||||||
@ViewChild('dialog')
|
@ViewChild('dialog')
|
||||||
dialog: any;
|
dialog: any;
|
||||||
|
|
||||||
@@ -105,7 +108,11 @@ export class ActivitiChecklist implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public add() {
|
public add() {
|
||||||
let newTask = new TaskDetailsModel({name: this.taskName, parentTaskId: this.taskId, assignee: {id: '1'}});
|
let newTask = new TaskDetailsModel({
|
||||||
|
name: this.taskName,
|
||||||
|
parentTaskId: this.taskId,
|
||||||
|
assignee: { id: this.assignee }
|
||||||
|
});
|
||||||
this.activitiTaskList.addTask(newTask).subscribe(
|
this.activitiTaskList.addTask(newTask).subscribe(
|
||||||
(res: TaskDetailsModel) => {
|
(res: TaskDetailsModel) => {
|
||||||
this.checklist.push(res);
|
this.checklist.push(res);
|
||||||
@@ -114,7 +121,6 @@ export class ActivitiChecklist implements OnInit, OnChanges {
|
|||||||
this.logService.error(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#activiticomments></activiti-comments>
|
#activiticomments></activiti-comments>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-cell mdl-cell--4-col">
|
<div class="mdl-cell mdl-cell--4-col">
|
||||||
<activiti-checklist [readOnly]="readOnlyForm" [taskId]="taskDetails.id"
|
<activiti-checklist [readOnly]="readOnlyForm" [taskId]="taskDetails.id" [assignee]="taskDetails?.assignee?.id"
|
||||||
#activitichecklist></activiti-checklist>
|
#activitichecklist></activiti-checklist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user