diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-10-02 14:34:02 +0200 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-02 17:08:14 +0200 |
commit | 64ad6458486dc53da0a646419e4702319df6dace (patch) | |
tree | 4b46d079ef8a6b26dfacae8b87e56032864d3e8e /app | |
parent | c9e8b59c8540f7be198463db4477130046a8d655 (diff) | |
download | gitlab-ce-64ad6458486dc53da0a646419e4702319df6dace.tar.gz |
Add confirmation for immediately starting scheduled jobs
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pipelines/components/pipelines_actions.vue | 14 | ||||
-rw-r--r-- | app/views/projects/ci/builds/_build.html.haml | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/app/assets/javascripts/pipelines/components/pipelines_actions.vue b/app/assets/javascripts/pipelines/components/pipelines_actions.vue index fa5ad62f438..1768c7dc2b3 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_actions.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_actions.vue @@ -1,4 +1,5 @@ <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 diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml index 2b699770998..59c297c46a5 100644 --- a/app/views/projects/ci/builds/_build.html.haml +++ b/app/views/projects/ci/builds/_build.html.haml @@ -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, |