mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Remove references to "service call" from actions (#19226)
This commit is contained in:
parent
1b6def4875
commit
5ac0360494
@ -4,7 +4,14 @@ import {
|
||||
HassServices,
|
||||
HassServiceTarget,
|
||||
} from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
PropertyValues,
|
||||
nothing,
|
||||
} from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { ensureArray } from "../common/array/ensure-array";
|
||||
@ -83,6 +90,8 @@ export class HaServiceControl extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public showAdvanced?: boolean;
|
||||
|
||||
@property({ type: Boolean, reflect: true }) public hidePicker?: boolean;
|
||||
|
||||
@state() private _value!: this["value"];
|
||||
|
||||
@state() private _checkedKeys = new Set();
|
||||
@ -363,12 +372,14 @@ export class HaServiceControl extends LitElement {
|
||||
)) ||
|
||||
serviceData?.description;
|
||||
|
||||
return html`<ha-service-picker
|
||||
.hass=${this.hass}
|
||||
.value=${this._value?.service}
|
||||
.disabled=${this.disabled}
|
||||
@value-changed=${this._serviceChanged}
|
||||
></ha-service-picker>
|
||||
return html`${this.hidePicker
|
||||
? nothing
|
||||
: html`<ha-service-picker
|
||||
.hass=${this.hass}
|
||||
.value=${this._value?.service}
|
||||
.disabled=${this.disabled}
|
||||
@value-changed=${this._serviceChanged}
|
||||
></ha-service-picker>`}
|
||||
<div class="description">
|
||||
${description ? html`<p>${description}</p>` : ""}
|
||||
${this._manifest
|
||||
@ -735,6 +746,9 @@ export class HaServiceControl extends LitElement {
|
||||
margin: var(--service-control-padding, 0 16px);
|
||||
padding: 16px 0;
|
||||
}
|
||||
:host([hidePicker]) p {
|
||||
padding-top: 0;
|
||||
}
|
||||
.checkbox-spacer {
|
||||
width: 32px;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ export const serviceActionStruct: Describe<ServiceAction> = assign(
|
||||
target: optional(targetStruct),
|
||||
data: optional(object()),
|
||||
response_variable: optional(string()),
|
||||
metadata: optional(object()),
|
||||
})
|
||||
);
|
||||
|
||||
@ -133,6 +134,7 @@ export interface ServiceAction extends BaseAction {
|
||||
target?: HassServiceTarget;
|
||||
data?: Record<string, unknown>;
|
||||
response_variable?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface DeviceAction extends BaseAction {
|
||||
|
@ -168,8 +168,11 @@ const tryDescribeAction = <T extends ActionType>(
|
||||
const service =
|
||||
hass.localize(`component.${domain}.services.${serviceName}.name`) ||
|
||||
hass.services[domain][serviceName]?.name;
|
||||
|
||||
return hass.localize(
|
||||
`${actionTranslationBaseKey}.service.description.service_based_on_name`,
|
||||
`${actionTranslationBaseKey}.service.description.${
|
||||
config.metadata ? "service_name" : "service_based_on_name"
|
||||
}`,
|
||||
{
|
||||
name: service
|
||||
? `${domainToName(hass.localize, domain)}: ${service}`
|
||||
|
@ -29,6 +29,8 @@ import { classMap } from "lit/directives/class-map";
|
||||
import { storage } from "../../../../common/decorators/storage";
|
||||
import { dynamicElement } from "../../../../common/dom/dynamic-element-directive";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { computeDomain } from "../../../../common/entity/compute_domain";
|
||||
import { domainIconWithoutDefault } from "../../../../common/entity/domain_icon";
|
||||
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
|
||||
import { handleStructError } from "../../../../common/structs/handle-errors";
|
||||
import "../../../../components/ha-alert";
|
||||
@ -190,7 +192,13 @@ export default class HaAutomationActionRow extends LitElement {
|
||||
<h3 slot="header">
|
||||
<ha-svg-icon
|
||||
class="action-icon"
|
||||
.path=${ACTION_ICONS[type!]}
|
||||
.path=${type === "service" &&
|
||||
"service" in this.action &&
|
||||
this.action.service
|
||||
? domainIconWithoutDefault(
|
||||
computeDomain(this.action.service as string)
|
||||
) || ACTION_ICONS[type!]
|
||||
: ACTION_ICONS[type!]}
|
||||
></ha-svg-icon>
|
||||
${capitalizeFirstLetter(
|
||||
describeAction(this.hass, this._entityReg, this.action)
|
||||
|
@ -191,6 +191,7 @@ export default class HaAutomationAction extends LitElement {
|
||||
} else if (isService(action)) {
|
||||
actions = this.actions.concat({
|
||||
service: getService(action),
|
||||
metadata: {},
|
||||
});
|
||||
} else {
|
||||
const elClass = customElements.get(
|
||||
|
@ -2914,6 +2914,7 @@
|
||||
"description": {
|
||||
"service_based_on_template": "Call a service based on a template on {targets}",
|
||||
"service_based_on_name": "Call a service ''{name}'' on {targets}",
|
||||
"service_name": "''{name}'' on {targets}",
|
||||
"service": "Call a service",
|
||||
"target_template": "templated {name}",
|
||||
"target_unknown_entity": "unknown entity",
|
||||
|
Loading…
x
Reference in New Issue
Block a user