Allow editor-validation for enum-lists

This commit is contained in:
Lord-Grey 2021-05-05 10:44:53 +02:00
parent 561fabeba6
commit 184cfb1e72
7 changed files with 42 additions and 43 deletions

View File

@ -831,6 +831,8 @@ $(document).ready(function () {
canSave = true; canSave = true;
} }
if (!conf_editor.validate().length) {
if (canIdentify) { if (canIdentify) {
$("#btn_test_controller").removeClass('hidden'); $("#btn_test_controller").removeClass('hidden');
$('#btn_test_controller').attr('disabled', false); $('#btn_test_controller').attr('disabled', false);
@ -852,7 +854,7 @@ $(document).ready(function () {
else { else {
$('#btn_submit_controller').attr('disabled', true); $('#btn_submit_controller').attr('disabled', true);
} }
}
window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false); window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
window.readOnlyMode ? $('#btn_ma_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false); window.readOnlyMode ? $('#btn_ma_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
window.readOnlyMode ? $('#leds_custom_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false); window.readOnlyMode ? $('#leds_custom_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);

View File

@ -1839,7 +1839,7 @@ JSONEditor.AbstractEditor = Class.extend({
this.parent = null; this.parent = null;
}, },
getDefault: function() { getDefault: function() {
if(this.schema["default"]) return this.schema["default"]; if(this.schema["default"]) return $.i18n(this.schema["default"]);
if(this.schema["enum"]) return this.schema["enum"][0]; if(this.schema["enum"]) return this.schema["enum"][0];
var type = this.schema.type || this.schema.oneOf; var type = this.schema.type || this.schema.oneOf;

View File

@ -5,7 +5,7 @@
"available_devices": { "available_devices": {
"type": "string", "type": "string",
"title": "edt_conf_grabber_discovered_title", "title": "edt_conf_grabber_discovered_title",
"default": "NONE", "default": "edt_conf_grabber_discovery_inprogress",
"options": { "options": {
"infoText": "edt_conf_grabber_discovered_title_info" "infoText": "edt_conf_grabber_discovered_title_info"
}, },

View File

@ -6,7 +6,7 @@
"available_devices": { "available_devices": {
"type": "string", "type": "string",
"title": "edt_conf_grabber_discovered_title", "title": "edt_conf_grabber_discovered_title",
"default": "NONE", "default": "edt_conf_grabber_discovery_inprogress",
"options": { "options": {
"infoText": "edt_conf_grabber_discovered_title_info" "infoText": "edt_conf_grabber_discovered_title_info"
}, },

View File

@ -5,9 +5,8 @@
"hostList": { "hostList": {
"type": "string", "type": "string",
"title": "edt_dev_spec_devices_discovered_title", "title": "edt_dev_spec_devices_discovered_title",
"enum": [ "NONE" ], "default": "edt_dev_spec_devices_discovery_inprogress",
"options": { "options": {
"enum_titles": [ "edt_dev_spec_devices_discovery_inprogress" ],
"infoText": "edt_dev_spec_devices_discovered_title_info" "infoText": "edt_dev_spec_devices_discovered_title_info"
}, },
"required": true, "required": true,

View File

@ -5,9 +5,8 @@
"hostList": { "hostList": {
"type": "string", "type": "string",
"title": "edt_dev_spec_devices_discovered_title", "title": "edt_dev_spec_devices_discovered_title",
"enum": [ "NONE" ], "default": "edt_dev_spec_devices_discovery_inprogress",
"options": { "options": {
"enum_titles": [ "edt_dev_spec_devices_discovery_inprogress" ],
"infoText": "edt_dev_spec_devices_discovered_title_info" "infoText": "edt_dev_spec_devices_discovered_title_info"
}, },
"required": true, "required": true,

View File

@ -6,9 +6,8 @@
"hostList": { "hostList": {
"type": "string", "type": "string",
"title": "edt_dev_spec_devices_discovered_title", "title": "edt_dev_spec_devices_discovered_title",
"enum": [ "NONE" ], "default": "edt_dev_spec_devices_discovery_inprogress",
"options": { "options": {
"enum_titles": [ "edt_dev_spec_devices_discovery_inprogress" ],
"infoText": "edt_dev_spec_devices_discovered_title_info" "infoText": "edt_dev_spec_devices_discovered_title_info"
}, },
"required": true, "required": true,