summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-05-24 09:42:21 +0000
committerPhil Hughes <me@iamphill.com>2018-05-24 09:42:21 +0000
commit942fe5fe79f512b4c801fc887a1240a963b827d0 (patch)
tree22ce06b35128263e7a1537f77c6ac1f566c3bf24
parente97a87433b2f55b2f688771cbe47d627f49d4b44 (diff)
parent25aec20fab63946dfe1c5b9ae544e15cfcff2b81 (diff)
downloadgitlab-ce-942fe5fe79f512b4c801fc887a1240a963b827d0.tar.gz
Merge branch 'fl-loading-icon' into 'master'
Show loading icon only when making the request See merge request gitlab-org/gitlab-ce!19116
-rw-r--r--app/assets/javascripts/pipelines/components/pipelines_table.vue3
-rw-r--r--app/assets/javascripts/pipelines/components/pipelines_table_row.vue12
-rw-r--r--spec/javascripts/pipelines/pipelines_table_row_spec.js11
3 files changed, 22 insertions, 4 deletions
diff --git a/app/assets/javascripts/pipelines/components/pipelines_table.vue b/app/assets/javascripts/pipelines/components/pipelines_table.vue
index 41986b827cd..4318abe97e0 100644
--- a/app/assets/javascripts/pipelines/components/pipelines_table.vue
+++ b/app/assets/javascripts/pipelines/components/pipelines_table.vue
@@ -37,6 +37,7 @@
return {
pipelineId: '',
endpoint: '',
+ cancelingPipeline: null,
};
},
computed: {
@@ -64,6 +65,7 @@
},
onSubmit() {
eventHub.$emit('postAction', this.endpoint);
+ this.cancelingPipeline = this.pipelineId;
},
},
};
@@ -106,6 +108,7 @@
:update-graph-dropdown="updateGraphDropdown"
:auto-devops-help-path="autoDevopsHelpPath"
:view-type="viewType"
+ :canceling-pipeline="cancelingPipeline"
/>
<modal
diff --git a/app/assets/javascripts/pipelines/components/pipelines_table_row.vue b/app/assets/javascripts/pipelines/components/pipelines_table_row.vue
index 0f671ceea21..b99246a92d0 100644
--- a/app/assets/javascripts/pipelines/components/pipelines_table_row.vue
+++ b/app/assets/javascripts/pipelines/components/pipelines_table_row.vue
@@ -46,12 +46,16 @@
type: String,
required: true,
},
+ cancelingPipeline: {
+ type: String,
+ required: false,
+ default: null,
+ },
},
pipelinesTable: PIPELINES_TABLE,
data() {
return {
isRetrying: false,
- isCancelling: false,
};
},
computed: {
@@ -227,12 +231,14 @@
isChildView() {
return this.viewType === 'child';
},
+
+ isCancelling() {
+ return this.cancelingPipeline === this.pipeline.id;
+ },
},
methods: {
handleCancelClick() {
- this.isCancelling = true;
-
eventHub.$emit('openConfirmationModal', {
pipelineId: this.pipeline.id,
endpoint: this.pipeline.cancel_path,
diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js
index 05ca4cb9044..68043b91bd0 100644
--- a/spec/javascripts/pipelines/pipelines_table_row_spec.js
+++ b/spec/javascripts/pipelines/pipelines_table_row_spec.js
@@ -182,7 +182,16 @@ describe('Pipelines Table Row', () => {
});
component.$el.querySelector('.js-pipelines-cancel-button').click();
- expect(component.isCancelling).toEqual(true);
+ });
+
+ it('renders a loading icon when `cancelingPipeline` matches pipeline id', done => {
+ component.cancelingPipeline = pipeline.id;
+ component.$nextTick()
+ .then(() => {
+ expect(component.isCancelling).toEqual(true);
+ })
+ .then(done)
+ .catch(done.fail);
});
});
});