Add prompt before deleting workflow states
Worked with promise.then, cause callbacks of subscribe are sync Also removes a console.log
This commit is contained in:
parent
9664e52237
commit
2220c22b24
@ -1084,7 +1084,6 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
|
|||||||
* @param id Motion tag id
|
* @param id Motion tag id
|
||||||
*/
|
*/
|
||||||
public setTag(event: MouseEvent, id: number): void {
|
public setTag(event: MouseEvent, id: number): void {
|
||||||
console.log('event: ', event);
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.repo.setTag(this.motion, id);
|
this.repo.setTag(this.motion, id);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import { BaseViewComponent } from 'app/site/base/base-view';
|
|||||||
import { ViewWorkflow } from '../../models/view-workflow';
|
import { ViewWorkflow } from '../../models/view-workflow';
|
||||||
import { WorkflowRepositoryService } from 'app/core/repositories/motions/workflow-repository.service';
|
import { WorkflowRepositoryService } from 'app/core/repositories/motions/workflow-repository.service';
|
||||||
import { WorkflowState, MergeAmendment } from 'app/shared/models/motions/workflow-state';
|
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
|
* Declares data for the workflow dialog
|
||||||
@ -137,6 +138,7 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
|
|||||||
* @param title Set the page title
|
* @param title Set the page title
|
||||||
* @param translate Handle translations
|
* @param translate Handle translations
|
||||||
* @param matSnackBar Showing error
|
* @param matSnackBar Showing error
|
||||||
|
* @param promtService Promts
|
||||||
* @param dialog Opening dialogs
|
* @param dialog Opening dialogs
|
||||||
* @param workflowRepo The repository for workflows
|
* @param workflowRepo The repository for workflows
|
||||||
* @param route Read out URL paramters
|
* @param route Read out URL paramters
|
||||||
@ -145,6 +147,7 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
|
|||||||
title: Title,
|
title: Title,
|
||||||
translate: TranslateService,
|
translate: TranslateService,
|
||||||
matSnackBar: MatSnackBar,
|
matSnackBar: MatSnackBar,
|
||||||
|
private promtService: PromptService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private workflowRepo: WorkflowRepositoryService,
|
private workflowRepo: WorkflowRepositoryService,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute
|
||||||
@ -180,8 +183,14 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
|
|||||||
if (result.action === 'update') {
|
if (result.action === 'update') {
|
||||||
this.workflowRepo.updateState({ name: result.value }, state).then(() => {}, this.raiseError);
|
this.workflowRepo.updateState({ name: result.value }, state).then(() => {}, this.raiseError);
|
||||||
} else if (result.action === 'delete') {
|
} 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);
|
this.workflowRepo.deleteState(state).then(() => {}, this.raiseError);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user