extract param helper to pagination dir
This commit is contained in:
parent
bff8e5bad9
commit
2ecb65b8c4
|
|
@ -1,6 +1,8 @@
|
||||||
/* global Vue, gl */
|
/* global Vue, gl */
|
||||||
/* eslint-disable no-param-reassign, no-plusplus */
|
/* eslint-disable no-param-reassign, no-plusplus */
|
||||||
|
|
||||||
|
//= require ./param_helper.js.es6
|
||||||
|
|
||||||
((gl) => {
|
((gl) => {
|
||||||
const PAGINATION_UI_BUTTON_LIMIT = 4;
|
const PAGINATION_UI_BUTTON_LIMIT = 4;
|
||||||
const SPREAD = '...';
|
const SPREAD = '...';
|
||||||
|
|
@ -9,16 +11,6 @@
|
||||||
const FIRST = '<< First';
|
const FIRST = '<< First';
|
||||||
const LAST = 'Last >>';
|
const LAST = 'Last >>';
|
||||||
|
|
||||||
const getParameterByName = (name) => {
|
|
||||||
const url = window.location.href;
|
|
||||||
name = name.replace(/[[\]]/g, '\\$&');
|
|
||||||
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
|
|
||||||
const results = regex.exec(url);
|
|
||||||
if (!results) return null;
|
|
||||||
if (!results[2]) return '';
|
|
||||||
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
||||||
};
|
|
||||||
|
|
||||||
gl.VueGlPagination = Vue.extend({
|
gl.VueGlPagination = Vue.extend({
|
||||||
props: [
|
props: [
|
||||||
'change',
|
'change',
|
||||||
|
|
@ -27,7 +19,7 @@
|
||||||
methods: {
|
methods: {
|
||||||
changepage(e) {
|
changepage(e) {
|
||||||
let pagenum = this.pageInfo.page;
|
let pagenum = this.pageInfo.page;
|
||||||
let apiScope = getParameterByName('scope');
|
let apiScope = gl.getParameterByName('scope');
|
||||||
|
|
||||||
if (!apiScope) apiScope = 'all';
|
if (!apiScope) apiScope = 'all';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
/* eslint-disable no-param-reassign */
|
||||||
|
|
||||||
|
((w) => {
|
||||||
|
w.getParameterByName = (name) => {
|
||||||
|
const url = window.location.href;
|
||||||
|
name = name.replace(/[[\]]/g, '\\$&');
|
||||||
|
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
|
||||||
|
const results = regex.exec(url);
|
||||||
|
if (!results) return null;
|
||||||
|
if (!results[2]) return '';
|
||||||
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
||||||
|
};
|
||||||
|
})(window.gl || (window.gl = {}));
|
||||||
|
|
@ -2,16 +2,6 @@
|
||||||
/* eslint-disable no-param-reassign, no-bitwise*/
|
/* eslint-disable no-param-reassign, no-bitwise*/
|
||||||
|
|
||||||
((gl) => {
|
((gl) => {
|
||||||
const getParameterByName = (name) => {
|
|
||||||
const url = window.location.href;
|
|
||||||
name = name.replace(/[[\]]/g, '\\$&');
|
|
||||||
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
|
|
||||||
const results = regex.exec(url);
|
|
||||||
if (!results) return null;
|
|
||||||
if (!results[2]) return '';
|
|
||||||
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
||||||
};
|
|
||||||
|
|
||||||
gl.VuePipelines = Vue.extend({
|
gl.VuePipelines = Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
runningPipeline: gl.VueRunningPipeline,
|
runningPipeline: gl.VueRunningPipeline,
|
||||||
|
|
@ -38,8 +28,8 @@
|
||||||
},
|
},
|
||||||
props: ['scope', 'store'],
|
props: ['scope', 'store'],
|
||||||
created() {
|
created() {
|
||||||
const pagenum = getParameterByName('p');
|
const pagenum = gl.getParameterByName('p');
|
||||||
const scope = getParameterByName('scope');
|
const scope = gl.getParameterByName('scope');
|
||||||
if (pagenum) this.pagenum = pagenum;
|
if (pagenum) this.pagenum = pagenum;
|
||||||
if (scope) this.apiScope = scope;
|
if (scope) this.apiScope = scope;
|
||||||
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope);
|
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue