diff --git a/client/devices-page.js b/client/devices-page.js index 685cf8a..0ede1c8 100644 --- a/client/devices-page.js +++ b/client/devices-page.js @@ -11,6 +11,8 @@ import * as notifications from "./notifications"; import * as expression from "../common/expression"; import memoize from "../common/memoize"; +const PAGE_SIZE = config.ui.pageSize || 10; + const memoizedParse = memoize(expression.parse); const getDownloadUrl = memoize((filter, indexParameters) => { @@ -287,7 +289,7 @@ const component = { document.title = "Devices - GenieACS"; function showMore() { - vnode.state.showCount = (vnode.state.showCount || 10) + 10; + vnode.state.showCount = (vnode.state.showCount || PAGE_SIZE) + PAGE_SIZE; m.redraw(); } @@ -299,7 +301,7 @@ const component = { ? memoizedParse(vnode.attrs.filter) : true; let devs = store.fetch("devices", filter, { - limit: vnode.state.showCount || 10 + limit: vnode.state.showCount || PAGE_SIZE }); let count = store.count("devices", filter); diff --git a/client/faults-page.js b/client/faults-page.js index d2bd054..bccbf54 100644 --- a/client/faults-page.js +++ b/client/faults-page.js @@ -1,13 +1,15 @@ "use strict"; import m from "mithril"; - +import config from "./config"; import filterComponent from "./filter-component"; import * as store from "./store"; import * as notifications from "./notifications"; import * as expression from "../common/expression"; import memoize from "../common/memoize"; +const PAGE_SIZE = config.ui.pageSize || 10; + const memoizedParse = memoize(expression.parse); const getDownloadUrl = memoize(filter => { @@ -171,7 +173,7 @@ const component = { document.title = "Faults - GenieACS"; function showMore() { - vnode.state.showCount = (vnode.state.showCount || 10) + 10; + vnode.state.showCount = (vnode.state.showCount || PAGE_SIZE) + PAGE_SIZE; m.redraw(); } @@ -184,7 +186,7 @@ const component = { : true; let faults = store.fetch("faults", filter, { - limit: vnode.state.showCount || 10 + limit: vnode.state.showCount || PAGE_SIZE }); let count = store.count("faults", filter);