summaryrefslogtreecommitdiffstats
path: root/static/structured-editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/structured-editor.js')
-rw-r--r--static/structured-editor.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/static/structured-editor.js b/static/structured-editor.js
index 0ce0965..c419024 100644
--- a/static/structured-editor.js
+++ b/static/structured-editor.js
@@ -28,7 +28,7 @@ class StructuredEditor {
this.render();
} catch (error) {
console.error("Error loading schema:", error);
- this.showError("Failed to load configuration schema: " + error.message);
+ this.showError(`Failed to load configuration schema: ${error.message}`);
}
}
@@ -52,7 +52,7 @@ class StructuredEditor {
this._attachEventListeners();
} catch (error) {
console.error("Error rendering structured editor:", error);
- this.showError("Failed to render editor: " + error.message);
+ this.showError(`Failed to render editor: ${error.message}`);
}
}
@@ -280,14 +280,14 @@ class StructuredEditor {
_updateFieldValue(element) {
const section = element.dataset.section;
const index = element.dataset.index
- ? parseInt(element.dataset.index)
+ ? parseInt(element.dataset.index, 10)
: null;
const key = element.dataset.key;
const value = element.value;
if (!section) {
// Regular section (Match, Link, Network, DHCP)
- if (this.schema[section] && this.schema[section][key]) {
+ if (this.schema[section]?.[key]) {
this.schema[section][key].value = value || null;
}
} else if (
@@ -297,8 +297,7 @@ class StructuredEditor {
) {
// Array section item
if (
- this.schema[section].items[index] &&
- this.schema[section].items[index][key]
+ this.schema[section].items[index]?.[key]
) {
this.schema[section].items[index][key].value = value || null;
}
@@ -322,7 +321,7 @@ class StructuredEditor {
*/
_onRemoveSection(event) {
const section = event.target.dataset.section;
- const index = parseInt(event.target.dataset.index);
+ const index = parseInt(event.target.dataset.index, 10);
this.emit("removeSection", { section, index });
}