From 2220c22b247b53b8c25b3eaf1231800d32682b13 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Fri, 8 Feb 2019 10:26:05 +0100 Subject: [PATCH] Add prompt before deleting workflow states Worked with promise.then, cause callbacks of subscribe are sync Also removes a console.log --- .../motion-detail/motion-detail.component.ts | 1 - .../workflow-detail/workflow-detail.component.ts | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts index 894e2efd6..3db401963 100644 --- a/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts @@ -1084,7 +1084,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); } diff --git a/client/src/app/site/motions/components/workflow-detail/workflow-detail.component.ts b/client/src/app/site/motions/components/workflow-detail/workflow-detail.component.ts index 68b0ddde7..205c93d4d 100644 --- a/client/src/app/site/motions/components/workflow-detail/workflow-detail.component.ts +++ b/client/src/app/site/motions/components/workflow-detail/workflow-detail.component.ts @@ -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,7 +183,13 @@ 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') { - this.workflowRepo.deleteState(state).then(() => {}, this.raiseError); + 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); + } + }); } } });