Skip to content

Commit cc23a5c

Browse files
committed
[fix] Workaround for config UI when using variables in bssid
1 parent 35563d1 commit cc23a5c

File tree

1 file changed

+7
-2
lines changed
  • openwisp_controller/config/static/config/js

1 file changed

+7
-2
lines changed

openwisp_controller/config/static/config/js/widget.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
$.extend(options, JSON.parse(field.attr("data-options")));
236236
}
237237

238-
ipAddrMaxLengthWorkaround(startval, options.schema);
238+
varValidationWorkaround(startval, options.schema);
239239
editor = new JSONEditor(document.getElementById(id), options);
240240
django._jsonEditors[id] = editor;
241241
// initialise advanced json editor here (disable schema validation in VPN admin)
@@ -435,7 +435,7 @@
435435
// deletes maxLength on ip address schema if address contains variable
436436
// this workaround is necessary until we rewrite the config UI to
437437
// deal with variables properly
438-
var ipAddrMaxLengthWorkaround = function(value, schema) {
438+
var varValidationWorkaround = function(value, schema) {
439439
if (value && value.interfaces) {
440440
$.each(value.interfaces, function(i, interf) {
441441
if (interf.addresses) {
@@ -448,6 +448,11 @@
448448
}
449449
});
450450
}
451+
if (interf.wireless && interf.wireless.bssid && interf.wireless.bssid.indexOf('{{') > -1) {
452+
try {
453+
delete schema.definitions.bssid_wireless_property.properties.bssid.pattern;
454+
} catch (e) {}
455+
}
451456
});
452457
}
453458
};

0 commit comments

Comments
 (0)