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",
|
action: "navigate",
|
||||||
navigation_path,
|
navigation_path,
|
||||||
}
|
}
|
||||||
: undefined,
|
: {
|
||||||
|
action: "none",
|
||||||
|
},
|
||||||
}) satisfies HeadingCardConfig;
|
}) satisfies HeadingCardConfig;
|
||||||
|
|
||||||
@customElement("home-area-view-strategy")
|
@customElement("home-area-view-strategy")
|
||||||
@@ -182,7 +184,7 @@ export class HomeAreaViewStrategy extends ReactiveElement {
|
|||||||
computeHeadingCard(
|
computeHeadingCard(
|
||||||
hass.localize("ui.panel.lovelace.strategy.home.scenes"),
|
hass.localize("ui.panel.lovelace.strategy.home.scenes"),
|
||||||
"mdi:palette",
|
"mdi:palette",
|
||||||
"/config/scene/dashboard"
|
hass.user?.is_admin ? "/config/scene/dashboard" : undefined
|
||||||
),
|
),
|
||||||
...scenes.map(computeTileCard),
|
...scenes.map(computeTileCard),
|
||||||
],
|
],
|
||||||
@@ -285,12 +287,13 @@ export class HomeAreaViewStrategy extends ReactiveElement {
|
|||||||
{
|
{
|
||||||
type: "heading",
|
type: "heading",
|
||||||
heading: heading,
|
heading: heading,
|
||||||
tap_action: device
|
tap_action:
|
||||||
|
hass.user?.is_admin && device
|
||||||
? {
|
? {
|
||||||
action: "navigate",
|
action: "navigate",
|
||||||
navigation_path: `/config/devices/device/${device.id}`,
|
navigation_path: `/config/devices/device/${device.id}`,
|
||||||
}
|
}
|
||||||
: undefined,
|
: { action: "none" },
|
||||||
badges: [
|
badges: [
|
||||||
...batteryEntities.slice(0, 1).map((e) => ({
|
...batteryEntities.slice(0, 1).map((e) => ({
|
||||||
entity: e,
|
entity: e,
|
||||||
@@ -334,7 +337,7 @@ export class HomeAreaViewStrategy extends ReactiveElement {
|
|||||||
computeHeadingCard(
|
computeHeadingCard(
|
||||||
hass.localize("ui.panel.lovelace.strategy.home.automations"),
|
hass.localize("ui.panel.lovelace.strategy.home.automations"),
|
||||||
"mdi:robot",
|
"mdi:robot",
|
||||||
"/config/automation/dashboard"
|
hass.user?.is_admin ? "/config/automation/dashboard" : undefined
|
||||||
),
|
),
|
||||||
...automations.map(computeTileCard),
|
...automations.map(computeTileCard),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user