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>
This commit is contained in:
parent
c63c902163
commit
0306b14d20
1 changed files with 15 additions and 8 deletions
|
@ -11,6 +11,8 @@
|
||||||
'require firewall';
|
'require firewall';
|
||||||
'require tools.widgets as widgets';
|
'require tools.widgets as widgets';
|
||||||
|
|
||||||
|
var isReadonlyView = !L.hasViewPermission();
|
||||||
|
|
||||||
function count_changes(section_id) {
|
function count_changes(section_id) {
|
||||||
var changes = ui.changes.changes, n = 0;
|
var changes = ui.changes.changes, n = 0;
|
||||||
|
|
||||||
|
@ -441,7 +443,8 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'mode',
|
'class': 'mode',
|
||||||
'style': 'width:auto',
|
'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' }, [
|
E('label', { 'style': 'float:left; margin-right:3px' }, [
|
||||||
|
@ -449,21 +452,24 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'band',
|
'class': 'band',
|
||||||
'style': 'width:auto',
|
'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' }, [
|
E('label', { 'style': 'float:left; margin-right:3px' }, [
|
||||||
_('Channel'), E('br'),
|
_('Channel'), E('br'),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'channel',
|
'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' }, [
|
E('label', { 'style': 'float:left; margin-right:3px' }, [
|
||||||
_('Width'), E('br'),
|
_('Width'), E('br'),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'htmode',
|
'class': 'htmode',
|
||||||
'style': 'width:auto'
|
'style': 'width:auto',
|
||||||
|
'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
E('br', { 'style': 'clear:left' })
|
E('br', { 'style': 'clear:left' })
|
||||||
|
@ -592,9 +598,9 @@ return view.extend({
|
||||||
if (stat.hasAttribute('restart'))
|
if (stat.hasAttribute('restart'))
|
||||||
dom.content(stat, E('em', _('Device is restarting…')));
|
dom.content(stat, E('em', _('Device is restarting…')));
|
||||||
|
|
||||||
btns[0].disabled = busy;
|
btns[0].disabled = isReadonlyView || busy;
|
||||||
btns[1].disabled = busy;
|
btns[1].disabled = (isReadonlyView && radioDev) || busy;
|
||||||
btns[2].disabled = busy;
|
btns[2].disabled = isReadonlyView || busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
var table = document.querySelector('#wifi_assoclist_table'),
|
var table = document.querySelector('#wifi_assoclist_table'),
|
||||||
|
@ -654,7 +660,8 @@ return view.extend({
|
||||||
ev.currentTarget.blur();
|
ev.currentTarget.blur();
|
||||||
|
|
||||||
net.disconnectClient(mac, true, 5, 60000);
|
net.disconnectClient(mac, true, 5, 60000);
|
||||||
}, this, bss.network, bss.mac)
|
}, this, bss.network, bss.mac),
|
||||||
|
'disabled': isReadonlyView || null
|
||||||
}, [ _('Disconnect') ]));
|
}, [ _('Disconnect') ]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue