Section support for data entry flows (#118369)

* Add expandable support for data entry form flows

* Update config_validation.py

* optional options

* Adjust

* Correct translations of data within sections

* Update homeassistant/components/kitchen_sink/config_flow.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Add missing import

* Update tests/components/kitchen_sink/test_config_flow.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Format code

* Match frontend when serializing

* Move section class to data_entry_flow

* Correct serializing

* Fix import in kitchen_sink

* Move and update test

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
Erik Montnemery 2024-06-25 11:02:00 +02:00 committed by GitHub
parent 3d1ff72a88
commit 0545ed8082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 222 additions and 1 deletions

View file

@ -47,6 +47,19 @@ def ensure_not_same_as_default(value: dict) -> dict:
return value
DATA_ENTRY_ICONS_SCHEMA = vol.Schema(
{
"step": {
str: {
"section": {
str: icon_value_validator,
}
}
}
}
)
def icon_schema(integration_type: str, no_entity_platform: bool) -> vol.Schema:
"""Create an icon schema."""
@ -73,6 +86,11 @@ def icon_schema(integration_type: str, no_entity_platform: bool) -> vol.Schema:
schema = vol.Schema(
{
vol.Optional("config"): DATA_ENTRY_ICONS_SCHEMA,
vol.Optional("issues"): vol.Schema(
{str: {"fix_flow": DATA_ENTRY_ICONS_SCHEMA}}
),
vol.Optional("options"): DATA_ENTRY_ICONS_SCHEMA,
vol.Optional("services"): state_validator,
}
)