/* global Vue, gl */ /* eslint-disable no-param-reassign */ window.Vue = require('vue'); require('../vue_shared/components/table_pagination'); require('./store'); require('../vue_shared/components/pipelines_table'); const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_store'); ((gl) => { gl.VuePipelines = Vue.extend({ components: { 'gl-pagination': gl.VueGlPagination, 'pipelines-table-component': gl.pipelines.PipelinesTableComponent, }, data() { return { pipelines: [], timeLoopInterval: '', intervalId: '', apiScope: 'all', pageInfo: {}, pagenum: 1, count: {}, pageRequest: false, }; }, props: ['scope', 'store'], created() { const pagenum = gl.utils.getParameterByName('page'); const scope = gl.utils.getParameterByName('scope'); if (pagenum) this.pagenum = pagenum; if (scope) this.apiScope = scope; this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope); }, beforeUpdate() { if (this.pipelines.length && this.$children) { CommitPipelinesStoreWithTimeAgo.startTimeAgoLoops.call(this, Vue); } }, methods: { /** * Will change the page number and update the URL. * * @param {Number} pageNumber desired page to go to. */ change(pageNumber) { const param = gl.utils.setParamInURL('page', pageNumber); gl.utils.visitUrl(param); return param; }, }, template: `

No pipelines to show

`, }); })(window.gl || (window.gl = {}));