From ed8f1c4c1c47465f79ddaf6af118d1dd29ee7d12 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 14 Aug 2019 17:07:55 +0200 Subject: luci-app-firewall: honour global default policies in per-zone settings Signed-off-by: Jo-Philipp Wich --- .../luci-static/resources/view/system/leds.js | 34 ++++++++++++---------- .../luci-static/resources/view/system/system.js | 15 +++++----- 2 files changed, 25 insertions(+), 24 deletions(-) (limited to 'modules/luci-mod-system/htdocs/luci-static/resources/view') 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 c1109b5d64..a5bda05761 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 @@ -3,28 +3,23 @@ 'require rpc'; 'require form'; -var callInitAction, callLeds, callUSB, callNetdevs; - -callInitAction = rpc.declare({ - object: 'luci', - method: 'initCall', - params: [ 'name', 'action' ], - expect: { result: false } -}); +var callLeds, callUSB, callNetdevs; callLeds = rpc.declare({ object: 'luci', - method: 'leds' + method: 'getLEDs', + expect: { '': {} } }); callUSB = rpc.declare({ object: 'luci', - method: 'usb' + method: 'getUSBDevices', + expect: { '': {} } }); callNetdevs = rpc.declare({ object: 'luci', - method: 'ifaddrs', + method: 'getIfaddrs', expect: { result: [] }, filter: function(res) { var devs = {}; @@ -130,16 +125,23 @@ return L.view.extend({ value = String(value || '').split(/\s+/); for (var i = 0; i < value.length; i++) - if (value[i].match(/^usb(\d+)-port(\d+)$/)) - ports.push(value[i]); - else if (value[i].match(/^(\d+)-(\d+)$/)) + if (value[i].match(/^(\d+)-(\d+)$/)) ports.push('usb%d-port%d'.format(Regexp.$1, Regexp.$2)); + else + ports.push(value[i]); return ports; }; usb.ports.forEach(function(usbport) { - o.value('usb%d-port%d'.format(usbport.hub, usbport.port), - 'Hub %d, Port %d'.format(usbport.hub, usbport.port)); + var dev = (usbport.device && Array.isArray(usb.devices)) + ? usb.devices.filter(function(d) { return d.id == usbport.device })[0] : null; + + var label = _('Port %s').format(usbport.port); + + if (dev) + label += ' (%s - %s)'.format(dev.vendor || '?', dev.product || '?'); + + o.value(usbport.port, label); }); } 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 6db973a8df..1ed8f64d8f 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 @@ -8,9 +8,9 @@ var callInitList, callInitAction, callTimezone, callInitList = rpc.declare({ object: 'luci', - method: 'initList', + method: 'getInitList', params: [ 'name' ], - expect: { result: {} }, + expect: { '': {} }, filter: function(res) { for (var k in res) return +res[k].enabled; @@ -20,7 +20,7 @@ callInitList = rpc.declare({ callInitAction = rpc.declare({ object: 'luci', - method: 'initCall', + method: 'setInitAction', params: [ 'name', 'action' ], expect: { result: false } }); @@ -28,20 +28,20 @@ callInitAction = rpc.declare({ callGetLocaltime = rpc.declare({ object: 'luci', method: 'getLocaltime', - expect: { localtime: 0 } + expect: { result: 0 } }); callSetLocaltime = rpc.declare({ object: 'luci', method: 'setLocaltime', params: [ 'localtime' ], - expect: { localtime: 0 } + expect: { result: 0 } }); callTimezone = rpc.declare({ object: 'luci', - method: 'timezone', - expect: { result: {} } + method: 'getTimezones', + expect: { '': {} } }); CBILocalTime = form.DummyValue.extend({ @@ -103,7 +103,6 @@ return L.view.extend({ _('Here you can configure the basic aspects of your device like its hostname or the timezone.')); m.chain('luci'); - m.tabbed = true; s = m.section(form.TypedSection, 'system', _('System Properties')); s.anonymous = true; -- cgit v1.2.3