summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-04-16 15:28:21 +0200
committerJo-Philipp Wich <jo@mein.io>2020-04-16 15:28:21 +0200
commit0306b14d20ec8cfa3b851ddbdcef8c3fb1a3f832 (patch)
treeffa106667cf211b99ff6837526e0fbcd6a737aa3 /modules/luci-mod-network
parentc63c902163ceb811dd13f134e2afe8b55b18c4a6 (diff)
luci-mod-network: wireless.js: disable action buttons on insufficient ACLs
Also implement disabled state in custom frequency select widget. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js23
1 files changed, 15 insertions, 8 deletions
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 342d2aff2c..5d4b3cd70c 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
@@ -11,6 +11,8 @@
'require firewall';
'require tools.widgets as widgets';
+var isReadonlyView = !L.hasViewPermission();
+
function count_changes(section_id) {
var changes = ui.changes.changes, n = 0;
@@ -441,7 +443,8 @@ var CBIWifiFrequencyValue = form.Value.extend({
E('select', {
'class': 'mode',
'style': 'width:auto',
- 'change': L.bind(this.toggleWifiMode, this, elem)
+ 'change': L.bind(this.toggleWifiMode, this, elem),
+ 'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
})
]),
E('label', { 'style': 'float:left; margin-right:3px' }, [
@@ -449,21 +452,24 @@ var CBIWifiFrequencyValue = form.Value.extend({
E('select', {
'class': 'band',
'style': 'width:auto',
- 'change': L.bind(this.toggleWifiBand, this, elem)
+ 'change': L.bind(this.toggleWifiBand, this, elem),
+ 'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
})
]),
E('label', { 'style': 'float:left; margin-right:3px' }, [
_('Channel'), E('br'),
E('select', {
'class': 'channel',
- 'style': 'width:auto'
+ 'style': 'width:auto',
+ 'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
})
]),
E('label', { 'style': 'float:left; margin-right:3px' }, [
_('Width'), E('br'),
E('select', {
'class': 'htmode',
- 'style': 'width:auto'
+ 'style': 'width:auto',
+ 'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
})
]),
E('br', { 'style': 'clear:left' })
@@ -592,9 +598,9 @@ return view.extend({
if (stat.hasAttribute('restart'))
dom.content(stat, E('em', _('Device is restarting…')));
- btns[0].disabled = busy;
- btns[1].disabled = busy;
- btns[2].disabled = busy;
+ btns[0].disabled = isReadonlyView || busy;
+ btns[1].disabled = (isReadonlyView && radioDev) || busy;
+ btns[2].disabled = isReadonlyView || busy;
}
var table = document.querySelector('#wifi_assoclist_table'),
@@ -654,7 +660,8 @@ return view.extend({
ev.currentTarget.blur();
net.disconnectClient(mac, true, 5, 60000);
- }, this, bss.network, bss.mac)
+ }, this, bss.network, bss.mac),
+ 'disabled': isReadonlyView || null
}, [ _('Disconnect') ]));
}
else {