mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Show script description in the more info dialog (#24507)
* Show script description in the more info dialog * Use markdown
This commit is contained in:
parent
ba19849182
commit
79374f6052
@ -17,6 +17,7 @@ import { computeObjectId } from "../../../common/entity/compute_object_id";
|
|||||||
import { listenMediaQuery } from "../../../common/dom/media_query";
|
import { listenMediaQuery } from "../../../common/dom/media_query";
|
||||||
import "../components/ha-more-info-state-header";
|
import "../components/ha-more-info-state-header";
|
||||||
import type { ExtEntityRegistryEntry } from "../../../data/entity_registry";
|
import type { ExtEntityRegistryEntry } from "../../../data/entity_registry";
|
||||||
|
import "../../../components/ha-markdown";
|
||||||
|
|
||||||
@customElement("more-info-script")
|
@customElement("more-info-script")
|
||||||
class MoreInfoScript extends LitElement {
|
class MoreInfoScript extends LitElement {
|
||||||
@ -56,10 +57,11 @@ class MoreInfoScript extends LitElement {
|
|||||||
}
|
}
|
||||||
const stateObj = this.stateObj;
|
const stateObj = this.stateObj;
|
||||||
|
|
||||||
const fields =
|
const script =
|
||||||
this.hass.services.script[
|
this.hass.services.script[
|
||||||
this.entry?.unique_id || computeObjectId(this.stateObj.entity_id)
|
this.entry?.unique_id || computeObjectId(this.stateObj.entity_id)
|
||||||
]?.fields;
|
];
|
||||||
|
const fields = script?.fields;
|
||||||
|
|
||||||
const hasFields = fields && Object.keys(fields).length > 0;
|
const hasFields = fields && Object.keys(fields).length > 0;
|
||||||
|
|
||||||
@ -82,6 +84,13 @@ class MoreInfoScript extends LitElement {
|
|||||||
.changedOverride=${this.stateObj.attributes.last_triggered || 0}
|
.changedOverride=${this.stateObj.attributes.last_triggered || 0}
|
||||||
></ha-more-info-state-header>
|
></ha-more-info-state-header>
|
||||||
|
|
||||||
|
${script?.description
|
||||||
|
? html`<ha-markdown
|
||||||
|
breaks
|
||||||
|
.content=${script.description}
|
||||||
|
></ha-markdown>`
|
||||||
|
: nothing}
|
||||||
|
|
||||||
<div class=${`queue ${hasQueue ? "has-queue" : ""}`}>
|
<div class=${`queue ${hasQueue ? "has-queue" : ""}`}>
|
||||||
${hasQueue
|
${hasQueue
|
||||||
? html`
|
? html`
|
||||||
@ -227,6 +236,10 @@ class MoreInfoScript extends LitElement {
|
|||||||
--service-control-padding: 0;
|
--service-control-padding: 0;
|
||||||
--service-control-items-border-top: none;
|
--service-control-items-border-top: none;
|
||||||
}
|
}
|
||||||
|
ha-markdown {
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 16px;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user