diff --git a/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.html b/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.html index 06ce922a..210c9f08 100644 --- a/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.html +++ b/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.html @@ -4,9 +4,9 @@ i18n-title *ngIf="!Running" [disabled]="disabled || jobsService.jobStartingStopping[jobName]" - (click)="start();"> + (click)="openModal(jobRunModal);"> Run now: {{backendTextService.getJobName(jobName)}} + i18n>Run now: {{ backendTextService.getJobName(jobName) }} Cancel: {{backendTextService.getJobName(jobName)}} + i18n>Cancel: {{ backendTextService.getJobName(jobName) }} + + + + + + Do you want to run {{ backendTextService.getJobName(jobName) }}? + + + + + Are you sue you want to run this job? This will have the following effect: + + {{ backendTextService.getJobDescription(jobName) }} + + + + diff --git a/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.ts b/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.ts index ef73f98d..8e243598 100644 --- a/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.ts +++ b/src/frontend/app/ui/settings/workflow/button/job-button.settings.component.ts @@ -1,10 +1,13 @@ -import {Component, EventEmitter, Input, Output} from '@angular/core'; +import {Component, EventEmitter, Input, Output, TemplateRef} from '@angular/core'; import {JobProgressStates, OnTimerJobProgressDTO,} from '../../../../../../common/entities/job/JobProgressDTO'; import {ErrorDTO} from '../../../../../../common/entities/Error'; import {ScheduledJobsService} from '../../scheduled-jobs.service'; import {NotificationService} from '../../../../model/notification.service'; import {JobDTOUtils} from '../../../../../../common/entities/job/JobDTO'; import {BackendtextService} from '../../../../model/backendtext.service'; +import {BsModalRef} from 'ngx-bootstrap/modal'; +import {BsModalService} from '../../../../../../../node_modules/ngx-bootstrap/modal'; +import {ConfigStyle} from '../../settings.service'; @Component({ selector: 'app-settings-job-button', @@ -21,10 +24,12 @@ export class JobButtonComponent { @Input() danger = false; JobProgressStates = JobProgressStates; @Output() jobError = new EventEmitter(); + private modalRef: BsModalRef; constructor( private notification: NotificationService, public jobsService: ScheduledJobsService, + private modalService: BsModalService, public backendTextService: BackendtextService ) { } @@ -54,6 +59,28 @@ export class JobButtonComponent { ]; } + + public hideModal(): void { + this.modalRef.hide(); + this.modalRef = null; + } + + public async openModal(template: TemplateRef): Promise { + // if we show the button in short form (at the jobs settings), + // we assume users know what they are doing, + // so we do not show a confirm window. + if(this.shortName){ + await this.start(); + return; + } + this.modalRef = this.modalService.show(template, { + class: 'modal-lg', + }); + document.body.style.paddingRight = '0px'; + } + + + public async start(): Promise { this.jobError.emit(''); this.populateConfig(); @@ -98,6 +125,8 @@ export class JobButtonComponent { } return false; } + + protected readonly ConfigStyle = ConfigStyle; }