mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Return config entry ID after creation (#22060)
This commit is contained in:
@@ -118,6 +118,16 @@ class ConfigManagerFlowIndexView(FlowManagerIndexView):
|
||||
# pylint: disable=no-value-for-parameter
|
||||
return await super().post(request)
|
||||
|
||||
def _prepare_result_json(self, result):
|
||||
"""Convert result to JSON."""
|
||||
if result['type'] != data_entry_flow.RESULT_TYPE_CREATE_ENTRY:
|
||||
return super()._prepare_result_json(result)
|
||||
|
||||
data = result.copy()
|
||||
data['result'] = data['result'].entry_id
|
||||
data.pop('data')
|
||||
return data
|
||||
|
||||
|
||||
class ConfigManagerFlowResourceView(FlowManagerResourceView):
|
||||
"""View to interact with the flow manager."""
|
||||
@@ -143,6 +153,16 @@ class ConfigManagerFlowResourceView(FlowManagerResourceView):
|
||||
# pylint: disable=no-value-for-parameter
|
||||
return await super().post(request, flow_id)
|
||||
|
||||
def _prepare_result_json(self, result):
|
||||
"""Convert result to JSON."""
|
||||
if result['type'] != data_entry_flow.RESULT_TYPE_CREATE_ENTRY:
|
||||
return super()._prepare_result_json(result)
|
||||
|
||||
data = result.copy()
|
||||
data['result'] = data['result'].entry_id
|
||||
data.pop('data')
|
||||
return data
|
||||
|
||||
|
||||
class ConfigManagerAvailableFlowView(HomeAssistantView):
|
||||
"""View to query available flows."""
|
||||
@@ -175,7 +195,7 @@ class OptionManagerFlowIndexView(FlowManagerIndexView):
|
||||
return await super().post(request)
|
||||
|
||||
|
||||
class OptionManagerFlowResourceView(ConfigManagerFlowResourceView):
|
||||
class OptionManagerFlowResourceView(FlowManagerResourceView):
|
||||
"""View to interact with the option flow manager."""
|
||||
|
||||
url = '/api/config/config_entries/options/flow/{flow_id}'
|
||||
|
||||
Reference in New Issue
Block a user