Commit 01a97859 authored by Phil Hughes's avatar Phil Hughes

Merge branch '63590-pipeline-actions-cause-full-refresh' into 'master'

Resolve "Pipeline actions cause full refresh"

Closes #63590

See merge request gitlab-org/gitlab-ce!30190
parents 8608da87 cfa0c659
...@@ -44,6 +44,11 @@ export default { ...@@ -44,6 +44,11 @@ export default {
cancelingPipeline: null, cancelingPipeline: null,
}; };
}, },
watch: {
pipelines() {
this.cancelingPipeline = null;
},
},
created() { created() {
eventHub.$on('openConfirmationModal', this.setModalData); eventHub.$on('openConfirmationModal', this.setModalData);
}, },
......
...@@ -241,7 +241,11 @@ export default { ...@@ -241,7 +241,11 @@ export default {
return this.cancelingPipeline === this.pipeline.id; return this.cancelingPipeline === this.pipeline.id;
}, },
}, },
watch: {
pipeline() {
this.isRetrying = false;
},
},
methods: { methods: {
handleCancelClick() { handleCancelClick() {
eventHub.$emit('openConfirmationModal', { eventHub.$emit('openConfirmationModal', {
......
...@@ -107,8 +107,8 @@ export default { ...@@ -107,8 +107,8 @@ export default {
} }
// Stop polling // Stop polling
this.poll.stop(); this.poll.stop();
// Update the table // Restarting the poll also makes an initial request
return this.getPipelines().then(() => this.poll.restart()); this.poll.restart();
}, },
fetchPipelines() { fetchPipelines() {
if (!this.isMakingRequest) { if (!this.isMakingRequest) {
...@@ -153,7 +153,7 @@ export default { ...@@ -153,7 +153,7 @@ export default {
postAction(endpoint) { postAction(endpoint) {
this.service this.service
.postAction(endpoint) .postAction(endpoint)
.then(() => this.fetchPipelines()) .then(() => this.updateTable())
.catch(() => Flash(__('An error occurred while making the request.'))); .catch(() => Flash(__('An error occurred while making the request.')));
}, },
}, },
......
---
title: Fix pipelines table to update without refreshing after action
merge_request: 30190
author:
type: fixed
...@@ -736,10 +736,9 @@ describe('Pipelines', () => { ...@@ -736,10 +736,9 @@ describe('Pipelines', () => {
}); });
describe('when a request is being made', () => { describe('when a request is being made', () => {
it('stops polling, cancels the request, fetches pipelines & restarts polling', done => { it('stops polling, cancels the request, & restarts polling', done => {
spyOn(vm.poll, 'stop'); spyOn(vm.poll, 'stop');
spyOn(vm.poll, 'restart'); spyOn(vm.poll, 'restart');
spyOn(vm, 'getPipelines').and.returnValue(Promise.resolve());
spyOn(vm.service.cancelationSource, 'cancel').and.callThrough(); spyOn(vm.service.cancelationSource, 'cancel').and.callThrough();
setTimeout(() => { setTimeout(() => {
...@@ -754,7 +753,6 @@ describe('Pipelines', () => { ...@@ -754,7 +753,6 @@ describe('Pipelines', () => {
expect(vm.poll.stop).toHaveBeenCalled(); expect(vm.poll.stop).toHaveBeenCalled();
setTimeout(() => { setTimeout(() => {
expect(vm.getPipelines).toHaveBeenCalled();
expect(vm.poll.restart).toHaveBeenCalled(); expect(vm.poll.restart).toHaveBeenCalled();
done(); done();
}, 0); }, 0);
...@@ -765,10 +763,9 @@ describe('Pipelines', () => { ...@@ -765,10 +763,9 @@ describe('Pipelines', () => {
}); });
describe('when no request is being made', () => { describe('when no request is being made', () => {
it('stops polling, fetches pipelines & restarts polling', done => { it('stops polling & restarts polling', done => {
spyOn(vm.poll, 'stop'); spyOn(vm.poll, 'stop');
spyOn(vm.poll, 'restart'); spyOn(vm.poll, 'restart');
spyOn(vm, 'getPipelines').and.returnValue(Promise.resolve());
setTimeout(() => { setTimeout(() => {
vm.$el.querySelector('.js-builds-dropdown-button').click(); vm.$el.querySelector('.js-builds-dropdown-button').click();
...@@ -776,7 +773,6 @@ describe('Pipelines', () => { ...@@ -776,7 +773,6 @@ describe('Pipelines', () => {
expect(vm.poll.stop).toHaveBeenCalled(); expect(vm.poll.stop).toHaveBeenCalled();
setTimeout(() => { setTimeout(() => {
expect(vm.getPipelines).toHaveBeenCalled();
expect(vm.poll.restart).toHaveBeenCalled(); expect(vm.poll.restart).toHaveBeenCalled();
done(); done();
}, 0); }, 0);
......
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