}
function deviceRemove(section_id) {
- var ds = lookupDevSection(this.section, section_id, false),
- sv = ds ? uci.get('network', ds) : null;
-
- if (sv) {
- var empty = true;
+ var ds = lookupDevSection(this.section, section_id, false);
- for (var opt in sv) {
- if (opt.charAt(0) == '.' || opt == 'name' || opt == this.option)
- continue;
-
- empty = false;
- }
-
- if (empty)
- uci.remove('network', ds);
- else
- uci.unset('network', ds, this.option);
- }
+ uci.unset('network', ds, this.option);
if (this.migrate)
uci.unset('network', section_id, this.option);
}
}
+function sectionParse() {
+ var ds = lookupDevSection(this, this.section, false);
+
+ return form.NamedSection.prototype.parse.apply(this).then(function() {
+ var sv = ds ? uci.get('network', ds) : null;
+
+ if (sv) {
+ var empty = true;
+
+ for (var opt in sv) {
+ if (opt.charAt(0) == '.' || opt == 'name')
+ continue;
+
+ empty = false;
+ }
+
+ if (empty)
+ uci.remove('network', ds);
+ }
+ });
+}
+
var cbiTagValue = form.Value.extend({
renderWidget: function(section_id, option_index, cfgvalue) {
o, ss;
if (isIface) {
+ if (!s.hasOwnProperty('parse'))
+ s.parse = sectionParse;
+
var type;
/* If an externally configured br-xxx interface already exists,