diff options
Diffstat (limited to 'static')
| -rw-r--r-- | static/structured-editor.js | 13 | ||||
| -rw-r--r-- | static/systemd-network.js | 2 |
2 files changed, 7 insertions, 8 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 }); } diff --git a/static/systemd-network.js b/static/systemd-network.js index 1a33f0e..0c57ec1 100644 --- a/static/systemd-network.js +++ b/static/systemd-network.js @@ -489,7 +489,7 @@ class NetworkConfiguration { } }); - return sections.join('\n') + '\n'; + return `${sections.join('\n')}\n`; } _hasSectionValues(section) { |
