Compare commits

...

1 Commits

Author SHA1 Message Date
Petar Petrov
559f0abd5a Allow internal urls in Webpage dashboards 2026-01-27 19:11:03 +02:00
2 changed files with 18 additions and 3 deletions

View File

@@ -448,9 +448,14 @@ class HaSidebar extends SubscribeMixin(ScrollableFadeMixin(LitElement)) {
}
private _renderPanels(panels: PanelInfo[], selectedPanel: string) {
return panels.map((panel) =>
this._renderPanel(panel, panel.url_path === selectedPanel)
);
return panels.map((panel) => {
// Check both url_path match AND if current route matches panel's iframe destination
const isSelected =
panel.url_path === selectedPanel ||
(panel.config?.url?.startsWith("/") &&
this.route.path?.startsWith(panel.config.url));
return this._renderPanel(panel, isSelected);
});
}
private _renderPanel(panel: PanelInfo, isSelected: boolean) {

View File

@@ -1,5 +1,6 @@
import { ReactiveElement } from "lit";
import { customElement } from "lit/decorators";
import { navigate } from "../../../../common/navigate";
import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view";
import type { IframeCardConfig } from "../../cards/types";
@@ -14,6 +15,15 @@ export class IframeViewStrategy extends ReactiveElement {
static async generate(
config: IframeViewStrategyConfig
): Promise<LovelaceViewConfig> {
// For internal URLs, navigate directly instead of embedding in iframe
if (config.url.startsWith("/")) {
navigate(config.url, { replace: true });
return {
type: "panel",
cards: [],
};
}
return {
type: "panel",
title: config.title,