[ci skip] Updates table when stage is clicked

This commit is contained in:
Filipa Lacerda 2018-04-09 15:06:06 +01:00
parent ab98308db7
commit 6c76e81bbf
2 changed files with 20 additions and 2 deletions

View file

@ -1,5 +1,4 @@
<script> <script>
import $ from 'jquery';
/** /**
* Renders each stage of the pipeline mini graph. * Renders each stage of the pipeline mini graph.
@ -13,8 +12,11 @@
* 3. Merge request widget * 3. Merge request widget
* 4. Commit widget * 4. Commit widget
*/ */
import axios from '../../lib/utils/axios_utils';
import $ from 'jquery';
import Flash from '../../flash'; 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 Icon from '../../vue_shared/components/icon.vue';
import LoadingIcon from '../../vue_shared/components/loading_icon.vue'; import LoadingIcon from '../../vue_shared/components/loading_icon.vue';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
@ -82,6 +84,7 @@
methods: { methods: {
onClickStage() { onClickStage() {
if (!this.isDropdownOpen()) { if (!this.isDropdownOpen()) {
eventHub.$emit('clickedDropdown');
this.isLoading = true; this.isLoading = true;
this.fetchJobs(); this.fetchJobs();
} }

View file

@ -52,14 +52,29 @@ export default {
}); });
eventHub.$on('postAction', this.postAction); eventHub.$on('postAction', this.postAction);
eventHub.$on('clickedDropdown', this.updateTable);
}, },
beforeDestroy() { beforeDestroy() {
eventHub.$off('postAction', this.postAction); eventHub.$off('postAction', this.postAction);
eventHub.$off('clickedDropdown', this.updateTable);
}, },
destroyed() { destroyed() {
this.poll.stop(); this.poll.stop();
}, },
methods: { methods: {
updateTable() {
// Cancel ongoing request
if (this.isMakingRequest) {
}
// Stop polling
this.poll.stop();
// make new request
this.fetchPipelines();
// restart polling
this.poll.restart();
},
fetchPipelines() { fetchPipelines() {
if (!this.isMakingRequest) { if (!this.isMakingRequest) {
this.isLoading = true; this.isLoading = true;