summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-02-24 18:20:38 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-02-24 18:20:38 +0000
commit009a323dc2064e0fe4f00523df4fb17e89134f6e (patch)
treee0b503ddc0f7727a2fb2715341d7472029bc7f0e
parent00cb8237f24be736816f9a60192c7a6cb1b54ed9 (diff)
downloadgitlab-ce-28419-ask-confirmation-cancel.tar.gz
Adds confirmation for cancel button28419-ask-confirmation-cancel
-rw-r--r--app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es617
1 files changed, 16 insertions, 1 deletions
diff --git a/app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es6
index 54e8f977a47..c953a589456 100644
--- a/app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es6
+++ b/app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es6
@@ -1,5 +1,5 @@
/* global Vue, Flash, gl */
-/* eslint-disable no-param-reassign */
+/* eslint-disable no-param-reassign, no-alert */
((gl) => {
gl.VuePipelineActions = Vue.extend({
@@ -16,6 +16,20 @@
download(name) {
return `Download ${name} artifacts`;
},
+
+ /**
+ * Shows a dialog when the user clicks in the cancel button.
+ * We need to prevent the default behavior and stop propagation because the
+ * link relies on UJS.
+ *
+ * @param {Event} event
+ */
+ confirmAction(event) {
+ if (!confirm('Are you sure you want to cancel this pipeline?')) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ },
},
template: `
<td class="pipeline-actions hidden-xs">
@@ -87,6 +101,7 @@
</a>
<a
v-if='pipeline.flags.cancelable'
+ @click="confirmAction"
class="btn btn-remove has-tooltip"
title="Cancel"
rel="nofollow"