diff options
Diffstat (limited to 'modules')
11 files changed, 95 insertions, 84 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 12d28808fb..9ca7773fe1 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -1,5 +1,6 @@ 'use strict'; 'require fs'; +'require ui'; 'require uci'; 'require form'; 'require network'; @@ -7,7 +8,7 @@ 'require tools.widgets as widgets'; function count_changes(section_id) { - var changes = L.ui.changes.changes, n = 0; + var changes = ui.changes.changes, n = 0; if (!L.isObject(changes)) return n; @@ -100,7 +101,7 @@ function render_status(node, ifc, with_device) { _('Error'), errors ? errors[4] : null, null, changecount ? E('a', { href: '#', - click: L.bind(L.ui.changes.displayChanges, L.ui.changes) + click: L.bind(ui.changes.displayChanges, ui.changes) }, _('Interface has %d pending changes').format(changecount)) : null ]); } @@ -166,7 +167,7 @@ function iface_updown(up, id, ev, force) { Array.isArray(info.inbound_interfaces) && info.inbound_interfaces.filter(function(i) { return i == id })[0]) { - L.ui.showModal(_('Confirm disconnect'), [ + ui.showModal(_('Confirm disconnect'), [ E('p', _('You appear to be currently connected to the device via the "%h" interface. Do you really want to shut down the interface?').format(id)), E('div', { 'class': 'right' }, [ E('button', { @@ -176,7 +177,7 @@ function iface_updown(up, id, ev, force) { btns[1].disabled = false; btns[0].disabled = false; - L.ui.hideModal(); + ui.hideModal(); } }, _('Cancel')), ' ', @@ -186,7 +187,7 @@ function iface_updown(up, id, ev, force) { dsc.setAttribute('disconnect', ''); L.dom.content(dsc, E('em', _('Interface is shutting down...'))); - L.ui.hideModal(); + ui.hideModal(); } }, _('Disconnect')) ]) @@ -557,7 +558,7 @@ return L.view.extend({ E('button', { 'class': 'cbi-button cbi-button-add', 'title': _('Setup DHCP Server'), - 'click': L.ui.createHandlerFn(this, function(section_id, ev) { + 'click': ui.createHandlerFn(this, function(section_id, ev) { this.map.save(function() { uci.add('dhcp', 'dhcp', section_id); uci.set('dhcp', section_id, 'interface', section_id); @@ -748,16 +749,16 @@ return L.view.extend({ } m2.render().then(L.bind(function(nodes) { - L.ui.showModal(_('Add new interface...'), [ + ui.showModal(_('Add new interface...'), [ nodes, E('div', { 'class': 'right' }, [ E('button', { 'class': 'btn', - 'click': L.ui.hideModal + 'click': ui.hideModal }, _('Cancel')), ' ', E('button', { 'class': 'cbi-button cbi-button-positive important', - 'click': L.ui.createHandlerFn(this, function(ev) { + 'click': ui.createHandlerFn(this, function(ev) { var nameval = name.isValid('_new_') ? name.formvalue('_new_') : null, protoval = proto.isValid('_new_') ? proto.formvalue('_new_') : null; @@ -977,13 +978,13 @@ return L.view.extend({ if (dsc.getAttribute('reconnect') == '') { dsc.setAttribute('reconnect', '1'); tasks.push(fs.exec('/sbin/ifup', [section_ids[i]]).catch(function(e) { - L.ui.addNotification(null, E('p', e.message)); + ui.addNotification(null, E('p', e.message)); })); } else if (dsc.getAttribute('disconnect') == '') { dsc.setAttribute('disconnect', '1'); tasks.push(fs.exec('/sbin/ifdown', [section_ids[i]]).catch(function(e) { - L.ui.addNotification(null, E('p', e.message)); + ui.addNotification(null, E('p', e.message)); })); } else if (dsc.getAttribute('reconnect') == '1') { diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/switch.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/switch.js index b281bb1808..80c8437fc4 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/switch.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/switch.js @@ -1,4 +1,5 @@ 'use strict'; +'require ui'; 'require rpc'; 'require uci'; 'require form'; @@ -55,7 +56,7 @@ function update_interfaces(old_ifname, new_ifname) { if (changed) { uci.set('network', interfaces[i]['.name'], 'ifname', new_ifnames.join(' ')); - L.ui.addNotification(null, E('p', _('Interface %q device auto-migrated from %q to %q.') + ui.addNotification(null, E('p', _('Interface %q device auto-migrated from %q to %q.') .replace(/%q/g, '"%s"').format(interfaces[i]['.name'], old_ifname, new_ifname))); } } @@ -143,7 +144,7 @@ return L.view.extend({ topology = topologies[switch_name]; if (!topology) { - L.ui.addNotification(null, _('Switch %q has an unknown topology - the VLAN settings might not be accurate.').replace(/%q/, switch_name)); + ui.addNotification(null, _('Switch %q has an unknown topology - the VLAN settings might not be accurate.').replace(/%q/, switch_name)); topology = { features: {}, diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index 1909f3c243..1a98c4302c 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -1,5 +1,6 @@ 'use strict'; 'require fs'; +'require ui'; 'require rpc'; 'require uci'; 'require form'; @@ -8,7 +9,7 @@ 'require tools.widgets as widgets'; function count_changes(section_id) { - var changes = L.ui.changes.changes, n = 0; + var changes = ui.changes.changes, n = 0; if (!L.isObject(changes)) return n; @@ -97,7 +98,7 @@ function render_network_status(radioNet) { if (changecount) status_text = E('a', { href: '#', - click: L.bind(L.ui.changes.displayChanges, L.ui.changes) + click: L.bind(ui.changes.displayChanges, ui.changes) }, _('Interface has %d pending changes').format(changecount)); else if (!is_assoc) status_text = E('em', disabled ? _('Wireless is disabled') : _('Wireless is not associated')); @@ -196,7 +197,7 @@ function network_updown(id, map, ev) { } return map.save().then(function() { - L.ui.changes.apply() + ui.changes.apply() }); } @@ -605,18 +606,18 @@ return L.view.extend({ } return Promise.all(tasks) - .then(L.bind(L.ui.changes.init, L.ui.changes)) - .then(L.bind(L.ui.changes.apply, L.ui.changes)); + .then(L.bind(ui.changes.init, ui.changes)) + .then(L.bind(ui.changes.apply, ui.changes)); }, renderMigration: function() { - L.ui.showModal(_('Wireless configuration migration'), [ + ui.showModal(_('Wireless configuration migration'), [ E('p', _('The existing wireless configuration needs to be changed for LuCI to function properly.')), E('p', _('Upon pressing "Continue", anonymous "wifi-iface" sections will be assigned with a name in the form <em>wifinet#</em> and the network will be restarted to apply the updated configuration.')), E('div', { 'class': 'right' }, E('button', { 'class': 'btn cbi-button-action important', - 'click': L.ui.createHandlerFn(this, 'handleMigration') + 'click': ui.createHandlerFn(this, 'handleMigration') }, _('Continue'))) ]); }, @@ -691,17 +692,17 @@ return L.view.extend({ E('button', { 'class': 'cbi-button cbi-button-neutral', 'title': _('Restart radio interface'), - 'click': L.ui.createHandlerFn(this, radio_restart, section_id) + 'click': ui.createHandlerFn(this, radio_restart, section_id) }, _('Restart')), E('button', { 'class': 'cbi-button cbi-button-action important', 'title': _('Find and join network'), - 'click': L.ui.createHandlerFn(this, 'handleScan', inst) + 'click': ui.createHandlerFn(this, 'handleScan', inst) }, _('Scan')), E('button', { 'class': 'cbi-button cbi-button-add', 'title': _('Provide new network'), - 'click': L.ui.createHandlerFn(this, 'handleAdd', inst) + 'click': ui.createHandlerFn(this, 'handleAdd', inst) }, _('Add')) ]; } @@ -713,17 +714,17 @@ return L.view.extend({ E('button', { 'class': 'cbi-button cbi-button-neutral enable-disable', 'title': isDisabled ? _('Enable this network') : _('Disable this network'), - 'click': L.ui.createHandlerFn(this, network_updown, section_id, this.map) + 'click': ui.createHandlerFn(this, network_updown, section_id, this.map) }, isDisabled ? _('Enable') : _('Disable')), E('button', { 'class': 'cbi-button cbi-button-action important', 'title': _('Edit this network'), - 'click': L.ui.createHandlerFn(this, 'renderMoreOptionsModal', section_id) + 'click': ui.createHandlerFn(this, 'renderMoreOptionsModal', section_id) }, _('Edit')), E('button', { 'class': 'cbi-button cbi-button-negative remove', 'title': _('Delete this network'), - 'click': L.ui.createHandlerFn(this, 'handleRemove', section_id) + 'click': ui.createHandlerFn(this, 'handleRemove', section_id) }, _('Remove')) ]; } @@ -755,7 +756,7 @@ return L.view.extend({ o = ss.taboption('general', form.Button, '_toggle', isDisabled ? _('Wireless network is disabled') : _('Wireless network is enabled')); o.inputstyle = isDisabled ? 'apply' : 'reset'; o.inputtitle = isDisabled ? _('Enable') : _('Disable'); - o.onclick = L.ui.createHandlerFn(s, network_updown, s.section, s.map); + o.onclick = ui.createHandlerFn(s, network_updown, s.section, s.map); o = ss.taboption('general', CBIWifiFrequencyValue, '_freq', '<br />' + _('Operating frequency')); o.ucisection = s.section; @@ -1630,7 +1631,7 @@ return L.view.extend({ cbi_update_table(table, [], E('em', { class: 'spinning' }, _('Starting wireless scan...'))); - var md = L.ui.showModal(_('Join Network: Wireless Scan'), [ + var md = ui.showModal(_('Join Network: Wireless Scan'), [ table, E('div', { 'class': 'right' }, E('button', { @@ -1710,7 +1711,7 @@ return L.view.extend({ md.style.maxHeight = ''; } - L.ui.hideModal(); + ui.hideModal(); L.Poll.remove(this.pollFn); this.pollFn = null; @@ -1848,16 +1849,16 @@ return L.view.extend({ zone.default = 'wan'; return m2.render().then(L.bind(function(nodes) { - L.ui.showModal(_('Joining Network: %q').replace(/%q/, '"%h"'.format(bss.ssid)), [ + ui.showModal(_('Joining Network: %q').replace(/%q/, '"%h"'.format(bss.ssid)), [ nodes, E('div', { 'class': 'right' }, [ E('button', { 'class': 'btn', - 'click': L.ui.hideModal + 'click': ui.hideModal }, _('Cancel')), ' ', E('button', { 'class': 'cbi-button cbi-button-positive important', - 'click': L.ui.createHandlerFn(this, 'handleJoinConfirm', radioDev, bss, m2) + 'click': ui.createHandlerFn(this, 'handleJoinConfirm', radioDev, bss, m2) }, _('Submit')) ]) ], 'cbi-modal').querySelector('[id="%s"] input[class][type]'.format((passphrase || name).cbid('_new_'))).focus(); @@ -1919,7 +1920,7 @@ return L.view.extend({ if (dsc.getAttribute('restart') == '') { dsc.setAttribute('restart', '1'); tasks.push(fs.exec('/sbin/wifi', ['up', section_ids[i]]).catch(function(e) { - L.ui.addNotification(null, E('p', e.message)); + ui.addNotification(null, E('p', e.message)); })); } else if (dsc.getAttribute('restart') == '1') { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js index 0565490b9d..18e2160b51 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js @@ -1,4 +1,5 @@ 'use strict'; +'require ui'; 'require rpc'; 'require network'; @@ -298,7 +299,7 @@ return L.view.extend({ }); } - L.ui.tabs.initTabGroup(v.firstElementChild.childNodes); + ui.tabs.initTabGroup(v.firstElementChild.childNodes); this.pollData(); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js index 45dd54a883..ce0c72bc3b 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js @@ -1,4 +1,5 @@ 'use strict'; +'require ui'; 'require rpc'; 'require network'; @@ -326,7 +327,7 @@ return L.view.extend({ }); } - L.ui.tabs.initTabGroup(v.firstElementChild.childNodes); + ui.tabs.initTabGroup(v.firstElementChild.childNodes); this.pollData(); diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js index bb0dd41f99..c2ab770c51 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js @@ -1,5 +1,6 @@ 'use strict'; 'require fs'; +'require ui'; return L.view.extend({ load: function() { @@ -11,9 +12,9 @@ return L.view.extend({ return fs.write('/etc/crontabs/root', value).then(function(rc) { document.querySelector('textarea').value = value; - L.ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); + ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); }).catch(function(e) { - L.ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message))); + ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message))); }); }, diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js index 440ed9acc8..05e1434f15 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -2,6 +2,7 @@ 'require form'; 'require rpc'; 'require fs'; +'require ui'; var callSystemValidateFirmwareImage = rpc.declare({ object: 'system', @@ -89,46 +90,46 @@ return L.view.extend({ if (!confirm(_('Do you really want to erase all settings?'))) return; - L.ui.showModal(_('Erasing...'), [ + ui.showModal(_('Erasing...'), [ E('p', { 'class': 'spinning' }, _('The system is erasing the configuration partition now and will reboot itself when finished.')) ]); /* Currently the sysupgrade rpc call will not return, hence no promise handling */ fs.exec('/sbin/firstboot', [ '-r', '-y' ]); - L.ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); + ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); }, handleRestore: function(ev) { - return L.ui.uploadFile('/tmp/backup.tar.gz', ev.target) + return ui.uploadFile('/tmp/backup.tar.gz', ev.target) .then(L.bind(function(btn, res) { btn.firstChild.data = _('Checking archive…'); return fs.exec('/bin/tar', [ '-tzf', '/tmp/backup.tar.gz' ]); }, this, ev.target)) .then(L.bind(function(btn, res) { if (res.code != 0) { - L.ui.addNotification(null, E('p', _('The uploaded backup archive is not readable'))); + ui.addNotification(null, E('p', _('The uploaded backup archive is not readable'))); return fs.remove('/tmp/backup.tar.gz'); } - L.ui.showModal(_('Apply backup?'), [ + ui.showModal(_('Apply backup?'), [ E('p', _('The uploaded backup archive appears to be valid and contains the files listed below. Press "Continue" to restore the backup and reboot, or "Cancel" to abort the operation.')), E('pre', {}, [ res.stdout ]), E('div', { 'class': 'right' }, [ E('button', { 'class': 'btn', - 'click': L.ui.createHandlerFn(this, function(ev) { - return fs.remove('/tmp/backup.tar.gz').finally(L.ui.hideModal); + 'click': ui.createHandlerFn(this, function(ev) { + return fs.remove('/tmp/backup.tar.gz').finally(ui.hideModal); }) }, [ _('Cancel') ]), ' ', E('button', { 'class': 'btn cbi-button-action important', - 'click': L.ui.createHandlerFn(this, 'handleRestoreConfirm', btn) + 'click': ui.createHandlerFn(this, 'handleRestoreConfirm', btn) }, [ _('Continue') ]) ]) ]); }, this, ev.target)) - .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) }) + .catch(function(e) { ui.addNotification(null, E('p', e.message)) }) .finally(L.bind(function(btn, input) { btn.firstChild.data = _('Upload archive...'); }, this, ev.target)); @@ -138,7 +139,7 @@ return L.view.extend({ return fs.exec('/sbin/sysupgrade', [ '--restore-backup', '/tmp/backup.tar.gz' ]) .then(L.bind(function(btn, res) { if (res.code != 0) { - L.ui.addNotification(null, [ + ui.addNotification(null, [ E('p', _('The restore command failed with code %d').format(res.code)), res.stderr ? E('pre', {}, [ res.stderr ]) : '' ]); @@ -150,17 +151,17 @@ return L.view.extend({ }, this, ev.target)) .then(L.bind(function(res) { if (res.code != 0) { - L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res.code))); + ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res.code))); L.raise('Error', 'Reboot failed'); } - L.ui.showModal(_('Rebooting…'), [ + ui.showModal(_('Rebooting…'), [ E('p', { 'class': 'spinning' }, _('The system is rebooting now. If the restored configuration changed the current LAN IP address, you might need to reconnect manually.')) ]); - L.ui.awaitReconnect(window.location.host, '192.168.1.1', 'openwrt.lan'); + ui.awaitReconnect(window.location.host, '192.168.1.1', 'openwrt.lan'); }, this)) - .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) }) + .catch(function(e) { ui.addNotification(null, E('p', e.message)) }) .finally(function() { btn.firstChild.data = _('Upload archive...') }); }, @@ -183,11 +184,11 @@ return L.view.extend({ }, handleSysupgrade: function(storage_size, ev) { - return L.ui.uploadFile('/tmp/firmware.bin', ev.target.firstChild) + return ui.uploadFile('/tmp/firmware.bin', ev.target.firstChild) .then(L.bind(function(btn, reply) { btn.firstChild.data = _('Checking image…'); - L.ui.showModal(_('Checking image…'), [ + ui.showModal(_('Checking image…'), [ E('span', { 'class': 'spinning' }, _('Verifying the uploaded image file.')) ]); @@ -254,15 +255,15 @@ return L.view.extend({ var cntbtn = E('button', { 'class': 'btn cbi-button-action important', - 'click': L.ui.createHandlerFn(this, 'handleSysupgradeConfirm', btn, keep, force), + 'click': ui.createHandlerFn(this, 'handleSysupgradeConfirm', btn, keep, force), 'disabled': (!is_valid || is_too_big) ? true : null }, [ _('Continue') ]); body.push(E('div', { 'class': 'right' }, [ E('button', { 'class': 'btn', - 'click': L.ui.createHandlerFn(this, function(ev) { - return fs.remove('/tmp/firmware.bin').finally(L.ui.hideModal); + 'click': ui.createHandlerFn(this, function(ev) { + return fs.remove('/tmp/firmware.bin').finally(ui.hideModal); }) }, [ _('Cancel') ]), ' ', cntbtn ])); @@ -271,9 +272,9 @@ return L.view.extend({ cntbtn.disabled = !ev.target.checked; }); - L.ui.showModal(_('Flash image?'), body); + ui.showModal(_('Flash image?'), body); }, this, ev.target)) - .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) }) + .catch(function(e) { ui.addNotification(null, E('p', e.message)) }) .finally(L.bind(function(btn) { btn.firstChild.data = _('Flash image...'); }, this, ev.target)); @@ -282,7 +283,7 @@ return L.view.extend({ handleSysupgradeConfirm: function(btn, keep, force, ev) { btn.firstChild.data = _('Flashing…'); - L.ui.showModal(_('Flashing…'), [ + ui.showModal(_('Flashing…'), [ E('p', { 'class': 'spinning' }, _('The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.')) ]); @@ -300,28 +301,28 @@ return L.view.extend({ fs.exec('/sbin/sysupgrade', opts); if (keep.checked) - L.ui.awaitReconnect(window.location.host); + ui.awaitReconnect(window.location.host); else - L.ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); + ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); }, handleBackupList: function(ev) { return fs.exec('/sbin/sysupgrade', [ '--list-backup' ]).then(function(res) { if (res.code != 0) { - L.ui.addNotification(null, [ + ui.addNotification(null, [ E('p', _('The sysupgrade command failed with code %d').format(res.code)), res.stderr ? E('pre', {}, [ res.stderr ]) : '' ]); L.raise('Error', 'Sysupgrade failed'); } - L.ui.showModal(_('Backup file list'), [ + ui.showModal(_('Backup file list'), [ E('p', _('Below is the determined list of files to backup. It consists of changed configuration files marked by opkg, essential base files and the user defined backup patterns.')), E('ul', {}, (res.stdout || '').trim().split(/\n/).map(function(ln) { return E('li', {}, ln) })), E('div', { 'class': 'right' }, [ E('button', { 'class': 'btn', - 'click': L.ui.hideModal + 'click': ui.hideModal }, [ _('Dismiss') ]) ]) ], 'cbi-modal'); @@ -332,9 +333,9 @@ return L.view.extend({ return m.save(function() { return fs.write('/etc/sysupgrade.conf', mapdata.config.editlist.trim().replace(/\r\n/g, '\n') + '\n'); }).then(function() { - L.ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); + ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); }).catch(function(e) { - L.ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e))); + ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e))); }); }, @@ -419,7 +420,7 @@ return L.view.extend({ node.appendChild(E('div', { 'class': 'cbi-page-actions' }, [ E('button', { 'class': 'cbi-button cbi-button-save', - 'click': L.ui.createHandlerFn(view, 'handleBackupSave', this.map) + 'click': ui.createHandlerFn(view, 'handleBackupSave', this.map) }, [ _('Save') ]) ])); diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js index b4f5cf71a5..ec5d44cad0 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js @@ -1,5 +1,6 @@ 'use strict'; 'require fs'; +'require ui'; 'require uci'; 'require rpc'; 'require form'; @@ -79,7 +80,7 @@ return L.view.extend({ return fs.exec('/sbin/block', ['mount']) .then(function(res) { if (res.code != 0) - L.ui.addNotification(null, E('p', _('The <em>block mount</em> command failed with code %d').format(res.code))); + ui.addNotification(null, E('p', _('The <em>block mount</em> command failed with code %d').format(res.code))); }) .then(L.bind(uci.unload, uci, 'fstab')) .then(L.bind(m.render, m)); @@ -89,7 +90,7 @@ return L.view.extend({ return fs.exec('/bin/umount', [path]) .then(L.bind(uci.unload, uci, 'fstab')) .then(L.bind(m.render, m)) - .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) }); + .catch(function(e) { ui.addNotification(null, E('p', e.message)) }); }, load: function() { @@ -210,7 +211,7 @@ return L.view.extend({ '%.2f%% (%1024.2mB)'.format(100 / this.mounts[i].size * used, used), umount ? E('button', { 'class': 'btn cbi-button-remove', - 'click': L.ui.createHandlerFn(view, 'handleUmount', m, this.mounts[i].mount) + 'click': ui.createHandlerFn(view, 'handleUmount', m, this.mounts[i].mount) }, [ _('Unmount') ]) : '-' ]); } diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js index 6c5ffa1b26..c3d317062f 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js @@ -1,4 +1,5 @@ 'use strict'; +'require ui'; 'require form'; 'require rpc'; @@ -71,15 +72,15 @@ return L.view.extend({ return; if (formData.password.pw1 != formData.password.pw2) { - L.ui.addNotification(null, E('p', _('Given password confirmation did not match, password not changed!')), 'danger'); + ui.addNotification(null, E('p', _('Given password confirmation did not match, password not changed!')), 'danger'); return; } return callSetPassword('root', formData.password.pw1).then(function(success) { if (success) - L.ui.addNotification(null, E('p', _('The system password has been successfully changed.')), 'info'); + ui.addNotification(null, E('p', _('The system password has been successfully changed.')), 'info'); else - L.ui.addNotification(null, E('p', _('Failed to change the system password.')), 'danger'); + ui.addNotification(null, E('p', _('Failed to change the system password.')), 'danger'); formData.password.pw1 = null; formData.password.pw2 = null; diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js index 07eede2f07..560282de77 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js @@ -1,6 +1,7 @@ 'use strict'; 'require rpc'; 'require fs'; +'require ui'; return L.view.extend({ callInitList: rpc.declare({ @@ -30,7 +31,7 @@ return L.view.extend({ return true; }).catch(function(e) { - L.ui.addNotification(null, E('p', _('Failed to execute "/etc/init.d/%s %s" action: %s').format(name, action, e))); + ui.addNotification(null, E('p', _('Failed to execute "/etc/init.d/%s %s" action: %s').format(name, action, e))); }); }, @@ -48,16 +49,16 @@ return L.view.extend({ return fs.write('/etc/rc.local', value).then(function() { document.querySelector('textarea').value = value; - L.ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); + ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); }).catch(function(e) { - L.ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message))); + ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message))); }); }, renderEnableDisable: function(init) { return E('button', { class: 'btn cbi-button-%s'.format(init.enabled ? 'positive' : 'negative'), - click: L.ui.createHandlerFn(this, 'handleEnableDisable', init.name, init.enabled) + click: ui.createHandlerFn(this, 'handleEnableDisable', init.name, init.enabled) }, init.enabled ? _('Enabled') : _('Disabled')); }, @@ -93,9 +94,9 @@ return L.view.extend({ '%02d'.format(list[i].index), list[i].name, this.renderEnableDisable(list[i]), - E('button', { 'class': 'btn cbi-button-action', 'click': L.ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')), - E('button', { 'class': 'btn cbi-button-action', 'click': L.ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')), - E('button', { 'class': 'btn cbi-button-action', 'click': L.ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop')) + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop')) ]); } @@ -114,14 +115,14 @@ return L.view.extend({ E('div', { 'class': 'cbi-page-actions' }, [ E('button', { 'class': 'btn cbi-button-save', - 'click': L.ui.createHandlerFn(this, 'handleRcLocalSave') + 'click': ui.createHandlerFn(this, 'handleRcLocalSave') }, _('Save')) ]) ]) ]) ]); - L.ui.tabs.initTabGroup(view.lastElementChild.childNodes); + ui.tabs.initTabGroup(view.lastElementChild.childNodes); return view; }, 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 492784cc95..ccc9342cc6 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 @@ -1,4 +1,5 @@ 'use strict'; +'require ui'; 'require uci'; 'require rpc'; 'require form'; @@ -58,14 +59,14 @@ CBILocalTime = form.DummyValue.extend({ ' ', E('button', { 'class': 'cbi-button cbi-button-apply', - 'click': L.ui.createHandlerFn(this, function() { + 'click': ui.createHandlerFn(this, function() { return callSetLocaltime(Math.floor(Date.now() / 1000)); }) }, _('Sync with browser')), ' ', this.ntpd_support ? E('button', { 'class': 'cbi-button cbi-button-apply', - 'click': L.ui.createHandlerFn(this, function() { + 'click': ui.createHandlerFn(this, function() { return callInitAction('sysntpd', 'restart'); }) }, _('Sync with NTP-Server')) : '' |