mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
@@ -25,7 +25,8 @@
|
||||
'rxjs': 'node_modules/rxjs',
|
||||
'ng2-translate': 'node_modules/ng2-translate',
|
||||
'ng2-activiti-processlist': 'node_modules/ng2-activiti-processlist',
|
||||
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist'
|
||||
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist',
|
||||
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/dist'
|
||||
};
|
||||
|
||||
// packages tells the System loader how to load when no filename and/or no extension
|
||||
@@ -35,7 +36,8 @@
|
||||
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
|
||||
'ng2-translate': { defaultExtension: 'js' },
|
||||
'ng2-activiti-processlist': { main: 'index.js', defaultExtension: 'js' },
|
||||
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' }
|
||||
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
|
||||
'ng2-alfresco-datatable': { main: 'index.js', defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var ngPackageNames = [
|
||||
|
@@ -1,20 +1,6 @@
|
||||
<h1>My Activiti Processes</h1>
|
||||
|
||||
<p *ngIf="processInstances && processInstances.length == 0">{{ 'PROCESSLIST.NONE' | translate }}</p>
|
||||
<table *ngIf="processInstances && processInstances.length" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
|
||||
<caption>{{ 'PROCESSLIST.SUMMARY' | translate:{total: processInstances.length} }}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">{{ 'PROCESSLIST.COLUMN.NAME' | translate }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr *ngFor="let instance of processInstances; let idx = index" (click)="onItemClick(instance, $event)">
|
||||
<td class="mdl-data-table__cell--non-numeric">{{instance.name}}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<p *ngIf="errorMessage">{{ 'PROCESSLIST.ERROR' | translate:{errorMessage: errorMessage} }}</p>
|
||||
|
||||
<alfresco-datatable
|
||||
[data]="data">
|
||||
</alfresco-datatable>
|
||||
|
@@ -20,6 +20,10 @@ import {
|
||||
OnInit
|
||||
} from '@angular/core';
|
||||
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import {
|
||||
ALFRESCO_DATATABLE_DIRECTIVES,
|
||||
ObjectDataTableAdapter
|
||||
} from 'ng2-alfresco-datatable';
|
||||
import { ActivitiProcessService } from '../services/activiti-process-service.service';
|
||||
import { ProcessInstance } from '../models/process-instance';
|
||||
|
||||
@@ -36,12 +40,14 @@ declare let __moduleName: string;
|
||||
`
|
||||
],
|
||||
templateUrl: './ng2-activiti-processlist.component.html',
|
||||
directives: [ ALFRESCO_DATATABLE_DIRECTIVES ],
|
||||
pipes: [ AlfrescoPipeTranslate ]
|
||||
})
|
||||
export class Ng2ActivitiProcesslistComponent implements OnInit {
|
||||
|
||||
errorMessage: string;
|
||||
processInstances: ProcessInstance[];
|
||||
data: ObjectDataTableAdapter;
|
||||
|
||||
constructor (
|
||||
private processService: ActivitiProcessService,
|
||||
@@ -59,7 +65,18 @@ export class Ng2ActivitiProcesslistComponent implements OnInit {
|
||||
getProcesses() {
|
||||
this.processService.getProcesses()
|
||||
.subscribe(
|
||||
processInstances => this.processInstances = processInstances,
|
||||
(processInstances) => {
|
||||
// this.processInstances = processInstances;
|
||||
this.data = new ObjectDataTableAdapter(
|
||||
processInstances,
|
||||
[
|
||||
{type: 'text', key: 'id', title: 'Id', sortable: true},
|
||||
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
|
||||
{type: 'text', key: 'started', title: 'Started', sortable: true},
|
||||
{type: 'text', key: 'startedBy.email', title: 'Started By', sortable: true}
|
||||
]
|
||||
);
|
||||
},
|
||||
error => this.errorMessage = <any>error);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user