-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add base support for sub entries (#23160)
* Add base support for sub entries * add demo types * fix translations * Use sub entry name when deleting * Update show-dialog-sub-config-flow.ts * adjust for multiple sub types * WIP, not functional * add subentry_type * rename to supported_subentry_types * config_subentries -> config_entries_subentries * Add localized sub flow title * use Record * rename * more rename
- Loading branch information
1 parent
03a415b
commit 0d97afb
Showing
20 changed files
with
880 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { HomeAssistant } from "../types"; | ||
import type { DataEntryFlowStep } from "./data_entry_flow"; | ||
|
||
const HEADERS = { | ||
"HA-Frontend-Base": `${location.protocol}//${location.host}`, | ||
}; | ||
|
||
export const createSubConfigFlow = ( | ||
hass: HomeAssistant, | ||
configEntryId: string, | ||
subFlowType: string, | ||
subentry_id?: string | ||
) => | ||
hass.callApi<DataEntryFlowStep>( | ||
"POST", | ||
"config/config_entries/subentries/flow", | ||
{ | ||
handler: [configEntryId, subFlowType], | ||
show_advanced_options: Boolean(hass.userData?.showAdvanced), | ||
subentry_id, | ||
}, | ||
HEADERS | ||
); | ||
|
||
export const fetchSubConfigFlow = (hass: HomeAssistant, flowId: string) => | ||
hass.callApi<DataEntryFlowStep>( | ||
"GET", | ||
`config/config_entries/subentries/flow/${flowId}`, | ||
undefined, | ||
HEADERS | ||
); | ||
|
||
export const handleSubConfigFlowStep = ( | ||
hass: HomeAssistant, | ||
flowId: string, | ||
data: Record<string, any> | ||
) => | ||
hass.callApi<DataEntryFlowStep>( | ||
"POST", | ||
`config/config_entries/subentries/flow/${flowId}`, | ||
data, | ||
HEADERS | ||
); | ||
|
||
export const deleteSubConfigFlow = (hass: HomeAssistant, flowId: string) => | ||
hass.callApi("DELETE", `config/config_entries/subentries/flow/${flowId}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.