Commit c5a373c6 authored by Regis's avatar Regis

fix pagination component handling different header styles from different server proxies

parent 4b43126d
...@@ -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) => {
......
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