summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-system/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-07-08 17:07:11 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-08 17:07:11 +0200
commitacbc031a6d1a41fc0a40a4f175bc80a49affc251 (patch)
tree3f8602291f4bdd1eaa27c802ee49ff879850eebe /modules/luci-mod-system/htdocs/luci-static/resources/view
parentabee9138dec5814b70c9af418c27386a067ba284 (diff)
luci-base,luci-mod-system: split ubus localtime into get and set call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources/view')
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js20
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();
});
});