Begun framework for frontend settings across devices

This commit is contained in:
2022-07-20 22:45:03 +00:00
parent 77554aa86c
commit c7ce90883b
11 changed files with 593 additions and 88 deletions

View File

@@ -85,3 +85,24 @@ export const loadHaForm = async () => {
if (!card) return;
await card.getConfigElement();
};
// Loads in ha-config-dashboard which is used to copy styling
// Also provides ha-settings-row
export const loadDevTools = async () => {
if (customElements.get("ha-config-dashboard")) return;
await customElements.whenDefined("partial-panel-resolver");
const ppResolver = document.createElement("partial-panel-resolver");
const routes = (ppResolver as any).getRoutes([
{
component_name: "config",
url_path: "a",
},
]);
await routes?.routes?.a?.load?.();
await customElements.whenDefined("ha-panel-config");
const configRouter = document.createElement("ha-panel-config");
await (configRouter as any)?.routerOptions?.routes?.dashboard?.load?.(); // Load ha-config-dashboard
await (configRouter as any)?.routerOptions?.routes?.cloud?.load?.(); // Load ha-settings-row
await customElements.whenDefined("ha-config-dashboard");
};