From c5a373c634a0547a204c35fec8fd2c4fe4acbca8 Mon Sep 17 00:00:00 2001 From: Regis Date: Fri, 13 Jan 2017 12:59:32 -0500 Subject: fix pagination component handling different header styles from different server proxies --- .../javascripts/vue_pipelines_index/store.js.es6 | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/vue_pipelines_index/store.js.es6 b/app/assets/javascripts/vue_pipelines_index/store.js.es6 index 6b34839b030..1982142853a 100644 --- a/app/assets/javascripts/vue_pipelines_index/store.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/store.js.es6 @@ -3,14 +3,24 @@ /*= require vue_realtime_listener/index.js */ ((gl) => { - const pageValues = headers => ({ - perPage: +headers['X-Per-Page'], - page: +headers['X-Page'], - total: +headers['X-Total'], - totalPages: +headers['X-Total-Pages'], - nextPage: +headers['X-Next-Page'], - previousPage: +headers['X-Prev-Page'], - }); + const pageValues = (headers) => { + const normalizedHeaders = {}; + + Object.keys(headers).forEach((e) => { + normalizedHeaders[e.toUpperCase()] = headers[e]; + }); + + const paginationInfo = { + perPage: +normalizedHeaders['X-PER-PAGE'], + page: +normalizedHeaders['X-PAGE'], + total: +normalizedHeaders['X-TOTAL'], + totalPages: +normalizedHeaders['X-TOTAL-PAGES'], + nextPage: +normalizedHeaders['X-NEXT-PAGE'], + previousPage: +normalizedHeaders['X-PREV-PAGE'], + }; + + return paginationInfo; + }; gl.PipelineStore = class { fetchDataLoop(Vue, pageNum, url, apiScope) { -- cgit v1.2.1 From ebc1d5b39d02ddf3d5a94e968084ca67a59603e2 Mon Sep 17 00:00:00 2001 From: Regis Date: Sun, 15 Jan 2017 00:11:12 -0500 Subject: change how pagination component is loaded --- app/assets/javascripts/vue_pipelines_index/index.js.es6 | 1 + app/views/projects/pipelines/index.html.haml | 1 - config/application.rb | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/assets/javascripts/vue_pipelines_index/index.js.es6 b/app/assets/javascripts/vue_pipelines_index/index.js.es6 index 9dfbedd73ab..edd01f17a97 100644 --- a/app/assets/javascripts/vue_pipelines_index/index.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/index.js.es6 @@ -1,5 +1,6 @@ /* global Vue, VueResource, gl */ /*= require vue_common_component/commit */ +/*= require vue_pagination/index */ /*= require vue-resource /*= require boards/vue_resource_interceptor */ /*= require ./status.js.es6 */ diff --git a/app/views/projects/pipelines/index.html.haml b/app/views/projects/pipelines/index.html.haml index abea6932567..df36279ed75 100644 --- a/app/views/projects/pipelines/index.html.haml +++ b/app/views/projects/pipelines/index.html.haml @@ -64,5 +64,4 @@ .vue-pipelines-index -= page_specific_javascript_tag('vue_pagination/index.js') = page_specific_javascript_tag('vue_pipelines_index/index.js') diff --git a/config/application.rb b/config/application.rb index aa52b0cd512..8ce549cebf6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -111,7 +111,6 @@ module Gitlab config.assets.precompile << "lib/*.js" config.assets.precompile << "u2f.js" config.assets.precompile << "vue_pipelines_index/index.js" - config.assets.precompile << "vue_pagination/index.js" config.assets.precompile << "vendor/assets/fonts/*" # Version of your assets, change this if you want to expire all your assets -- cgit v1.2.1