mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
#1058 fix start process dialog
This commit is contained in:
parent
d96561c8dc
commit
4ef4782a6e
@ -84,6 +84,9 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
static COMPLETE_OUTCOME_ID: string = '$complete';
|
static COMPLETE_OUTCOME_ID: string = '$complete';
|
||||||
static CUSTOM_OUTCOME_ID: string = '$custom';
|
static CUSTOM_OUTCOME_ID: string = '$custom';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
processId: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
taskId: string;
|
taskId: string;
|
||||||
|
|
||||||
@ -193,6 +196,11 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
if (this.processId) {
|
||||||
|
this.loadStartForm(this.processId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.nodeId) {
|
if (this.nodeId) {
|
||||||
this.loadFormForEcmNode();
|
this.loadFormForEcmNode();
|
||||||
} else {
|
} else {
|
||||||
@ -222,6 +230,12 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
this.getFormDefinitionByFormName(formName.currentValue);
|
this.getFormDefinitionByFormName(formName.currentValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let processId = changes['processId'];
|
||||||
|
if (processId && processId.currentValue) {
|
||||||
|
this.loadStartForm(processId.currentValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -316,6 +330,21 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadStartForm(processId: string) {
|
||||||
|
this.formService
|
||||||
|
.getStartFormInstance(processId)
|
||||||
|
.subscribe(
|
||||||
|
form => {
|
||||||
|
this.formName = form.name;
|
||||||
|
this.form = this.parseForm(form);
|
||||||
|
this.formLoaded.emit(this.form);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
this.handleError(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
getFormDefinitionByFormId(formId: string) {
|
getFormDefinitionByFormId(formId: string) {
|
||||||
this.formService
|
this.formService
|
||||||
.getFormDefinitionById(formId)
|
.getFormDefinitionById(formId)
|
||||||
|
@ -206,6 +206,18 @@ export class FormService {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get start form instance for a given processId
|
||||||
|
* @param processId Process definition ID
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
getStartFormInstance(processId: string): Observable<any> {
|
||||||
|
return Observable.fromPromise(
|
||||||
|
this.apiService.getInstance().activiti.processApi.getProcessInstanceStartForm(processId))
|
||||||
|
.map(this.toJson)
|
||||||
|
.catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get start form definition for a given process
|
* Get start form definition for a given process
|
||||||
* @param processId Process definition ID
|
* @param processId Process definition ID
|
||||||
|
@ -32,34 +32,18 @@
|
|||||||
<span class="activiti-label">{{ 'DETAILS.LABELS.START_FORM'|translate }}</span>
|
<span class="activiti-label">{{ 'DETAILS.LABELS.START_FORM'|translate }}</span>
|
||||||
|
|
||||||
<!--IF START TASK COMPLETED -->
|
<!--IF START TASK COMPLETED -->
|
||||||
<div class="menu-container" *ngIf="completedTasks?.length > 0">
|
<div class="menu-container">
|
||||||
<ul class='mdl-list'>
|
<ul class='mdl-list'>
|
||||||
<li class="mdl-list__item mdl-list__item--two-line">
|
<li class="mdl-list__item mdl-list__item--two-line">
|
||||||
<span class="mdl-list__item-primary-content" (click)="clickTask($event, completedTasks[0])">
|
<span class="mdl-list__item-primary-content" (click)="clickStartTask($event)">
|
||||||
<i class="material-icons mdl-list__item-icon">assignment</i>
|
<i class="material-icons mdl-list__item-icon">assignment</i>
|
||||||
<span>{{ 'DETAILS.LABELS.START_FORM'|translate }}</span>
|
<span>{{ 'DETAILS.LABELS.START_FORM'|translate }}</span>
|
||||||
<span class="mdl-list__item-sub-title">{{ 'DETAILS.LABELS.TASK_SUBTITLE' | translate:{user:
|
|
||||||
getUserFullName(completedTasks[0].assignee), created: getFormatDate(completedTasks[0].created, 'mediumDate') }
|
|
||||||
}}</span>
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--IF START TASK NOT COMPLETED YET-->
|
|
||||||
<div class="menu-container" *ngIf="completedTasks?.length == 0 && activeTasks?.length > 0">
|
|
||||||
<ul class='mdl-list'>
|
|
||||||
<li class="mdl-list__item mdl-list__item--two-line">
|
|
||||||
<span class="mdl-list__item-primary-content" (click)="clickTask($event, activeTasks[0])">
|
|
||||||
<i class="material-icons mdl-list__item-icon">assignment</i>
|
|
||||||
<span>{{ 'DETAILS.LABELS.START_FORM'|translate }}</span>
|
|
||||||
<span class="mdl-list__item-sub-title">{{ 'DETAILS.LABELS.TASK_SUBTITLE' | translate:{user:
|
|
||||||
getUserFullName(activeTasks[0].assignee), created: getFormatDate(activeTasks[0].created, 'mediumDate') }
|
|
||||||
}}</span>
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- COMPLETED FORM -->
|
<!-- COMPLETED FORM -->
|
||||||
@ -89,6 +73,18 @@
|
|||||||
<activiti-task-details [taskId]="selectedTaskId" (formCompleted)="taskFormCompleted()" #taskdetails></activiti-task-details>
|
<activiti-task-details [taskId]="selectedTaskId" (formCompleted)="taskFormCompleted()" #taskdetails></activiti-task-details>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-dialog__actions">
|
<div class="mdl-dialog__actions">
|
||||||
<button type="button" (click)="cancelDialog()" class="mdl-button close">{{ 'DETAILS.TASKS.TASK_CLOSE' | translate }}</button>
|
<button type="button" (click)="closeDialog()" class="mdl-button close">{{ 'DETAILS.TASKS.TASK_CLOSE' | translate }}</button>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
|
|
||||||
|
<dialog class="mdl-dialog task-details-dialog" #startDialog>
|
||||||
|
<h4 class="mdl-dialog__title">{{ 'DETAILS.LABELS.START_FORM'|translate }}</h4>
|
||||||
|
<div class="mdl-dialog__content">
|
||||||
|
<activiti-form [processId]="processId" [showSaveButton]="false" [showCompleteButton]="false" [showDebugButton]="false"
|
||||||
|
[showRefreshButton]="false">
|
||||||
|
</activiti-form>
|
||||||
|
</div>
|
||||||
|
<div class="mdl-dialog__actions">
|
||||||
|
<button type="button" (click)="closeSartDialog()" class="mdl-button close">{{ 'DETAILS.TASKS.TASK_CLOSE' | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
@ -55,9 +55,14 @@ export class ActivitiProcessInstanceTasks implements OnInit {
|
|||||||
|
|
||||||
selectedTaskId: string;
|
selectedTaskId: string;
|
||||||
|
|
||||||
|
processId: string;
|
||||||
|
|
||||||
@ViewChild('dialog')
|
@ViewChild('dialog')
|
||||||
dialog: any;
|
dialog: any;
|
||||||
|
|
||||||
|
@ViewChild('startDialog')
|
||||||
|
startDialog: any;
|
||||||
|
|
||||||
@ViewChild('taskdetails')
|
@ViewChild('taskdetails')
|
||||||
taskdetails: any;
|
taskdetails: any;
|
||||||
|
|
||||||
@ -149,14 +154,27 @@ export class ActivitiProcessInstanceTasks implements OnInit {
|
|||||||
this.showDialog();
|
this.showDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clickStartTask() {
|
||||||
|
this.processId = this.processInstanceDetails.id;
|
||||||
|
this.showStartDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public showStartDialog() {
|
||||||
|
if (this.startDialog) {
|
||||||
|
this.startDialog.nativeElement.showModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public showDialog() {
|
public showDialog() {
|
||||||
if (this.dialog) {
|
if (this.dialog) {
|
||||||
this.dialog.nativeElement.showModal();
|
this.dialog.nativeElement.showModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public cancelDialog() {
|
public closeSartDialog() {
|
||||||
this.closeDialog();
|
if (this.startDialog) {
|
||||||
|
this.startDialog.nativeElement.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private closeDialog() {
|
private closeDialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user