diff options
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js | 20 |
1 files changed, 14 insertions, 6 deletions
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(); }); }); |