mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 05:06:13 +01:00
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:
@@ -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,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -166,6 +166,13 @@ def gen_data_entry_schema(
|
||||
vol.Optional("data_description"): {str: translation_value_validator},
|
||||
vol.Optional("menu_options"): {str: translation_value_validator},
|
||||
vol.Optional("submit"): translation_value_validator,
|
||||
vol.Optional("section"): {
|
||||
str: {
|
||||
vol.Optional("data"): {str: translation_value_validator},
|
||||
vol.Optional("description"): translation_value_validator,
|
||||
vol.Optional("name"): translation_value_validator,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
vol.Optional("error"): {str: translation_value_validator},
|
||||
|
||||
Reference in New Issue
Block a user