mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Add automation/editor/show
command to external bus (#19524)
This commit is contained in:
parent
2925ef3db0
commit
b224ec50e4
@ -7,6 +7,7 @@ This is the entry point for providing external app stuff from app entrypoint.
|
|||||||
|
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import { mainWindow } from "../common/dom/get_main_window";
|
import { mainWindow } from "../common/dom/get_main_window";
|
||||||
|
import { showAutomationEditor } from "../data/automation";
|
||||||
import { HomeAssistantMain } from "../layouts/home-assistant-main";
|
import { HomeAssistantMain } from "../layouts/home-assistant-main";
|
||||||
import type { EMIncomingMessageCommands } from "./external_messaging";
|
import type { EMIncomingMessageCommands } from "./external_messaging";
|
||||||
|
|
||||||
@ -79,6 +80,14 @@ const handleExternalMessage = (
|
|||||||
success: true,
|
success: true,
|
||||||
result: null,
|
result: null,
|
||||||
});
|
});
|
||||||
|
} else if (msg.command === "automation/editor/show") {
|
||||||
|
showAutomationEditor(msg.payload?.config);
|
||||||
|
bus.fireMessage({
|
||||||
|
id: msg.id,
|
||||||
|
type: "result",
|
||||||
|
success: true,
|
||||||
|
result: null,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { AutomationConfig } from "../data/automation";
|
||||||
|
|
||||||
const CALLBACK_EXTERNAL_BUS = "externalBus";
|
const CALLBACK_EXTERNAL_BUS = "externalBus";
|
||||||
|
|
||||||
interface CommandInFlight {
|
interface CommandInFlight {
|
||||||
@ -147,11 +149,21 @@ interface EMIncomingMessageShowSidebar {
|
|||||||
command: "sidebar/show";
|
command: "sidebar/show";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface EMIncomingMessageShowAutomationEditor {
|
||||||
|
id: number;
|
||||||
|
type: "command";
|
||||||
|
command: "automation/editor/show";
|
||||||
|
payload?: {
|
||||||
|
config?: Partial<AutomationConfig>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export type EMIncomingMessageCommands =
|
export type EMIncomingMessageCommands =
|
||||||
| EMIncomingMessageRestart
|
| EMIncomingMessageRestart
|
||||||
| EMIncomingMessageShowNotifications
|
| EMIncomingMessageShowNotifications
|
||||||
| EMIncomingMessageToggleSidebar
|
| EMIncomingMessageToggleSidebar
|
||||||
| EMIncomingMessageShowSidebar;
|
| EMIncomingMessageShowSidebar
|
||||||
|
| EMIncomingMessageShowAutomationEditor;
|
||||||
|
|
||||||
type EMIncomingMessage =
|
type EMIncomingMessage =
|
||||||
| EMMessageResultSuccess
|
| EMMessageResultSuccess
|
||||||
|
Loading…
x
Reference in New Issue
Block a user