mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[AAE-8740 Add a confirmation message in ADW (#7660)
* [AAE-8740 Add a confirmation message in ADW * update tests * use MatDialogHarness for tests * Cleaning tests Co-authored-by: Bartosz Sekula <Bartosz.Sekula@hyland.com>
This commit is contained in:
committed by
GitHub
parent
7c13a99ed7
commit
aeb5bff264
@@ -38,6 +38,10 @@ import {
|
||||
import { FormCloudService } from '../services/form-cloud.service';
|
||||
import { TaskVariableCloud } from '../models/task-variable-cloud.model';
|
||||
import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import {
|
||||
ConfirmDialogComponent
|
||||
} from '@alfresco/adf-content-services';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-form',
|
||||
@@ -105,6 +109,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
|
||||
constructor(protected formCloudService: FormCloudService,
|
||||
protected formService: FormService,
|
||||
private dialog: MatDialog,
|
||||
protected visibilityService: WidgetVisibilityService) {
|
||||
super();
|
||||
|
||||
@@ -266,6 +271,27 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
}
|
||||
|
||||
completeTaskForm(outcome?: string) {
|
||||
if (this.form?.confirmMessage?.show === true) {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
data: {
|
||||
message: this.form.confirmMessage.message
|
||||
},
|
||||
minWidth: '450px'
|
||||
});
|
||||
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(
|
||||
(result) => {
|
||||
if (result === true) {
|
||||
this.completeForm(outcome);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.completeForm(outcome);
|
||||
}
|
||||
}
|
||||
|
||||
private completeForm(outcome?: string) {
|
||||
if (this.form && this.appName && this.taskId) {
|
||||
this.formCloudService
|
||||
.completeTaskForm(this.appName, this.taskId, this.processInstanceId, `${this.form.id}`, this.form.values, outcome, this.appVersion)
|
||||
|
Reference in New Issue
Block a user