Commit b56e57ec authored by Fatih Acet's avatar Fatih Acet

Merge branch 'pipelines_missing_pagination' into 'master'

fix pagination component handling different header styles from different server proxies

See merge request !8569
parents 62f8cc11 ebc1d5b3
/* global Vue, VueResource, gl */ /* global Vue, VueResource, gl */
/*= require vue_common_component/commit */ /*= require vue_common_component/commit */
/*= require vue_pagination/index */
/*= require vue-resource /*= require vue-resource
/*= require boards/vue_resource_interceptor */ /*= require boards/vue_resource_interceptor */
/*= require ./status.js.es6 */ /*= require ./status.js.es6 */
......
...@@ -3,15 +3,25 @@ ...@@ -3,15 +3,25 @@
/*= require vue_realtime_listener/index.js */ /*= require vue_realtime_listener/index.js */
((gl) => { ((gl) => {
const pageValues = headers => ({ const pageValues = (headers) => {
perPage: +headers['X-Per-Page'], const normalizedHeaders = {};
page: +headers['X-Page'],
total: +headers['X-Total'], Object.keys(headers).forEach((e) => {
totalPages: +headers['X-Total-Pages'], normalizedHeaders[e.toUpperCase()] = headers[e];
nextPage: +headers['X-Next-Page'],
previousPage: +headers['X-Prev-Page'],
}); });
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 { gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url, apiScope) { fetchDataLoop(Vue, pageNum, url, apiScope) {
const updatePipelineNums = (count) => { const updatePipelineNums = (count) => {
......
...@@ -64,5 +64,4 @@ ...@@ -64,5 +64,4 @@
.vue-pipelines-index .vue-pipelines-index
= page_specific_javascript_tag('vue_pagination/index.js')
= page_specific_javascript_tag('vue_pipelines_index/index.js') = page_specific_javascript_tag('vue_pipelines_index/index.js')
...@@ -111,7 +111,6 @@ module Gitlab ...@@ -111,7 +111,6 @@ module Gitlab
config.assets.precompile << "lib/*.js" config.assets.precompile << "lib/*.js"
config.assets.precompile << "u2f.js" config.assets.precompile << "u2f.js"
config.assets.precompile << "vue_pipelines_index/index.js" config.assets.precompile << "vue_pipelines_index/index.js"
config.assets.precompile << "vue_pagination/index.js"
config.assets.precompile << "vendor/assets/fonts/*" config.assets.precompile << "vendor/assets/fonts/*"
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment