Show yaml parsing errors in hui-element-editor #23690
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
If there are yaml errors in a card editor, show those errors in the window.
Currently they are not shown, and if we click "Save", the window closes and any pending changes are lost. The only indication of an error is a red line on the side of the codemirror box, which is not always obvious to every user what it means.
This change shows yaml errors in the window, and disables the save button when there are yaml errors.
I have also elected to do a bit of debouncing on this detection, because if we just show the error immediately, it will show an error immediately every time a user types a keystroke on a new line, which I think is too aggressive.
So this only shows the error either after user pauses typing for 2 seconds, or when the codemirror box is blurred.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: