Matti Airas - Upcoming changes to SensESP: Refa...
Upcoming changes to SensESP: Refactoring of how web UI configuration cards are defined in the C++ code. So far, any class inheriting from
This approach has the problem that the configuration UI definition is tightly tied to the object, breaking the single responsibility principle and making some things more messy than necessary. I made a PR for refactoring this: now, all config items need to be defined explicitly by calling
The default config schema (which defines the properties of the web UI interface) can be provided for each class by defining an overloaded
A completely custom schema can be also given to the
I realize this is a breaking change but I believe this makes end user code easier to read and follow, and there's hopefully a bit less magic happening in the background.
Here's the PR: https://github.com/SignalK/SensESP/pull/761
Configurable and having a config path defined would expose a REST API endpoint for GETting and PUTting its configuration, and if it has a config schema defined, a config card would also be rendered in the UI.This approach has the problem that the configuration UI definition is tightly tied to the object, breaking the single responsibility principle and making some things more messy than necessary. I made a PR for refactoring this: now, all config items need to be defined explicitly by calling
ConfigItem(obj). The returned pointer can be used to chain other settings together:The default config schema (which defines the properties of the web UI interface) can be provided for each class by defining an overloaded
ConfigSchema function:A completely custom schema can be also given to the
ConfigItem object if desired.I realize this is a breaking change but I believe this makes end user code easier to read and follow, and there's hopefully a bit less magic happening in the background.
Here's the PR: https://github.com/SignalK/SensESP/pull/761
GitHub
This is a biggie. Previously, there was a Configurable class that made a config card appear on the web UI whenever something inherited that. However, the implementation made many assumptions on how...