mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,62 @@
|
||||
|
||||
'use strict';
|
||||
'require view';
|
||||
'require ui';
|
||||
'require fs';
|
||||
|
||||
return view.extend({
|
||||
render: function() {
|
||||
return E([
|
||||
E('h2', _('PowerOff')),
|
||||
E('p', _('Turn off the power to the device you are using')),
|
||||
E('hr'),
|
||||
E('button', {
|
||||
class: 'btn cbi-button cbi-button-negative',
|
||||
click: ui.createHandlerFn(this, 'handlePowerOff')
|
||||
}, _('Perform Power Off')),
|
||||
|
||||
E('div', { 'style': 'text-align: center; padding: 10px; font-style: italic;' }, [
|
||||
E('span', {}, [
|
||||
_('© github '),
|
||||
E('a', {
|
||||
'href': 'https://github.com/sirpdboy/luci-app-poweroffdevice',
|
||||
'target': '_blank',
|
||||
'style': 'text-decoration: none;'
|
||||
}, 'by sirpdboy')
|
||||
])
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
handlePowerOff: function() {
|
||||
return ui.showModal(_('PowerOff Device'), [
|
||||
E('h4', { }, _('Turn off the power to the device you are using')),
|
||||
|
||||
E('div', { class: 'right' }, [
|
||||
|
||||
E('button', {
|
||||
'class': 'btn btn-danger ',
|
||||
'style': 'background: red!important; border-color: red!important',
|
||||
'click': ui.createHandlerFn(this, function() {
|
||||
ui.hideModal();
|
||||
ui.showModal(_('PowerOffing...'), [
|
||||
E('p', {'class': 'spinning' }, _('The device may have powered off. If not, check manually.'))
|
||||
]);
|
||||
return fs.exec('/sbin/poweroff').catch(function(e) {
|
||||
ui.addNotification(null, E('p', e.message));
|
||||
});
|
||||
})
|
||||
}, _('OK')),
|
||||
' ',
|
||||
E('button', {
|
||||
'class': 'btn cbi-button cbi-button-apply',
|
||||
'click': ui.hideModal
|
||||
}, _('Cancel'))
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
Reference in new issue
Block a user