mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Home strategy: don't link non-admin to config pages (#28512)
This commit is contained in:
@@ -41,7 +41,9 @@ const computeHeadingCard = (
|
||||
action: "navigate",
|
||||
navigation_path,
|
||||
}
|
||||
: undefined,
|
||||
: {
|
||||
action: "none",
|
||||
},
|
||||
}) satisfies HeadingCardConfig;
|
||||
|
||||
@customElement("home-area-view-strategy")
|
||||
@@ -182,7 +184,7 @@ export class HomeAreaViewStrategy extends ReactiveElement {
|
||||
computeHeadingCard(
|
||||
hass.localize("ui.panel.lovelace.strategy.home.scenes"),
|
||||
"mdi:palette",
|
||||
"/config/scene/dashboard"
|
||||
hass.user?.is_admin ? "/config/scene/dashboard" : undefined
|
||||
),
|
||||
...scenes.map(computeTileCard),
|
||||
],
|
||||
@@ -285,12 +287,13 @@ export class HomeAreaViewStrategy extends ReactiveElement {
|
||||
{
|
||||
type: "heading",
|
||||
heading: heading,
|
||||
tap_action: device
|
||||
tap_action:
|
||||
hass.user?.is_admin && device
|
||||
? {
|
||||
action: "navigate",
|
||||
navigation_path: `/config/devices/device/${device.id}`,
|
||||
}
|
||||
: undefined,
|
||||
: { action: "none" },
|
||||
badges: [
|
||||
...batteryEntities.slice(0, 1).map((e) => ({
|
||||
entity: e,
|
||||
@@ -334,7 +337,7 @@ export class HomeAreaViewStrategy extends ReactiveElement {
|
||||
computeHeadingCard(
|
||||
hass.localize("ui.panel.lovelace.strategy.home.automations"),
|
||||
"mdi:robot",
|
||||
"/config/automation/dashboard"
|
||||
hass.user?.is_admin ? "/config/automation/dashboard" : undefined
|
||||
),
|
||||
...automations.map(computeTileCard),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user