Use pageSize config

This commit is contained in:
Zaid Abdulla committed 2018-12-26 00:22:07 -08:00
1 parent aa14189531
commit 562cbec573
2 files changed
+9 -5

No files matched your search

+4 -2
View File
@@ -11,6 +11,8 @@ import * as notifications from "./notifications";
import * as expression from "../common/expression"; import * as expression from "../common/expression";
import memoize from "../common/memoize"; import memoize from "../common/memoize";
const PAGE_SIZE = config.ui.pageSize || 10;
const memoizedParse = memoize(expression.parse); const memoizedParse = memoize(expression.parse);
const getDownloadUrl = memoize((filter, indexParameters) => { const getDownloadUrl = memoize((filter, indexParameters) => {
@@ -287,7 +289,7 @@ const component = {
document.title = "Devices - GenieACS"; document.title = "Devices - GenieACS";
function showMore() { function showMore() {
vnode.state.showCount = (vnode.state.showCount || 10) + 10; vnode.state.showCount = (vnode.state.showCount || PAGE_SIZE) + PAGE_SIZE;
m.redraw(); m.redraw();
} }
@@ -299,7 +301,7 @@ const component = {
? memoizedParse(vnode.attrs.filter) ? memoizedParse(vnode.attrs.filter)
: true; : true;
let devs = store.fetch("devices", filter, { let devs = store.fetch("devices", filter, {
limit: vnode.state.showCount || 10 limit: vnode.state.showCount || PAGE_SIZE
}); });
let count = store.count("devices", filter); let count = store.count("devices", filter);
+5 -3
View File
@@ -1,13 +1,15 @@
"use strict"; "use strict";
import m from "mithril"; import m from "mithril";
import config from "./config";
import filterComponent from "./filter-component"; import filterComponent from "./filter-component";
import * as store from "./store"; import * as store from "./store";
import * as notifications from "./notifications"; import * as notifications from "./notifications";
import * as expression from "../common/expression"; import * as expression from "../common/expression";
import memoize from "../common/memoize"; import memoize from "../common/memoize";
const PAGE_SIZE = config.ui.pageSize || 10;
const memoizedParse = memoize(expression.parse); const memoizedParse = memoize(expression.parse);
const getDownloadUrl = memoize(filter => { const getDownloadUrl = memoize(filter => {
@@ -171,7 +173,7 @@ const component = {
document.title = "Faults - GenieACS"; document.title = "Faults - GenieACS";
function showMore() { function showMore() {
vnode.state.showCount = (vnode.state.showCount || 10) + 10; vnode.state.showCount = (vnode.state.showCount || PAGE_SIZE) + PAGE_SIZE;
m.redraw(); m.redraw();
} }
@@ -184,7 +186,7 @@ const component = {
: true; : true;
let faults = store.fetch("faults", filter, { let faults = store.fetch("faults", filter, {
limit: vnode.state.showCount || 10 limit: vnode.state.showCount || PAGE_SIZE
}); });
let count = store.count("faults", filter); let count = store.count("faults", filter);