diff --git a/app/assets/javascripts/vue_pagination/index.js.es6 b/app/assets/javascripts/vue_pagination/index.js.es6 index 7703901e1138cb4005289e1d219833ec6f73ee55..dce1c86ffa24f9dbf31c7e66d2561b42ef4cfd97 100644 --- a/app/assets/javascripts/vue_pagination/index.js.es6 +++ b/app/assets/javascripts/vue_pagination/index.js.es6 @@ -8,117 +8,38 @@ 'count', 'pagenum', ], - data() { - return { - nslice: +this.pagenum, - endcount: this.last, - }; - }, methods: { pagenumberstatus(n) { if (n - 1 === +this.pagenum) return 'active'; return ''; }, - prevstatus() { - if (+this.pagenum > 1) return ''; - return 'disabled'; - }, - createSection(n) { - return Array.from(Array(n)).map((e, i) => i); - }, + createSection(n) { return Array.from(Array(n)).map((e, i) => i); }, }, computed: { - dynamicpage() { - const section = this.createSection(this.upcount); - section.shift(); - this.nslice = +this.pagenum; - this.endcount = +this.pagenum + 5; - if (+this.pagenum + 5 <= this.last) { - return section.slice(+this.pagenum, +this.pagenum + 5); - } - if (+this.pagenum + 5 > this.last) { - return section.slice(this.last - 5, this.last); - } - }, - paginationsection() { - if (this.last < 6 && this.pagenum < 6) { - const pageArray = this.createSection(6); - pageArray.shift(); - return pageArray.slice(0, this.upcount); - } - return this.dynamicpage; - }, - last() { - return Math.ceil(+this.count / 5); - }, - upcount() { - return +this.last + 1; - }, - endspread() { - if (+this.pagenum < this.last) return true; - return false; - }, - begspread() { - if (+this.pagenum > 5 && +this.pagenum < this.last) return true; - return false; + last() { return Math.ceil(+this.count / 5); }, + getItems() { + const items = []; + const pages = this.createSection(+this.last + 1); + pages.shift(); + + if (+this.pagenum !== 1) items.push({ text: 'Prev' }); + + pages.forEach(i => items.push({ text: i })); + + if (+this.pagenum < this.last) items.push({ text: 'Next' }); + if (+this.pagenum !== this.last) items.push({ text: 'Last »' }); + + return items; }, }, template: `
-
`, - // render(createElement) { - // return createElement('div', { - // class: { - // 'gl-pagination': true, - // }, - // }, [createElement('ul', { - // class: { - // pagination: true, - // clearfix: true, - // }, - // }, this.paginationsection.map((e, i) => { - // if (!i) return createElement('li', [createElement('span', { - // class: { - // prev: this.prevstatus, - // }, - // }, 'Prev')]); - // if (i) { - // return createElement('li', - // [createElement('span', i)] - // ); - // } - // })), - // ]); - // }, }); })(window.gl || (window.gl = {})); diff --git a/app/assets/javascripts/vue_pipelines_index/index.js.es6 b/app/assets/javascripts/vue_pipelines_index/index.js.es6 index 1aea0820208a66d1ef42ef782c92805a8d1c3074..f7657879ac4c4581b39c345d9819a119a0761b40 100644 --- a/app/assets/javascripts/vue_pipelines_index/index.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/index.js.es6 @@ -34,7 +34,7 @@ diff --git a/app/assets/javascripts/vue_pipelines_index/pipeline_head.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipeline_head.js.es6 index 2ead571aa9f20ebda644466c59647e492856d607..510e54f3a6f9a86a7e685e161f51828b3df68a3b 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipeline_head.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/pipeline_head.js.es6 @@ -3,13 +3,6 @@ ((gl) => { gl.VuePipelineHead = Vue.extend({ - components: { - 'vue-running-icon': gl.VueRunningIcon, - }, - props: [ - 'pipeline', - 'pipelineurl', - ], template: ` diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 index 4ef9fca6474cba6c51e332240087342fb5c3c159..ecb07af9a32b8b7a592e05808787ab5a99f4465c 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 @@ -35,10 +35,12 @@ shortsha(pipeline) { return pipeline.sha.slice(0, 8); }, - changepage(event, page = {}) { - if (page) this.pagenum = +event.target.innerText; - if (page.where) this.pagenum = +page.where; - if (page.where) this.pagenum = +page.where; + changepage(event, last) { + const text = event.target.innerText; + if (typeof +text === 'number') this.pagenum = +text; + if (text === 'Last »') this.pagenum = last; + if (text === 'Next') this.pagnum = +this.pagenum + 1; + if (text === 'Prev') this.pagenum = +this.pagenum - 1; window.history.pushState({}, null, `?p=${this.pagenum}`); clearInterval(this.intervalId); diff --git a/app/assets/javascripts/vue_pipelines_index/store.js.es6 b/app/assets/javascripts/vue_pipelines_index/store.js.es6 index 89982b11b3174267be0ed84084ff305e2fa70e5d..d4b0c79f2258b3e66d01ba5d278d3d8e32d62f9a 100644 --- a/app/assets/javascripts/vue_pipelines_index/store.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/store.js.es6 @@ -21,7 +21,7 @@ // eventually clearInterval(this.intervalId) this.intervalId = setInterval(() => { goFetch(); - }, 60000); + }, 3000); } }; })(window.gl || (window.gl = {})); diff --git a/app/assets/javascripts/vue_pipelines_status/failed.js.es6 b/app/assets/javascripts/vue_pipelines_status/failed.js.es6 index 92373e12c25619b279fbfad5176ca92b215f8357..a877cfc688e9ed24ed6ff8c3c579df236d310ab5 100644 --- a/app/assets/javascripts/vue_pipelines_status/failed.js.es6 +++ b/app/assets/javascripts/vue_pipelines_status/failed.js.es6 @@ -4,7 +4,7 @@ ((gl) => { gl.VueFailedScope = Vue.extend({ components: { - 'vue-failed-icon': gl.VuePendingIcon, + 'vue-failed-icon': gl.VueFailedIcon, }, props: [ 'scope',