mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 18:24:34 +08:00
⛄ Sync 2026-04-23 20:32:35
This commit is contained in:
1 parent
17738c6f79
commit
fe51d2b304
206 files changed
+725671
No files matched your search
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require rpc';
|
||||
'require ui';
|
||||
'require uci';
|
||||
|
||||
var callReboot = rpc.declare({
|
||||
object: 'system',
|
||||
method: 'reboot',
|
||||
expect: { result: 0 }
|
||||
});
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return uci.changes();
|
||||
},
|
||||
|
||||
render: function(changes) {
|
||||
var body = E([
|
||||
E('h2', _('Reboot')),
|
||||
E('p', {}, _('Reboots the operating system of your device'))
|
||||
]);
|
||||
|
||||
for (var config in (changes || {})) {
|
||||
body.appendChild(E('p', { 'class': 'alert-message warning' },
|
||||
_('Warning: There are unsaved changes that will get lost on reboot!')));
|
||||
break;
|
||||
}
|
||||
|
||||
body.appendChild(E('hr'));
|
||||
body.appendChild(E('button', {
|
||||
'class': 'cbi-button cbi-button-action important',
|
||||
'click': ui.createHandlerFn(this, 'handleReboot')
|
||||
}, _('Perform reboot')));
|
||||
|
||||
return body;
|
||||
},
|
||||
|
||||
handleReboot: function(ev) {
|
||||
return callReboot().then(function(res) {
|
||||
if (res != 0) {
|
||||
L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res)));
|
||||
L.raise('Error', 'Reboot failed');
|
||||
}
|
||||
|
||||
L.ui.showModal(_('Rebooting…'), [
|
||||
E('p', { 'class': 'spinning' }, _('Waiting for device...'))
|
||||
]);
|
||||
|
||||
window.setTimeout(function() {
|
||||
L.ui.showModal(_('Rebooting…'), [
|
||||
E('p', { 'class': 'spinning alert-message warning' },
|
||||
_('Device unreachable! Still waiting for device...'))
|
||||
]);
|
||||
}, 150000);
|
||||
|
||||
L.ui.awaitReconnect();
|
||||
})
|
||||
.catch(function(e) { L.ui.addNotification(null, E('p', e.message)) });
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
Reference in new issue
Block a user