diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-10-31 15:54:21 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-01 12:03:33 +0100 |
commit | c67d2ddc2ce34bb2d985b3864706d2cf49e65b6c (patch) | |
tree | 07d496f42dc26edbeca75e7f8fa392e5ef35aa08 /modules/luci-mod-system/htdocs/luci-static/resources/view/system | |
parent | 6e633b3ed29edcbe6ce8d0bafaf064fe2e6c2c03 (diff) |
luci-base, luci-mod-system: replace luci/setReboot with fs.exec
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources/view/system')
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js index 0a14465559..3ed87f413f 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js @@ -2,13 +2,6 @@ 'require fs'; 'require ui'; 'require uci'; -'require rpc'; - -var callReboot = rpc.declare({ - object: 'luci', - method: 'setReboot', - expect: { result: false } -}); return L.view.extend({ load: function() { @@ -37,7 +30,12 @@ return L.view.extend({ }, handleReboot: function(ev) { - return callReboot().then(function() { + return fs.exec('/sbin/reboot').then(function(res) { + if (res.code != 0) { + L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res.code))); + L.raise('Error', 'Reboot failed'); + } + L.ui.showModal(_('Rebooting…'), [ E('p', { 'class': 'spinning' }, _('Waiting for device...')) ]); @@ -50,7 +48,8 @@ return L.view.extend({ }, 150000); L.ui.awaitReconnect(); - }); + }) + .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) }); }, handleSaveApply: null, |