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