Commit 64ad6458 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Alessio Caiazza

Add confirmation for immediately starting scheduled jobs

parent c9e8b59c
<script>
import { s__, sprintf } from '~/locale';
import { formatTime } from '~/lib/utils/datetime_utility';
import eventHub from '../event_hub';
import icon from '../../vue_shared/components/icon.vue';
......@@ -23,10 +24,17 @@ export default {
};
},
methods: {
onClickAction(endpoint) {
onClickAction(action) {
const confirmationMessage = sprintf(s__("DelayedJobs|Are you sure you want to run %{jobName} immediately? This job will run automatically after it's timer finishes."), { jobName: action.name });
// https://gitlab.com/gitlab-org/gitlab-ce/issues/52099
// eslint-disable-next-line no-alert
if (!window.confirm(confirmationMessage)) {
return;
}
this.isLoading = true;
eventHub.$emit('postAction', endpoint);
eventHub.$emit('postAction', action.path);
},
isActionDisabled(action) {
......@@ -77,7 +85,7 @@ export default {
:disabled="isActionDisabled(action)"
type="button"
class="js-pipeline-action-link no-btn btn"
@click="onClickAction(action.path)"
@click="onClickAction(action)"
>
{{ action.name }}
<span
......
......@@ -109,10 +109,12 @@
title: job.scheduled_at }
= sprite_icon('planning')
= duration_in_numbers(job.execute_in, true)
- confirmation_message = s_("DelayedJobs|Are you sure you want to run %{job_name} immediately? This job will run automatically after it's timer finishes.") % { job_name: job.name }
= link_to play_project_job_path(job.project, job, return_to: request.original_url),
method: :post,
title: s_('DelayedJobs|Start now'),
class: 'btn btn-default btn-build has-tooltip' do
class: 'btn btn-default btn-build has-tooltip',
data: { confirm: confirmation_message } do
= sprite_icon('play')
= link_to unschedule_project_job_path(job.project, job, return_to: request.original_url),
method: :post,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment