summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-04-09 15:06:06 +0100
committerFilipa Lacerda <filipa@gitlab.com>2018-04-13 18:57:08 +0100
commit6c76e81bbf76cf85f532d3b5601c16d77c9e4544 (patch)
tree4a7558eb23bf6c7af2b480cb0e8e77b03f8e27e8
parentab98308db7d907e5fad53d2b1e3435960a1665cd (diff)
downloadgitlab-ce-6c76e81bbf76cf85f532d3b5601c16d77c9e4544.tar.gz
[ci skip] Updates table when stage is clicked
-rw-r--r--app/assets/javascripts/pipelines/components/stage.vue7
-rw-r--r--app/assets/javascripts/pipelines/mixins/pipelines.js15
2 files changed, 20 insertions, 2 deletions
diff --git a/app/assets/javascripts/pipelines/components/stage.vue b/app/assets/javascripts/pipelines/components/stage.vue
index b3fcaf0ccd1..32cf3dba3c3 100644
--- a/app/assets/javascripts/pipelines/components/stage.vue
+++ b/app/assets/javascripts/pipelines/components/stage.vue
@@ -1,5 +1,4 @@
<script>
- import $ from 'jquery';
/**
* Renders each stage of the pipeline mini graph.
@@ -13,8 +12,11 @@
* 3. Merge request widget
* 4. Commit widget
*/
- import axios from '../../lib/utils/axios_utils';
+
+ import $ from 'jquery';
import Flash from '../../flash';
+ import axios from '../../lib/utils/axios_utils';
+ import eventHub from '../event_hub';
import Icon from '../../vue_shared/components/icon.vue';
import LoadingIcon from '../../vue_shared/components/loading_icon.vue';
import tooltip from '../../vue_shared/directives/tooltip';
@@ -82,6 +84,7 @@
methods: {
onClickStage() {
if (!this.isDropdownOpen()) {
+ eventHub.$emit('clickedDropdown');
this.isLoading = true;
this.fetchJobs();
}
diff --git a/app/assets/javascripts/pipelines/mixins/pipelines.js b/app/assets/javascripts/pipelines/mixins/pipelines.js
index 522a4277bd7..05143c43173 100644
--- a/app/assets/javascripts/pipelines/mixins/pipelines.js
+++ b/app/assets/javascripts/pipelines/mixins/pipelines.js
@@ -52,14 +52,29 @@ export default {
});
eventHub.$on('postAction', this.postAction);
+ eventHub.$on('clickedDropdown', this.updateTable);
},
beforeDestroy() {
eventHub.$off('postAction', this.postAction);
+ eventHub.$off('clickedDropdown', this.updateTable);
},
destroyed() {
this.poll.stop();
},
methods: {
+ updateTable() {
+ // Cancel ongoing request
+ if (this.isMakingRequest) {
+
+ }
+
+ // Stop polling
+ this.poll.stop();
+ // make new request
+ this.fetchPipelines();
+ // restart polling
+ this.poll.restart();
+ },
fetchPipelines() {
if (!this.isMakingRequest) {
this.isLoading = true;