diff --git a/public/images/left-30.png b/public/images/left-30.png new file mode 100644 index 00000000..be7d374f Binary files /dev/null and b/public/images/left-30.png differ diff --git a/public/images/right-30.png b/public/images/right-30.png new file mode 100644 index 00000000..02a076d7 Binary files /dev/null and b/public/images/right-30.png differ diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index c711f7fd..caa85c92 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -648,6 +648,22 @@ height: 400px; position: relative; } + + .viewSelector10 { + margin-left: 2px; + margin-top: 2px; + background: url(../images/views.png) -476px 0px; + height: 28px; + width: 28px; + } + + .viewSelector11 { + margin-left: 2px; + margin-top: 2px; + background: url(../images/views.png) -504px 0px; + height: 28px; + width: 28px; + } @@ -663,6 +679,9 @@ {{{title2}}} + + + @@ -1228,7 +1247,6 @@ var authCookie = '{{{authCookie}}}'; var authRelayCookie = '{{{authRelayCookie}}}'; var logoutControls = JSON.parse(decodeURIComponent('{{{logoutControls}}}')); - console.log(logoutControls); var authCookieRenewTimer = null; var webRelayPort = parseInt('{{{webRelayPort}}}'); var webRelayDns = '{{{webRelayDns}}}'; @@ -1260,6 +1278,7 @@ var xterm = null; var xtermfit = null; var xtermResizeTimer = null; + var devicePagingState = null; // Console Message Display Timers var p11DeskConsoleMsgTimer = null; @@ -1348,6 +1367,8 @@ if (prevState == 2) { setTimeout(serverPoll, 5000); } else { QH('p0span', "Unable to connect web socket"); } // Clean up here if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; } + devicePagingState = null; + updateDevicePageState(); } else if (state == 2) { // Fetch list of meshes, nodes, files meshserver.send({ action: 'usergroups' }); @@ -1512,6 +1533,10 @@ // Change the reference to the current node if (currentNode != null) { currentNode = getNodeFromId(currentNode._id); if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); } else { go(2); } } + // Update device paging + devicePagingState = (message.totalcount == null) ? null : { total: message.totalcount, skip: message.skip, limit: message.limit }; + updateDevicePageState(); + //onSortSelectChange(); //onSearchInputChanged(); mainUpdate(4); @@ -2715,6 +2740,31 @@ onSearchInputChanged(); } + function updateDevicePageState() { + if ((devicePagingState == null) || (devicePagingState.total <= devicePagingState.limit)) { + QV('devViewPageState', false); + QV('devViewPageButton2', false); + QV('devViewPageButton3', false); + } else { + var currentPage = Math.floor((devicePagingState.skip + devicePagingState.limit) / devicePagingState.limit); + var maxPage = Math.ceil(devicePagingState.total / devicePagingState.limit); + QV('devViewPageState', true); + QV('devViewPageButton2', true); + QV('devViewPageButton3', true); + QH('devViewPageState', currentPage + '/' + maxPage); + } + } + + function onDeviceViewPageChange(i) { + if (devicePagingState == null) return; + var currentPage = (Math.floor((devicePagingState.skip + devicePagingState.limit) / devicePagingState.limit)); + var maxPage = Math.ceil(devicePagingState.total / devicePagingState.limit); + switch (i) { + case 2: { if (currentPage > 1) meshserver.send({ action: 'nodes', skip: (currentPage - 2) * devicePagingState.limit }); break; } // Goto previous page + case 3: { if (currentPage < maxPage) meshserver.send({ action: 'nodes', skip: currentPage * devicePagingState.limit }); break; } // Goto next page + } + } + function onDeviceSearchChanged(e) { setTimeout(function () { onSearchInputChanged(); }, 10); }