mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Translated developer tools state page (#4039)
* Translated developer tools state page * Fixed merge error by updating used icon in developer-tools-state.js
This commit is contained in:
parent
67d8d48855
commit
e2ac842690
@ -10,12 +10,14 @@ import "../../../components/entity/ha-entity-picker";
|
||||
import "../../../components/ha-code-editor";
|
||||
import "../../../resources/ha-style";
|
||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||
|
||||
const ERROR_SENTINEL = {};
|
||||
/*
|
||||
* @appliesMixin EventsMixin
|
||||
* @appliesMixin LocalizeMixin
|
||||
*/
|
||||
class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
static get template() {
|
||||
return html`
|
||||
<style include="ha-style">
|
||||
@ -70,8 +72,8 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
|
||||
<div class="inputs">
|
||||
<p>
|
||||
Set the representation of a device within Home Assistant.<br />
|
||||
This will not communicate with the actual device.
|
||||
[[localize('ui.panel.developer-tools.tabs.states.description1')]]<br />
|
||||
[[localize('ui.panel.developer-tools.tabs.states.description2')]]
|
||||
</p>
|
||||
|
||||
<ha-entity-picker
|
||||
@ -82,7 +84,7 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
allow-custom-entity
|
||||
></ha-entity-picker>
|
||||
<paper-input
|
||||
label="State"
|
||||
label="[[localize('ui.panel.developer-tools.tabs.states.state')]]"
|
||||
required
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
@ -91,7 +93,9 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
value="{{_state}}"
|
||||
class="state-input"
|
||||
></paper-input>
|
||||
<p>State attributes (YAML, optional)</p>
|
||||
<p>
|
||||
[[localize('ui.panel.developer-tools.tabs.states.state_attributes')]]
|
||||
</p>
|
||||
<ha-code-editor
|
||||
mode="yaml"
|
||||
value="[[_stateAttributes]]"
|
||||
@ -99,45 +103,49 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
on-value-changed="_yamlChanged"
|
||||
></ha-code-editor>
|
||||
<mwc-button on-click="handleSetState" disabled="[[!validJSON]]" raised
|
||||
>Set State</mwc-button
|
||||
>[[localize('ui.panel.developer-tools.tabs.states.set_state')]]</mwc-button
|
||||
>
|
||||
</div>
|
||||
|
||||
<h1>Current entities</h1>
|
||||
<h1>
|
||||
[[localize('ui.panel.developer-tools.tabs.states.current_entities')]]
|
||||
</h1>
|
||||
<table class="entities">
|
||||
<tr>
|
||||
<th>Entity</th>
|
||||
<th>State</th>
|
||||
<th>[[localize('ui.panel.developer-tools.tabs.states.entity')]]</th>
|
||||
<th>[[localize('ui.panel.developer-tools.tabs.states.state')]]</th>
|
||||
<th hidden$="[[narrow]]">
|
||||
Attributes
|
||||
[[localize('ui.panel.developer-tools.tabs.states.attributes')]]
|
||||
<paper-checkbox checked="{{_showAttributes}}"></paper-checkbox>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<paper-input
|
||||
label="Filter entities"
|
||||
label="[[localize('ui.panel.developer-tools.tabs.states.filter_entities')]]"
|
||||
type="search"
|
||||
value="{{_entityFilter}}"
|
||||
></paper-input>
|
||||
</th>
|
||||
<th>
|
||||
<paper-input
|
||||
label="Filter states"
|
||||
label="[[localize('ui.panel.developer-tools.tabs.states.filter_states')]]"
|
||||
type="search"
|
||||
value="{{_stateFilter}}"
|
||||
></paper-input>
|
||||
</th>
|
||||
<th hidden$="[[!computeShowAttributes(narrow, _showAttributes)]]">
|
||||
<paper-input
|
||||
label="Filter attributes"
|
||||
label="[[localize('ui.panel.developer-tools.tabs.states.filter_attributes')]]"
|
||||
type="search"
|
||||
value="{{_attributeFilter}}"
|
||||
></paper-input>
|
||||
</th>
|
||||
</tr>
|
||||
<tr hidden$="[[!computeShowEntitiesPlaceholder(_entities)]]">
|
||||
<td colspan="3">No entities</td>
|
||||
<td colspan="3">
|
||||
[[localize('ui.panel.developer-tools.tabs.states.no_entities')]]
|
||||
</td>
|
||||
</tr>
|
||||
<template is="dom-repeat" items="[[_entities]]" as="entity">
|
||||
<tr>
|
||||
@ -145,8 +153,8 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
<paper-icon-button
|
||||
on-click="entityMoreInfo"
|
||||
icon="hass:information-outline"
|
||||
alt="More Info"
|
||||
title="More Info"
|
||||
alt="[[localize('ui.panel.developer-tools.tabs.states.more_info')]]"
|
||||
title="[[localize('ui.panel.developer-tools.tabs.states.more_info')]]"
|
||||
>
|
||||
</paper-icon-button>
|
||||
<a href="#" on-click="entitySelected">[[entity.entity_id]]</a>
|
||||
@ -244,7 +252,11 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
||||
|
||||
handleSetState() {
|
||||
if (!this._entityId) {
|
||||
alert("Entity is a mandatory field");
|
||||
alert(
|
||||
this.hass.localize(
|
||||
"ui.panel.developer-tools.tabs.states.alert_entity_field"
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.hass.callApi("POST", "states/" + this._entityId, {
|
||||
|
@ -1816,7 +1816,21 @@
|
||||
"title": "Services"
|
||||
},
|
||||
"states": {
|
||||
"title": "States"
|
||||
"title": "States",
|
||||
"description1": "Set the representation of a device within Home Assistant.",
|
||||
"description2": "This will not communicate with the actual device.",
|
||||
"entity": "Entity",
|
||||
"state": "State",
|
||||
"attributes": "Attributes",
|
||||
"state_attributes": "State attributes (YAML, optional)",
|
||||
"set_state": "Set State",
|
||||
"current_entities": "Current entities",
|
||||
"filter_entities": "Filter entities",
|
||||
"filter_states": "Filter states",
|
||||
"filter_attributes": "Filter attributes",
|
||||
"no_entities": "No entities",
|
||||
"more_info": "More Info",
|
||||
"alert_entity_field": "Entity is a mandatory field"
|
||||
},
|
||||
"templates": {
|
||||
"title": "Template"
|
||||
|
Loading…
x
Reference in New Issue
Block a user