summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-02-24 21:31:32 +0000
committerFatih Acet <acetfatih@gmail.com>2017-02-24 21:31:32 +0000
commit1f8d6c790a8493a341f1786710aac36621e93bf6 (patch)
treef6c9f471b947deb19ab2b78b6a963d20195ace94
parented707dde8dbc7e568b1fecc827384d90abdc81c0 (diff)
parent009a323dc2064e0fe4f00523df4fb17e89134f6e (diff)
downloadgitlab-ce-1f8d6c790a8493a341f1786710aac36621e93bf6.tar.gz
Merge branch '28419-ask-confirmation-cancel' into 'master'
Adds confirmation for cancel button Closes #28419 See merge request !9519
-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"