From acbc031a6d1a41fc0a40a4f175bc80a49affc251 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 8 Jul 2019 17:07:11 +0200 Subject: luci-base,luci-mod-system: split ubus localtime into get and set call Signed-off-by: Jo-Philipp Wich --- .../luci-static/resources/view/system/system.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'modules/luci-mod-system/htdocs/luci-static') diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js index 4b833a3f83..6db973a8df 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js @@ -3,7 +3,8 @@ 'require rpc'; 'require form'; -var callInitList, callInitAction, callLocaltime, callTimezone, CBILocalTime; +var callInitList, callInitAction, callTimezone, + callGetLocaltime, callSetLocaltime, CBILocalTime; callInitList = rpc.declare({ object: 'luci', @@ -24,9 +25,16 @@ callInitAction = rpc.declare({ expect: { result: false } }); -callLocaltime = rpc.declare({ +callGetLocaltime = rpc.declare({ object: 'luci', - method: 'localtime', + method: 'getLocaltime', + expect: { localtime: 0 } +}); + +callSetLocaltime = rpc.declare({ + object: 'luci', + method: 'setLocaltime', + params: [ 'localtime' ], expect: { localtime: 0 } }); @@ -48,7 +56,7 @@ CBILocalTime = form.DummyValue.extend({ this.blur(); this.classList.add('spinning'); this.disabled = true; - callLocaltime(Math.floor(Date.now() / 1000)).then(L.bind(function() { + callSetLocaltime(Math.floor(Date.now() / 1000)).then(L.bind(function() { this.classList.remove('spinning'); this.disabled = false; }, this)); @@ -77,7 +85,7 @@ return L.view.extend({ callInitList('sysntpd'), callInitList('zram'), callTimezone(), - callLocaltime(), + callGetLocaltime(), uci.load('luci'), uci.load('system') ]); @@ -276,7 +284,7 @@ return L.view.extend({ return m.render().then(function(mapEl) { L.Poll.add(function() { - return callLocaltime().then(function(t) { + return callGetLocaltime().then(function(t) { mapEl.querySelector('#localtime').innerHTML = new Date(t * 1000).toLocaleString(); }); }); -- cgit v1.2.3