2016-10-26 14:43:58 -04:00
|
|
|
/* global Vue, gl */
|
2016-11-02 18:45:22 -04:00
|
|
|
/* eslint-disable no-param-reassign, no-bitwise*/
|
2016-10-25 18:00:38 -04:00
|
|
|
|
2016-10-26 14:43:58 -04:00
|
|
|
((gl) => {
|
2016-10-25 18:00:38 -04:00
|
|
|
gl.VuePipeLines = Vue.extend({
|
2016-10-30 16:46:31 -04:00
|
|
|
components: {
|
2016-11-11 00:21:09 -05:00
|
|
|
runningPipeline: gl.VueRunningPipeline,
|
|
|
|
pipelineActions: gl.VuePipelineActions,
|
|
|
|
stages: gl.VueStages,
|
|
|
|
branchCommit: gl.VueBranchCommit,
|
|
|
|
pipelineUrl: gl.VuePipelineUrl,
|
|
|
|
pipelineHead: gl.VuePipelineHead,
|
|
|
|
glPagination: gl.VueGlPagination,
|
|
|
|
statusScope: gl.VueStatusScope,
|
|
|
|
timeAgo: gl.VueTimeAgo,
|
2016-10-30 16:46:31 -04:00
|
|
|
},
|
2016-10-29 15:50:08 -04:00
|
|
|
data() {
|
|
|
|
return {
|
2016-10-30 03:28:57 -04:00
|
|
|
pipelines: [],
|
2016-10-31 15:02:34 -04:00
|
|
|
intervalId: '',
|
2016-11-10 15:17:33 -05:00
|
|
|
updatedAt: '',
|
2016-11-03 13:20:15 -04:00
|
|
|
pagenum: 1,
|
2016-11-10 14:46:29 -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-10-30 16:46:31 -04:00
|
|
|
props: [
|
|
|
|
'scope',
|
|
|
|
'store',
|
|
|
|
],
|
2016-10-30 03:28:57 -04:00
|
|
|
created() {
|
2016-11-02 18:45:22 -04:00
|
|
|
const url = window.location.toString();
|
2016-11-03 13:20:15 -04:00
|
|
|
if (~url.indexOf('?')) this.pagenum = url.split('?')[1].split('=')[1];
|
2016-11-10 12:16:27 -05:00
|
|
|
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope);
|
2016-10-30 03:28:57 -04:00
|
|
|
},
|
|
|
|
methods: {
|
2016-11-08 14:23:29 -05:00
|
|
|
changepage(event, last) {
|
|
|
|
const text = event.target.innerText;
|
2016-11-08 16:57:16 -05:00
|
|
|
if (text === '...') return;
|
2016-11-08 15:04:30 -05:00
|
|
|
if (/^-?[\d.]+(?:e-?\d+)?$/.test(text)) this.pagenum = +text;
|
2016-11-08 16:57:16 -05:00
|
|
|
if (text === 'Last >>') this.pagenum = last;
|
2016-11-08 14:31:41 -05:00
|
|
|
if (text === 'Next') this.pagenum = +this.pagenum + 1;
|
2016-11-08 14:23:29 -05:00
|
|
|
if (text === 'Prev') this.pagenum = +this.pagenum - 1;
|
2016-11-08 16:57:16 -05:00
|
|
|
if (text === '<< First') this.pagenum = 1;
|
2016-11-06 13:17:18 -05:00
|
|
|
|
2016-11-03 13:20:15 -04:00
|
|
|
window.history.pushState({}, null, `?p=${this.pagenum}`);
|
2016-11-02 20:54:04 -04:00
|
|
|
clearInterval(this.intervalId);
|
2016-11-11 00:21:09 -05:00
|
|
|
this.pageRequest = true;
|
2016-11-10 12:16:27 -05:00
|
|
|
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope);
|
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>
|
2016-11-11 00:21:09 -05:00
|
|
|
<div class="pipeline-loading-status" v-if='pipelines.length < 1'>
|
|
|
|
<i class="fa fa-spinner fa-spin"></i>
|
|
|
|
</div>
|
|
|
|
<div class="table-holder" v-if='pipelines.length > 0'>
|
2016-11-02 20:54:04 -04:00
|
|
|
<table class="table ci-table">
|
2016-11-10 22:08:55 -05:00
|
|
|
<pipeline-head></pipeline-head>
|
2016-11-02 20:54:04 -04:00
|
|
|
<tbody>
|
|
|
|
<tr class="commit" v-for='pipeline in pipelines'>
|
2016-11-10 22:08:55 -05:00
|
|
|
<status-scope :pipeline='pipeline'></status-scope>
|
|
|
|
<pipeline-url :pipeline='pipeline'></pipeline-url>
|
|
|
|
<branch-commit :pipeline='pipeline'></branch-commit>
|
|
|
|
<stages :pipeline='pipeline'></stages>
|
|
|
|
<time-ago :pipeline='pipeline'></time-ago>
|
|
|
|
<pipeline-actions :pipeline='pipeline'></pipeline-actions>
|
2016-11-02 20:54:04 -04:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2016-11-11 00:21:09 -05:00
|
|
|
<div class="pipeline-loading-status" v-if='pageRequest'>
|
|
|
|
<i class="fa fa-spinner fa-spin"></i>
|
|
|
|
</div>
|
2016-11-10 22:08:55 -05:00
|
|
|
<gl-pagination
|
2016-11-10 14:46:29 -05:00
|
|
|
v-if='count.all > 0'
|
2016-11-03 13:20:15 -04:00
|
|
|
:pagenum='pagenum'
|
2016-11-02 20:54:04 -04:00
|
|
|
:changepage='changepage'
|
2016-11-10 14:46:29 -05:00
|
|
|
:count='count.all'
|
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 = {}));
|