diff options
Diffstat (limited to 'modules')
4 files changed, 31 insertions, 20 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 07cacb324e..46f1ff4825 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -944,8 +944,8 @@ var CBITypedSection = CBIAbstractSection.extend({ sectionEl = E('div', { 'id': 'cbi-%s-%s'.format(config_name, this.sectiontype), 'class': 'cbi-section', - 'data-tab': this.map.tabbed ? this.sectiontype : null, - 'data-tab-title': this.map.tabbed ? this.title || this.sectiontype : null + 'data-tab': (this.map.tabbed && !this.parentoption) ? this.sectiontype : null, + 'data-tab-title': (this.map.tabbed && !this.parentoption) ? this.title || this.sectiontype : null }); if (this.title != null && this.title != '') @@ -1013,8 +1013,8 @@ var CBITableSection = CBITypedSection.extend({ sectionEl = E('div', { 'id': 'cbi-%s-%s'.format(config_name, this.sectiontype), 'class': 'cbi-section cbi-tblsection', - 'data-tab': this.map.tabbed ? this.sectiontype : null, - 'data-tab-title': this.map.tabbed ? this.title || this.sectiontype : null + 'data-tab': (this.map.tabbed && !this.parentoption) ? this.sectiontype : null, + 'data-tab-title': (this.map.tabbed && !this.parentoption) ? this.title || this.sectiontype : null }), tableEl = E('div', { 'class': 'table cbi-section-table' @@ -1211,10 +1211,7 @@ var CBITableSection = CBITypedSection.extend({ E('button', { 'title': btn_title || _('Delete'), 'class': 'cbi-button cbi-button-remove', - 'click': L.ui.createHandlerFn(this, function(sid, ev) { - this.map.data.remove(config_name, sid); - return this.map.save(null, true); - }, section_id) + 'click': L.ui.createHandlerFn(this, 'handleRemove', section_id) }, [ btn_title || _('Delete') ]) ); } @@ -1506,8 +1503,8 @@ var CBINamedSection = CBIAbstractSection.extend({ sectionEl = E('div', { 'id': ucidata ? null : 'cbi-%s-%s'.format(config_name, section_id), 'class': 'cbi-section', - 'data-tab': this.map.tabbed ? this.sectiontype : null, - 'data-tab-title': this.map.tabbed ? this.title || this.sectiontype : null + 'data-tab': (this.map.tabbed && !this.parentoption) ? this.sectiontype : null, + 'data-tab-title': (this.map.tabbed && !this.parentoption) ? this.title || this.sectiontype : null }); if (typeof(this.title) === 'string' && this.title !== '') @@ -1925,6 +1922,7 @@ var CBISectionValue = CBIValue.extend({ throw 'Sub section must be a descendent of CBIAbstractSection'; this.subsection = cbiClass.instantiate(this.varargs(arguments, 4, this.map)); + this.subsection.parentoption = this; }, load: function(section_id) { diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js index 8432bd16f3..a85e2414b6 100644 --- a/modules/luci-base/htdocs/luci-static/resources/network.js +++ b/modules/luci-base/htdocs/luci-static/resources/network.js @@ -822,7 +822,9 @@ Network = L.Class.extend({ }, deleteNetwork: function(name) { - return Promise.all([ L.require('firewall').catch(function() { return null }), initNetworkState() ]).then(function() { + var requireFirewall = Promise.resolve(L.require('firewall')).catch(function() {}); + + return Promise.all([ requireFirewall, initNetworkState() ]).then(function() { var uciInterface = uci.get('network', name); if (uciInterface != null && uciInterface['.type'] == 'interface') { 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 624718dd84..b49d36d464 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 @@ -740,6 +740,12 @@ return L.view.extend({ }, this)); }; + s.handleRemove = function(section_id, ev) { + return network.deleteNetwork(section_id).then(L.bind(function(section_id, ev) { + return form.GridSection.prototype.handleRemove.apply(this, [section_id, ev]); + }, this, section_id, ev)); + }; + o = s.option(form.DummyValue, '_ifacebox'); o.modalonly = false; o.textvalue = function(section_id) { 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 9e75fe9013..e6494f6b21 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 @@ -1721,7 +1721,8 @@ return L.view.extend({ zoneval = zoneopt ? zoneopt.formvalue('_new_') : null, enc = L.isObject(bss.encryption) ? bss.encryption : null, is_wep = (enc && Array.isArray(enc.wep)), - is_psk = (enc && Array.isArray(enc.wpa) && Array.isArray(enc.authentication) && enc.authentication[0] == 'psk'); + is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' })), + is_sae = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'sae' })); if (nameval == null || (passopt && passval == null)) return; @@ -1749,7 +1750,11 @@ return L.view.extend({ else if (bss.bssid != null) uci.set('wireless', section_id, 'bssid', bss.bssid); - if (is_psk) { + if (is_sae) { + uci.set('wireless', section_id, 'encryption', 'sae'); + uci.set('wireless', section_id, 'key', passval); + } + else if (is_psk) { for (var i = enc.wpa.length - 1; i >= 0; i--) { if (enc.wpa[i] == 2) { uci.set('wireless', section_id, 'encryption', 'psk2'); @@ -1769,14 +1774,14 @@ return L.view.extend({ uci.set('wireless', section_id, 'key1', passval); } - var zonePromise = zoneval - ? firewall.getZone(zoneval).then(function(zone) { return zone || firewall.addZone(zoneval) }) - : Promise.resolve(); + return network.addNetwork(nameval, { proto: 'dhcp' }).then(function(net) { + firewall.deleteNetwork(net.getName()); - return zonePromise.then(function(zone) { - return network.addNetwork(nameval, { proto: 'dhcp' }).then(function(net) { - firewall.deleteNetwork(net.getName()); + var zonePromise = zoneval + ? firewall.getZone(zoneval).then(function(zone) { return zone || firewall.addZone(zoneval) }) + : Promise.resolve(); + return zonePromise.then(function(zone) { if (zone) zone.addNetwork(net.getName()); }); @@ -1793,7 +1798,7 @@ return L.view.extend({ s2 = m2.section(form.NamedSection, '_new_'), enc = L.isObject(bss.encryption) ? bss.encryption : null, is_wep = (enc && Array.isArray(enc.wep)), - is_psk = (enc && Array.isArray(enc.wpa) && Array.isArray(enc.authentication) && enc.authentication[0] == 'psk'), + is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' || a == 'sae' })), replace, passphrase, name, zone; s2.render = function() { |