2017-01-13 16:54:16 -05:00
|
|
|
/* global Vue, gl */
|
2017-01-06 18:06:12 -05:00
|
|
|
/* eslint-disable no-param-reassign */
|
2016-10-25 18:00:38 -04:00
|
|
|
|
2017-02-05 13:17:38 -05:00
|
|
|
window.Vue = require('vue');
|
|
|
|
require('../vue_shared/components/table_pagination');
|
|
|
|
require('./store');
|
|
|
|
require('../vue_shared/components/pipelines_table');
|
2017-01-28 16:26:04 -05:00
|
|
|
|
2016-10-26 14:43:58 -04:00
|
|
|
((gl) => {
|
2016-11-18 17:26:49 -05:00
|
|
|
gl.VuePipelines = Vue.extend({
|
2017-01-28 16:26:04 -05:00
|
|
|
|
2016-10-30 16:46:31 -04:00
|
|
|
components: {
|
2017-01-29 10:30:04 -05:00
|
|
|
'gl-pagination': gl.VueGlPagination,
|
2017-01-28 16:26:04 -05:00
|
|
|
'pipelines-table-component': gl.pipelines.PipelinesTableComponent,
|
2016-10-30 16:46:31 -04:00
|
|
|
},
|
2017-01-28 16:26:04 -05:00
|
|
|
|
2016-10-29 15:50:08 -04:00
|
|
|
data() {
|
|
|
|
return {
|
2016-10-30 03:28:57 -04:00
|
|
|
pipelines: [],
|
2016-12-02 17:05:01 -05:00
|
|
|
timeLoopInterval: '',
|
2016-10-31 15:02:34 -04:00
|
|
|
intervalId: '',
|
2016-12-05 15:17:23 -05:00
|
|
|
apiScope: 'all',
|
2016-12-07 15:35:26 -05:00
|
|
|
pageInfo: {},
|
2016-12-07 17:20:30 -05:00
|
|
|
pagenum: 1,
|
2016-12-08 13:05:20 -05:00
|
|
|
count: { all: 0, running_or_pending: 0 },
|
2016-11-11 00:21:09 -05:00
|
|
|
pageRequest: false,
|
2016-10-29 15:50:08 -04:00
|
|
|
};
|
|
|
|
},
|
2016-12-12 14:11:28 -05:00
|
|
|
props: ['scope', 'store', 'svgs'],
|
2016-10-30 03:28:57 -04:00
|
|
|
created() {
|
2017-01-09 11:19:55 -05:00
|
|
|
const pagenum = gl.utils.getParameterByName('p');
|
|
|
|
const scope = gl.utils.getParameterByName('scope');
|
2016-12-05 15:17:23 -05:00
|
|
|
if (pagenum) this.pagenum = pagenum;
|
|
|
|
if (scope) this.apiScope = scope;
|
2016-12-08 13:05:20 -05:00
|
|
|
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope);
|
2016-10-30 03:28:57 -04:00
|
|
|
},
|
|
|
|
methods: {
|
2016-12-08 19:37:00 -05:00
|
|
|
change(pagenum, apiScope) {
|
2017-02-09 10:10:16 -05:00
|
|
|
if (!apiScope) apiScope = 'all';
|
2017-01-13 16:54:16 -05:00
|
|
|
gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`);
|
2016-10-31 15:02:34 -04:00
|
|
|
},
|
2016-10-30 03:28:57 -04:00
|
|
|
},
|
2016-10-25 18:00:38 -04:00
|
|
|
template: `
|
2016-11-02 20:54:04 -04:00
|
|
|
<div>
|
2017-02-03 10:14:20 -05:00
|
|
|
<div class="pipelines realtime-loading" v-if='pageRequest'>
|
2016-11-11 00:21:09 -05:00
|
|
|
<i class="fa fa-spinner fa-spin"></i>
|
|
|
|
</div>
|
2017-02-03 10:14:20 -05:00
|
|
|
|
|
|
|
<div class="blank-state blank-state-no-icon"
|
|
|
|
v-if="!pageRequest && pipelines.length === 0">
|
|
|
|
<h2 class="blank-state-title js-blank-state-title">
|
|
|
|
No pipelines to show
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="table-holder" v-if='!pageRequest && pipelines.length'>
|
2017-01-28 16:26:04 -05:00
|
|
|
<pipelines-table-component
|
|
|
|
:pipelines='pipelines'
|
|
|
|
:svgs='svgs'>
|
|
|
|
</pipelines-table-component>
|
2016-11-02 20:54:04 -04:00
|
|
|
</div>
|
2017-02-03 10:14:20 -05:00
|
|
|
|
2016-11-10 22:08:55 -05:00
|
|
|
<gl-pagination
|
2017-02-03 10:14:20 -05:00
|
|
|
v-if='!pageRequest && pipelines.length && pageInfo.total > pageInfo.perPage'
|
2016-11-03 13:20:15 -04:00
|
|
|
:pagenum='pagenum'
|
2016-12-08 19:37:00 -05:00
|
|
|
:change='change'
|
2016-11-10 14:46:29 -05:00
|
|
|
:count='count.all'
|
2016-12-07 15:35:26 -05:00
|
|
|
:pageInfo='pageInfo'
|
2016-11-02 20:54:04 -04:00
|
|
|
>
|
2016-11-10 22:08:55 -05:00
|
|
|
</gl-pagination>
|
2016-11-01 20:16:51 -04:00
|
|
|
</div>
|
2016-10-25 18:00:38 -04:00
|
|
|
`,
|
2016-10-26 14:43:58 -04:00
|
|
|
});
|
|
|
|
})(window.gl || (window.gl = {}));
|