Merge pull request #4280 from tsiegleauq/prompt-in-workflow-detail

Add prompt before deleting workflow states
This commit is contained in:
Emanuel Schütze 2019-02-08 10:39:25 +01:00 committed by GitHub
commit fa8cc366e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -1066,7 +1066,6 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
* @param id Motion tag id
*/
public setTag(event: MouseEvent, id: number): void {
console.log('event: ', event);
event.stopPropagation();
this.repo.setTag(this.motion, id);
}

View File

@ -10,6 +10,7 @@ import { BaseViewComponent } from 'app/site/base/base-view';
import { ViewWorkflow } from '../../models/view-workflow';
import { WorkflowRepositoryService } from 'app/core/repositories/motions/workflow-repository.service';
import { WorkflowState, MergeAmendment } from 'app/shared/models/motions/workflow-state';
import { PromptService } from 'app/core/ui-services/prompt.service';
/**
* Declares data for the workflow dialog
@ -137,6 +138,7 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
* @param title Set the page title
* @param translate Handle translations
* @param matSnackBar Showing error
* @param promtService Promts
* @param dialog Opening dialogs
* @param workflowRepo The repository for workflows
* @param route Read out URL paramters
@ -145,6 +147,7 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
title: Title,
translate: TranslateService,
matSnackBar: MatSnackBar,
private promtService: PromptService,
private dialog: MatDialog,
private workflowRepo: WorkflowRepositoryService,
private route: ActivatedRoute
@ -180,8 +183,14 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
if (result.action === 'update') {
this.workflowRepo.updateState({ name: result.value }, state).then(() => {}, this.raiseError);
} else if (result.action === 'delete') {
const content = this.translate.instant('Delete') + ` ${state.name}?`;
this.promtService.open('Are you sure', content).then(promptResult => {
if (promptResult) {
this.workflowRepo.deleteState(state).then(() => {}, this.raiseError);
}
});
}
}
});
}