diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-04-03 10:00:06 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-04-03 10:00:06 +0200 |
commit | 3c4bc228a1f7b5731cf464f3f407c9ed9ace3cd2 (patch) | |
tree | d9ac0458c66dfa3c5d4922314df9d41499f578bc /modules | |
parent | 1099aebdee29b8e5408688d0fd64d49e6ec4bd35 (diff) |
treewide: import utility classes explicitly
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
39 files changed, 160 insertions, 97 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index 81ea32d48c..525526d62f 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; 'require rpc'; 'require uci'; 'require form'; @@ -123,7 +126,7 @@ function validateServerSpec(sid, s) { return true; } -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ callHostHints(), @@ -440,7 +443,7 @@ return L.view.extend({ var node = ipopt.map.findElement('id', ipopt.cbid(section_id)); if (node) - L.dom.callClassMethod(node, 'setValue', hosts[mac].ipv4); + dom.callClassMethod(node, 'setValue', hosts[mac].ipv4); }, this, ipopt, section_id)); return node; @@ -487,7 +490,7 @@ return L.view.extend({ o = s.taboption('leases', CBILease6Status, '__status6__'); return m.render().then(function(mapEl) { - L.Poll.add(function() { + poll.add(function() { return callDHCPLeases().then(function(leaseinfo) { var leases = Array.isArray(leaseinfo.dhcp_leases) ? leaseinfo.dhcp_leases : [], leases6 = Array.isArray(leaseinfo.dhcp6_leases) ? leaseinfo.dhcp6_leases : []; diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js index 24ab84ab9e..a94cc6673f 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js @@ -1,9 +1,11 @@ 'use strict'; +'require view'; +'require dom'; 'require fs'; 'require ui'; 'require uci'; -return L.view.extend({ +return view.extend({ handleCommand: function(exec, args) { var buttons = document.querySelectorAll('.diag-action > .cbi-button'); @@ -14,7 +16,7 @@ return L.view.extend({ var out = document.querySelector('.command-output'); out.style.display = ''; - L.dom.content(out, [ res.stdout || '', res.stderr || '' ]); + dom.content(out, [ res.stdout || '', res.stderr || '' ]); }).catch(function(err) { ui.addNotification(null, E('p', [ err ])) }).finally(function() { diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js index 975ac2fec7..cd0dacbf67 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js @@ -1,8 +1,9 @@ 'use strict'; +'require view'; 'require rpc'; 'require form'; -return L.view.extend({ +return view.extend({ callHostHints: rpc.declare({ object: 'luci-rpc', method: 'getHostHints', 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 0e6e5a2e25..fb3969e9d3 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,4 +1,7 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; 'require fs'; 'require ui'; 'require uci'; @@ -109,7 +112,7 @@ function render_status(node, ifc, with_device) { function render_modal_status(node, ifc) { var dev = ifc ? (ifc.getDevice() || ifc.getL3Device() || ifc.getL3Device()) : null; - L.dom.content(node, [ + dom.content(node, [ E('img', { 'src': L.resource('icons/%s%s.png').format(dev ? dev.getType() : 'ethernet', (dev && dev.isUp()) ? '' : '_disabled'), 'title': dev ? dev.getTypeI18n() : _('Not present') @@ -140,7 +143,7 @@ function render_ifacebox_status(node, ifc) { c.push(E('small', {}, ifc.isAlias() ? _('Alias of "%s"').format(ifc.isAlias()) : (dev ? dev.getName() : E('em', _('Not present'))))); - L.dom.content(node, c); + dom.content(node, c); return firewall.getZoneByNetwork(ifc.getName()).then(L.bind(function(zone) { this.style.backgroundColor = zone ? zone.getColor() : '#EEEEEE'; @@ -185,7 +188,7 @@ function iface_updown(up, id, ev, force) { 'class': 'cbi-button cbi-button-negative important', 'click': function(ev) { dsc.setAttribute('disconnect', ''); - L.dom.content(dsc, E('em', _('Interface is shutting down...'))); + dom.content(dsc, E('em', _('Interface is shutting down...'))); ui.hideModal(); } @@ -195,13 +198,13 @@ function iface_updown(up, id, ev, force) { } else { dsc.setAttribute('disconnect', ''); - L.dom.content(dsc, E('em', _('Interface is shutting down...'))); + dom.content(dsc, E('em', _('Interface is shutting down...'))); } }); } else { dsc.setAttribute(up ? 'reconnect' : 'disconnect', force ? 'force' : ''); - L.dom.content(dsc, E('em', up ? _('Interface is reconnecting...') : _('Interface is shutting down...'))); + dom.content(dsc, E('em', up ? _('Interface is reconnecting...') : _('Interface is shutting down...'))); } } @@ -224,7 +227,7 @@ function get_netmask(s, use_cfgvalue) { return mask; } -return L.view.extend({ +return view.extend({ poll_status: function(map, networks) { var resolveZone = null; @@ -245,10 +248,10 @@ return L.view.extend({ dynamic = ifc ? ifc.isDynamic() : false; if (dsc.hasAttribute('reconnect')) { - L.dom.content(dsc, E('em', _('Interface is starting...'))); + dom.content(dsc, E('em', _('Interface is starting...'))); } else if (dsc.hasAttribute('disconnect')) { - L.dom.content(dsc, E('em', _('Interface is stopping...'))); + dom.content(dsc, E('em', _('Interface is stopping...'))); } else if (ifc.getProtocol() || uci.get('network', ifc.getName()) == null) { render_status(dsc, ifc, false); @@ -258,18 +261,18 @@ return L.view.extend({ if (e) e.disabled = true; var link = L.url('admin/system/opkg') + '?query=luci-proto'; - L.dom.content(dsc, [ + dom.content(dsc, [ E('em', _('Unsupported protocol type.')), E('br'), E('a', { href: link }, _('Install protocol extensions...')) ]); } else { - L.dom.content(dsc, E('em', _('Interface not present or not connected yet.'))); + dom.content(dsc, E('em', _('Interface not present or not connected yet.'))); } if (stat) { var dev = ifc.getDevice(); - L.dom.content(stat, [ + dom.content(stat, [ E('img', { 'src': L.resource('icons/%s%s.png').format(dev ? dev.getType() : 'ethernet', (dev && dev.isUp()) ? '' : '_disabled'), 'title': dev ? dev.getTypeI18n() : _('Not present') @@ -336,7 +339,7 @@ return L.view.extend({ disabled = net ? !net.isUp() : true, dynamic = net ? net.isDynamic() : false; - L.dom.content(tdEl.lastChild, [ + dom.content(tdEl.lastChild, [ E('button', { 'class': 'cbi-button cbi-button-neutral reconnect', 'click': iface_updown.bind(this, true, section_id), @@ -979,7 +982,7 @@ return L.view.extend({ return m.render().then(L.bind(function(m, nodes) { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var section_ids = m.children[0].cfgsections(), tasks = []; diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/routes.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/routes.js index 4a002c2520..58a151de08 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/routes.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/routes.js @@ -1,9 +1,10 @@ 'use strict'; +'require view'; 'require form'; 'require network'; 'require tools.widgets as widgets'; -return L.view.extend({ +return view.extend({ load: function() { return network.getDevices(); }, 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 63427f147f..3133d27250 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,7 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; 'require ui'; 'require rpc'; 'require uci'; @@ -67,13 +70,13 @@ function render_port_status(node, portstate) { return null; if (!portstate || !portstate.link) - L.dom.content(node, [ + dom.content(node, [ E('img', { src: L.resource('icons/port_down.png') }), E('br'), _('no link') ]); else - L.dom.content(node, [ + dom.content(node, [ E('img', { src: L.resource('icons/port_up.png') }), E('br'), '%d'.format(portstate.speed) + _('baseT'), @@ -112,7 +115,7 @@ var callSwconfigPortState = rpc.declare({ expect: { result: [] } }); -return L.view.extend({ +return view.extend({ load: function() { return network.getSwitchTopologies().then(function(topologies) { var tasks = []; @@ -365,7 +368,7 @@ return L.view.extend({ }); } - L.Poll.add(L.bind(update_port_status, m, topologies)); + poll.add(L.bind(update_port_status, m, topologies)); return m.render(); } 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 0bc15c26aa..35ef2ba03a 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,4 +1,7 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; 'require fs'; 'require ui'; 'require rpc'; @@ -167,7 +170,7 @@ function render_modal_status(node, radioNet) { if (node == null) node = E('span', { 'class': 'ifacebadge large', 'data-network': radioNet.getName() }, [ E('small'), E('span') ]); - L.dom.content(node.firstElementChild, render_signal_badge( + dom.content(node.firstElementChild, render_signal_badge( disabled ? -1 : radioNet.getSignalPercent(), radioNet.getSignal(), noise, true, radioNet.getMode())); @@ -185,7 +188,7 @@ function render_modal_status(node, radioNet) { ], [ ' | ', E('br'), E('br'), E('br'), E('br'), E('br'), ' | ', E('br'), ' | ' ]); if (!is_assoc) - L.dom.append(node.lastElementChild, E('em', disabled ? _('Wireless is disabled') : _('Wireless is not associated'))); + dom.append(node.lastElementChild, E('em', disabled ? _('Wireless is disabled') : _('Wireless is not associated'))); return node; } @@ -216,7 +219,7 @@ function radio_restart(id, ev) { btn.disabled = true; dsc.setAttribute('restart', ''); - L.dom.content(dsc, E('em', _('Device is restarting…'))); + dom.content(dsc, E('em', _('Device is restarting…'))); } function network_updown(id, map, ev) { @@ -432,7 +435,7 @@ var CBIWifiFrequencyValue = form.Value.extend({ renderWidget: function(section_id, option_index, cfgvalue) { var elem = E('div'); - L.dom.content(elem, [ + dom.content(elem, [ E('label', { 'style': 'float:left; margin-right:3px' }, [ _('Mode'), E('br'), E('select', { @@ -520,7 +523,7 @@ var CBIWifiTxPowerValue = form.ListValue.extend({ var widget = form.ListValue.prototype.renderWidget.apply(this, [section_id, option_index, cfgvalue]); widget.firstElementChild.style.width = 'auto'; - L.dom.append(widget, E('span', [ + dom.append(widget, E('span', [ ' - ', _('Current power'), ': ', E('span', [ this.powerval != null ? '%d dBm'.format(this.powerval) : E('em', _('unknown')) ]), this.poweroff ? ' + %d dB offset = %s dBm'.format(this.poweroff, this.powerval != null ? this.powerval + this.poweroff : '?') : '' @@ -564,7 +567,7 @@ var CBIWifiCountryValue = form.Value.extend({ } }); -return L.view.extend({ +return view.extend({ poll_status: function(map, data) { var rows = map.querySelectorAll('.cbi-section-table-row[data-sid]'); @@ -578,16 +581,16 @@ return L.view.extend({ busy = btns[0].classList.contains('spinning') || btns[1].classList.contains('spinning') || btns[2].classList.contains('spinning'); if (radioDev) { - L.dom.content(badge, render_radio_badge(radioDev)); - L.dom.content(stat, render_radio_status(radioDev, data[2].filter(function(n) { return n.getWifiDeviceName() == radioDev.getName() }))); + dom.content(badge, render_radio_badge(radioDev)); + dom.content(stat, render_radio_status(radioDev, data[2].filter(function(n) { return n.getWifiDeviceName() == radioDev.getName() }))); } else { - L.dom.content(badge, render_network_badge(radioNet)); - L.dom.content(stat, render_network_status(radioNet)); + dom.content(badge, render_network_badge(radioNet)); + dom.content(stat, render_network_status(radioNet)); } if (stat.hasAttribute('restart')) - L.dom.content(stat, E('em', _('Device is restarting…'))); + dom.content(stat, E('em', _('Device is restarting…'))); btns[0].disabled = busy; btns[1].disabled = busy; @@ -645,7 +648,7 @@ return L.view.extend({ row.push(E('button', { 'class': 'cbi-button cbi-button-remove', 'click': L.bind(function(net, mac, ev) { - L.dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; + dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; ev.currentTarget.classList.add('spinning'); ev.currentTarget.disabled = true; ev.currentTarget.blur(); @@ -1676,8 +1679,8 @@ return L.view.extend({ this.pollFn = L.bind(this.handleScanRefresh, this, radioDev, {}, table, stop); - L.Poll.add(this.pollFn); - L.Poll.start(); + poll.add(this.pollFn); + poll.start(); }; s.handleScanRefresh = function(radioDev, scanCache, table, stop) { @@ -1743,12 +1746,12 @@ return L.view.extend({ var btn = ev.currentTarget; if (btn.getAttribute('data-state') == 'stop') { - L.Poll.remove(this.pollFn); + poll.remove(this.pollFn); btn.firstChild.data = _('Start refresh'); btn.setAttribute('data-state', 'start'); } else { - L.Poll.add(this.pollFn); + poll.add(this.pollFn); btn.firstChild.data = _('Stop refresh'); btn.setAttribute('data-state', 'stop'); btn.classList.add('spinning'); @@ -1757,14 +1760,14 @@ return L.view.extend({ }; s.handleScanAbort = function(ev) { - var md = L.dom.parent(ev.target, 'div[aria-modal="true"]'); + var md = dom.parent(ev.target, 'div[aria-modal="true"]'); if (md) { md.style.maxWidth = ''; md.style.maxHeight = ''; } ui.hideModal(); - L.Poll.remove(this.pollFn); + poll.remove(this.pollFn); this.pollFn = null; }; @@ -1984,7 +1987,7 @@ return L.view.extend({ }; return m.render().then(L.bind(function(m, nodes) { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var section_ids = m.children[0].cfgsections(), tasks = [ network.getHostHints(), network.getWifiDevices() ]; 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 0d89ae8ae8..edb934ed93 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,8 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; +'require request'; 'require ui'; 'require rpc'; 'require network'; @@ -20,7 +24,7 @@ function rate(n, br) { return [ '%1024.2mbit/s'.format(n * 8), br ? E('br') : ' ', '(%1024.2mB/s)'.format(n) ] } -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('bandwidth.svg')), @@ -95,7 +99,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < graphPolls.length; i++) { @@ -227,7 +231,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); @@ -289,13 +293,13 @@ return L.view.extend({ tab.querySelector('#scale').firstChild.data = _('(%d minute window, %d second interval)').format(info.timeframe, info.interval); - L.dom.content(tab.querySelector('#rx_bw_cur'), rate(info.line_current[0], true)); - L.dom.content(tab.querySelector('#rx_bw_avg'), rate(info.line_average[0], true)); - L.dom.content(tab.querySelector('#rx_bw_peak'), rate(info.line_peak[0], true)); + dom.content(tab.querySelector('#rx_bw_cur'), rate(info.line_current[0], true)); + dom.content(tab.querySelector('#rx_bw_avg'), rate(info.line_average[0], true)); + dom.content(tab.querySelector('#rx_bw_peak'), rate(info.line_peak[0], true)); - L.dom.content(tab.querySelector('#tx_bw_cur'), rate(info.line_current[1], true)); - L.dom.content(tab.querySelector('#tx_bw_avg'), rate(info.line_average[1], true)); - L.dom.content(tab.querySelector('#tx_bw_peak'), rate(info.line_peak[1], true)); + dom.content(tab.querySelector('#tx_bw_cur'), rate(info.line_current[1], true)); + dom.content(tab.querySelector('#tx_bw_avg'), rate(info.line_average[1], true)); + dom.content(tab.querySelector('#tx_bw_peak'), rate(info.line_peak[1], true)); }); } diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js index 458437ede0..4c1b097f2b 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require poll'; +'require request'; 'require rpc'; var callLuciRealtimeStats = rpc.declare({ @@ -30,7 +33,7 @@ var recheck_lookup_queue = {}; Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('connections.svg')) @@ -177,7 +180,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = [ L.resolveDefault(callLuciConntrackList(), []) ]; @@ -300,7 +303,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js index 3b9428eaf1..f3ee539bd1 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js @@ -1,8 +1,9 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; -return L.view.extend({ +return view.extend({ load: function() { return fs.exec_direct('/bin/dmesg', [ '-r' ]).catch(function(err) { ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message))); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js index 4a35175290..942b2dd567 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require fs'; 'require rpc'; @@ -12,7 +13,7 @@ var callSystemInfo = rpc.declare({ method: 'info' }); -return L.Class.extend({ +return baseclass.extend({ title: _('System'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js index 4219a8797d..ceb13b56fa 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require rpc'; var callSystemInfo = rpc.declare({ @@ -19,7 +20,7 @@ function progressbar(value, max, byte) { }, E('div', { 'style': 'width:%.2f%%'.format(pc) })); } -return L.Class.extend({ +return baseclass.extend({ title: _('Memory'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js index 0a7b00e214..d528408236 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require fs'; 'require network'; @@ -58,7 +59,7 @@ function renderbox(ifc, ipv6) { ]); } -return L.Class.extend({ +return baseclass.extend({ title: _('Network'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js index 5de79a8ee2..f839a180c7 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require rpc'; 'require network'; @@ -8,7 +9,7 @@ var callLuciDHCPLeases = rpc.declare({ expect: { '': {} } }); -return L.Class.extend({ +return baseclass.extend({ title: '', load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js index 5a3d64e7ac..cafd554f9a 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require rpc'; var callLuciDSLStatus = rpc.declare({ @@ -40,7 +41,7 @@ function renderbox(dsl) { ]); } -return L.Class.extend({ +return baseclass.extend({ title: _('DSL'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js index 5eff561536..115fe99095 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js @@ -1,4 +1,6 @@ 'use strict'; +'require baseclass'; +'require dom'; 'require network'; function renderbox(radio, networks) { @@ -73,11 +75,11 @@ function wifirate(rt) { return s; } -return L.Class.extend({ +return baseclass.extend({ title: _('Wireless'), handleDelClient: function(wifinet, mac, ev) { - L.dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; + dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; ev.currentTarget.classList.add('spinning'); ev.currentTarget.disabled = true; ev.currentTarget.blur(); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js index 01a8e1835a..15dcbe6385 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; 'require fs'; 'require network'; @@ -35,7 +38,7 @@ function startPolling(includes, containers) { containers[i].parentNode.style.display = ''; containers[i].parentNode.classList.add('fade-in'); - L.dom.content(containers[i], content); + dom.content(containers[i], content); } } @@ -48,11 +51,11 @@ function startPolling(includes, containers) { }; return step().then(function() { - L.Poll.add(step); + poll.add(step); }); } -return L.view.extend({ +return view.extend({ load: function() { return L.resolveDefault(fs.list('/www' + L.resource('view/status/include')), []).then(function(entries) { return Promise.all(entries.filter(function(e) { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js index fc7c7cdd12..84d2b10556 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js @@ -1,10 +1,12 @@ 'use strict'; +'require view'; +'require poll'; 'require fs'; 'require ui'; var table_names = [ 'Filter', 'NAT', 'Mangle', 'Raw' ]; -return L.view.extend({ +return view.extend({ load: function() { return L.resolveDefault(fs.stat('/usr/sbin/ip6tables')); }, @@ -215,7 +217,7 @@ return L.view.extend({ if (has_ip6tables) cmds.push('/usr/sbin/ip6tables'); - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < cmds.length; i++) { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js index 646d256d60..3b302dc509 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require poll'; +'require request'; 'require rpc'; var callLuciRealtimeStats = rpc.declare({ @@ -13,7 +16,7 @@ var graphPolls = [], Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('load.svg')) @@ -86,7 +89,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < graphPolls.length; i++) { @@ -205,7 +208,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js index d56eca5071..8a77306e57 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js @@ -1,4 +1,5 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; 'require rpc'; @@ -9,7 +10,7 @@ var callLuciProcessList = rpc.declare({ expect: { result: [] } }); -return L.view.extend({ +return view.extend({ load: function() { return callLuciProcessList(); }, diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js index 90cf2dd53c..5da5d403b1 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js @@ -1,4 +1,5 @@ 'use strict'; +'require view'; 'require fs'; 'require rpc'; 'require validation'; @@ -25,7 +26,7 @@ function applyMask(addr, mask, v6) { v6 ? '%x:%x:%x:%x:%x:%x:%x:%x' : '%d.%d.%d.%d', words); } -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ callNetworkInterfaceDump(), diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js index 69694bcfb3..145a632e62 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js @@ -1,8 +1,9 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; -return L.view.extend({ +return view.extend({ load: function() { return fs.exec_direct('/sbin/logread', [ '-e', '^' ]).catch(function(err) { ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message))); 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 cd8cff133b..171899262a 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,7 @@ 'use strict'; +'require view'; +'require poll'; +'require request'; 'require ui'; 'require rpc'; 'require network'; @@ -15,7 +18,7 @@ var graphPolls = [], Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('wireless.svg')), @@ -102,7 +105,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < graphPolls.length; i++) { @@ -221,7 +224,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index.htm b/modules/luci-mod-status/luasrc/view/admin_status/index.htm index 958212a01f..8e00564da4 100644 --- a/modules/luci-mod-status/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-status/luasrc/view/admin_status/index.htm @@ -70,7 +70,7 @@ function renderBadge(icon, title) { </div> <script type="text/javascript">L.require('view.status.index').catch(function(err) { - L.dom.content(document.querySelector('#view'), null); + dom.content(document.querySelector('#view'), null); L.error(err); });</script> 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 bd1eb6e51a..147b9830f0 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,8 +1,9 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; -return L.view.extend({ +return view.extend({ load: function() { return L.resolveDefault(fs.read('/etc/crontabs/root'), ''); }, diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/dropbear.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/dropbear.js index 7a8b1428d5..6ee801abc2 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/dropbear.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/dropbear.js @@ -1,8 +1,9 @@ 'use strict'; +'require view'; 'require form'; 'require tools.widgets as widgets'; -return L.view.extend({ +return view.extend({ render: function() { var m, s, o; 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 b1cc4d1a6f..b058091f94 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 @@ -1,4 +1,6 @@ 'use strict'; +'require view'; +'require dom'; 'require form'; 'require rpc'; 'require fs'; @@ -60,7 +62,7 @@ function findStorageSize(procmtd, procpart) { var mapdata = { actions: {}, config: {} }; -return L.view.extend({ +return view.extend({ load: function() { var tasks = [ L.resolveDefault(fs.stat('/lib/upgrade/platform.sh'), {}), @@ -166,7 +168,7 @@ return L.view.extend({ }, handleBlock: function(hostname, ev) { - var mtdblock = L.dom.parent(ev.target, '.cbi-section').querySelector('[data-name="mtdselect"] select').value; + var mtdblock = dom.parent(ev.target, '.cbi-section').querySelector('[data-name="mtdselect"] select').value; var form = E('form', { 'method': 'post', 'action': L.env.cgi_base + '/cgi-download', diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js index 6ccc70ac27..12a230d8a3 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js @@ -1,7 +1,8 @@ 'use strict'; +'require baseclass'; 'require form'; -return L.Class.extend({ +return baseclass.extend({ trigger: _('default-on (kernel)'), kernel: true, addFormOptions(s){ diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js index 7495843baa..760b92df99 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js @@ -1,6 +1,7 @@ 'use strict'; +'require baseclass'; -return L.Class.extend({ +return baseclass.extend({ trigger: _('heartbeat (kernel)'), kernel: true, addFormOptions(s){ diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js index dad631b533..203af06015 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js @@ -1,8 +1,9 @@ 'use strict'; +'require baseclass'; 'require form'; 'require tools.widgets as widgets'; -return L.Class.extend({ +return baseclass.extend({ trigger: _("netdev (kernel)"), kernel: true, addFormOptions(s){ diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js index 31fed55458..03806d5d24 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js @@ -1,6 +1,7 @@ 'use strict'; +'require baseclass'; -return L.Class.extend({ +return baseclass.extend({ trigger: _('none (kernel)'), kernel: true, addFormOptions(s){ diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js index 23ddd6d906..68ebf1d206 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js @@ -1,7 +1,8 @@ 'use strict'; +'require baseclass'; 'require form'; -return L.Class.extend({ +return baseclass.extend({ trigger: _('timer (kernel)'), kernel: true, addFormOptions(s){ diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js index 849ead9528..9fe1bff55e 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js @@ -1,4 +1,5 @@ 'use strict'; +'require view'; 'require uci'; 'require rpc'; 'require form'; @@ -10,7 +11,7 @@ var callLeds = rpc.declare({ expect: { '': {} } }); -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ callLeds(), 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 ec5d44cad0..7ee91f5aec 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,4 +1,5 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; 'require uci'; @@ -69,7 +70,7 @@ function device_textvalue(devices, section_id) { } } -return L.view.extend({ +return view.extend({ handleDetect: function(m, ev) { return callBlockDetect() .then(L.bind(uci.unload, uci, 'fstab')) 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 c3d317062f..2b79633cac 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,6 @@ 'use strict'; +'require view'; +'require dom'; 'require ui'; 'require form'; 'require rpc'; @@ -17,7 +19,7 @@ var callSetPassword = rpc.declare({ expect: { result: false } }); -return L.view.extend({ +return view.extend({ checkPassword: function(section_id, value) { var strength = document.querySelector('.cbi-value-description'), strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"), @@ -67,7 +69,7 @@ return L.view.extend({ handleSave: function() { var map = document.querySelector('.cbi-map'); - return L.dom.callClassMethod(map, 'save').then(function() { + return dom.callClassMethod(map, 'save').then(function() { if (formData.password.pw1 == null || formData.password.pw1.length == 0) return; @@ -85,7 +87,7 @@ return L.view.extend({ formData.password.pw1 = null; formData.password.pw2 = null; - L.dom.callClassMethod(map, 'render'); + dom.callClassMethod(map, 'render'); }); }); }, 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 3ed87f413f..3b9f450fcd 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 @@ -1,9 +1,10 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; 'require uci'; -return L.view.extend({ +return view.extend({ load: function() { return uci.changes(); }, diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js index ce3bac9612..487621daa3 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js @@ -1,4 +1,5 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; @@ -213,7 +214,7 @@ function handleWindowDragDropIgnore(ev) { ev.preventDefault() } -return L.view.extend({ +return view.extend({ load: function() { return fs.lines('/etc/dropbear/authorized_keys').then(function(lines) { return lines.filter(function(line) { 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 587f867aa6..146a991dfc 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,9 +1,10 @@ 'use strict'; +'require view'; 'require rpc'; 'require fs'; 'require ui'; -return L.view.extend({ +return view.extend({ callInitList: rpc.declare({ object: 'luci', method: 'getInitList', 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 8fe6b57545..ee97bd82f9 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,6 @@ 'use strict'; +'require view'; +'require poll'; 'require ui'; 'require uci'; 'require rpc'; @@ -74,7 +76,7 @@ CBILocalTime = form.DummyValue.extend({ }, }); -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ callInitList('sysntpd'), @@ -277,7 +279,7 @@ return L.view.extend({ } return m.render().then(function(mapEl) { - L.Poll.add(function() { + poll.add(function() { return callGetLocaltime().then(function(t) { mapEl.querySelector('#localtime').value = new Date(t * 1000).toLocaleString(); }); |