Support for jsonConfig and React/HTML tabs simultaneously with enhanced UI detection #496
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.
The dev-server previously used an either/or approach for admin UI configurations: if a
jsonConfig.json
orjsonConfig.json5
file existed, it would only support JSON config hot-reload. Otherwise, it would only support React/HTML config hot-reload. This prevented developers from using both approaches simultaneously.Problem
The original logic in
src/index.ts
around line 669 looked like this:This meant developers had to choose between:
jsonConfig.json
for simple configuration options (with hot-reload)But couldn't use both approaches in the same adapter.
Solution
This PR introduces comprehensive UI capability detection and a combined mode that supports multiple UI approaches simultaneously:
Enhanced UI Detection: Added
getAdapterUiCapabilities()
that analyzes multiple sources:jsonConfig.json
orjsonConfig.json5
)watch:react
,watch:parcel
)admin/index.html
).create-adapter.json
file for UI type hints from adapter creation metadataio-package.json
adminUi
field for official ioBroker schema configurationadmin/tab.html
,admin/jsonTab.json
,admin/jsonTab.json5
)Combined Proxy Mode: New
createCombinedConfigProxy()
that merges functionality from both existing proxy methods:Three-Mode Logic: The server now chooses between:
Benefits
jsonConfig.json
andjsonConfig.json5
formatsExample Use Case
An adapter can now have:
admin/jsonConfig.json
for basic settings like API keys, polling intervalsadmin/jsonTab.json
for custom tab configurationsadmin/tab.html
for custom HTML tab interfacesAddresses #473.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.