Add dialog to task details component to notify the user of an error

Refs #851
This commit is contained in:
Will Abson 2016-11-04 17:18:41 +00:00
parent c005002b8f
commit ea1953771b
4 changed files with 26 additions and 2 deletions

View File

@ -1,3 +1,7 @@
:host {
width: 100%;
}
}
.error-dialog h3 {
margin: 16px 0;
}

View File

@ -40,4 +40,11 @@
<button type="button" class="mdl-button" *ngIf="!hasFormKey() && isTaskActive()" (click)="onComplete()">
{{ 'TASK_DETAILS.BUTTON.COMPLETE' | translate }}
</button>
<dialog class="mdl-dialog error-dialog" #errorDialog>
<div class="mdl-dialog__content">
<h3>{{'TASK_DETAILS.ERROR.TITLE'|translate}}</h3>
<p>{{'TASK_DETAILS.ERROR.DESCRIPTION'|translate}}</p>
<button type="button" class="mdl-button" (click)="closeErrorDialog()">{{'TASK_DETAILS.ERROR.CLOSE'|translate}}</button>
</div>
</dialog>
</div>

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, TemplateRef, OnChanges, SimpleChanges } from '@angular/core';
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, TemplateRef, OnChanges, SimpleChanges, DebugElement } from '@angular/core';
import { AlfrescoTranslationService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
import { TaskDetailsModel } from '../models/task-details.model';
@ -37,6 +37,9 @@ export class ActivitiTaskDetails implements OnInit, OnChanges {
@ViewChild('activitichecklist')
activitichecklist: any;
@ViewChild('errorDialog')
errorDialog: DebugElement;
@Input()
taskId: string;
@ -215,10 +218,15 @@ export class ActivitiTaskDetails implements OnInit, OnChanges {
}
onFormError(error: any) {
this.errorDialog.nativeElement.showModal();
this.onError.emit(error);
}
onExecuteFormOutcome(event: FormOutcomeEvent) {
this.executeOutcome.emit(event);
}
closeErrorDialog(): void {
this.errorDialog.nativeElement.close();
}
}

View File

@ -33,6 +33,11 @@
},
"CHECKLIST": {
"NONE": "No checklist."
},
"ERROR": {
"TITLE": "Something went wrong",
"DESCRIPTION": "Could not complete the specified action. Please try again or check that you have permission.",
"CLOSE": "Close"
}
},
"TASK_FILTERS": {