Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-04-06 02:55:49 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-04-07 00:50:37 +0300
commitf66e1c173406d2e447d46aab99f51c1277c801bc (patch)
tree58104264d835dd5f8e1607afbaf548362ddb56d8 /app/assets/javascripts/merge_request_tabs.js
parent9e89c93e167d66644fd771b106be5ce01b899fcf (diff)
Destroys pipeline table component when we change tabs in order to stop polling
Diffstat (limited to 'app/assets/javascripts/merge_request_tabs.js')
-rw-r--r--app/assets/javascripts/merge_request_tabs.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js
index 3c4e6102469..7cb42a172af 100644
--- a/app/assets/javascripts/merge_request_tabs.js
+++ b/app/assets/javascripts/merge_request_tabs.js
@@ -99,9 +99,10 @@ import './flash';
.off('click', this.clickTab);
}
- destroy() {
- this.unbindEvents();
+ destroyPipelinesView() {
if (this.commitPipelinesTable) {
+ document.querySelector('#commit-pipeline-table-view')
+ .removeChild(this.commitPipelinesTable.$el);
this.commitPipelinesTable.$destroy();
}
}
@@ -128,6 +129,7 @@ import './flash';
this.loadCommits($target.attr('href'));
this.expandView();
this.resetViewContainer();
+ this.destroyPipelinesView();
} else if (this.isDiffAction(action)) {
this.loadDiff($target.attr('href'));
if (Breakpoints.get().getBreakpointSize() !== 'lg') {
@@ -136,12 +138,14 @@ import './flash';
if (this.diffViewType() === 'parallel') {
this.expandViewContainer();
}
+ this.destroyPipelinesView();
} else if (action === 'pipelines') {
this.resetViewContainer();
- this.loadPipelines();
+ this.mountPipelinesView();
} else {
this.expandView();
this.resetViewContainer();
+ this.destroyPipelinesView();
}
if (this.setUrl) {
this.setCurrentAction(action);
@@ -227,16 +231,12 @@ import './flash';
});
}
- loadPipelines() {
- if (this.pipelinesLoaded) {
- return;
- }
- const pipelineTableViewEl = document.querySelector('#commit-pipeline-table-view');
- // Could already be mounted from the `pipelines_bundle`
- if (pipelineTableViewEl) {
- this.commitPipelinesTable = new CommitPipelinesTable().$mount(pipelineTableViewEl);
- }
- this.pipelinesLoaded = true;
+ mountPipelinesView() {
+ this.commitPipelinesTable = new CommitPipelinesTable().$mount();
+ // $mount(el) replaces the el with the new rendered component. We need it in order to mount
+ // it everytime this tab is clicked - https://vuejs.org/v2/api/#vm-mount
+ document.querySelector('#commit-pipeline-table-view')
+ .appendChild(this.commitPipelinesTable.$el);
}
loadDiff(source) {