Add documentation link to "customize" dialog (#7321)

This commit is contained in:
Philip Allgaier 2020-10-12 22:09:34 +02:00 committed by GitHub
parent 7f6880f40e
commit 504055f331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 8 deletions

View File

@ -11,6 +11,7 @@ import "../ha-config-section";
import "../ha-entity-config"; import "../ha-entity-config";
import { configSections } from "../ha-panel-config"; import { configSections } from "../ha-panel-config";
import "./ha-form-customize"; import "./ha-form-customize";
import { documentationUrl } from "../../../util/documentation-url";
/* /*
* @appliesMixin LocalizeMixin * @appliesMixin LocalizeMixin
@ -34,6 +35,14 @@ class HaConfigCustomize extends LocalizeMixin(PolymerElement) {
</span> </span>
<span slot="introduction"> <span slot="introduction">
[[localize('ui.panel.config.customize.picker.introduction')]] [[localize('ui.panel.config.customize.picker.introduction')]]
<br />
<a
href="[[_computeDocumentationUrl(hass)]]"
target="_blank"
rel="noreferrer"
>
[[localize("ui.panel.config.customize.picker.documentation")]]
</a>
</span> </span>
<ha-entity-config <ha-entity-config
hass="[[hass]]" hass="[[hass]]"
@ -91,5 +100,12 @@ class HaConfigCustomize extends LocalizeMixin(PolymerElement) {
.map((key) => hass.states[key]) .map((key) => hass.states[key])
.sort(sortStatesByName); .sort(sortStatesByName);
} }
_computeDocumentationUrl(hass) {
return documentationUrl(
hass,
"/docs/configuration/customizing-devices/#customization-using-the-ui"
);
}
} }
customElements.define("ha-config-customize", HaConfigCustomize); customElements.define("ha-config-customize", HaConfigCustomize);

View File

@ -40,35 +40,35 @@ class HaFormCustomize extends LocalizeMixin(PolymerElement) {
</div> </div>
</template> </template>
<template is="dom-if" if="[[hasLocalAttributes]]"> <template is="dom-if" if="[[hasLocalAttributes]]">
<h4 class="attributes-text"> <p class="attributes-text">
[[localize('ui.panel.config.customize.attributes_customize')]]<br /> [[localize('ui.panel.config.customize.attributes_customize')]]<br />
</h4> </p>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{localAttributes}}" attributes="{{localAttributes}}"
></ha-form-customize-attributes> ></ha-form-customize-attributes>
</template> </template>
<template is="dom-if" if="[[hasGlobalAttributes]]"> <template is="dom-if" if="[[hasGlobalAttributes]]">
<h4 class="attributes-text"> <p class="attributes-text">
[[localize('ui.panel.config.customize.attributes_outside')]]<br /> [[localize('ui.panel.config.customize.attributes_outside')]]<br />
[[localize('ui.panel.config.customize.different_include')]] [[localize('ui.panel.config.customize.different_include')]]
</h4> </p>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{globalAttributes}}" attributes="{{globalAttributes}}"
></ha-form-customize-attributes> ></ha-form-customize-attributes>
</template> </template>
<template is="dom-if" if="[[hasExistingAttributes]]"> <template is="dom-if" if="[[hasExistingAttributes]]">
<h4 class="attributes-text"> <p class="attributes-text">
[[localize('ui.panel.config.customize.attributes_set')]]<br /> [[localize('ui.panel.config.customize.attributes_set')]]<br />
[[localize('ui.panel.config.customize.attributes_override')]] [[localize('ui.panel.config.customize.attributes_override')]]
</h4> </p>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{existingAttributes}}" attributes="{{existingAttributes}}"
></ha-form-customize-attributes> ></ha-form-customize-attributes>
</template> </template>
<template is="dom-if" if="[[hasNewAttributes]]"> <template is="dom-if" if="[[hasNewAttributes]]">
<h4 class="attributes-text"> <p class="attributes-text">
[[localize('ui.panel.config.customize.attributes_not_set')]] [[localize('ui.panel.config.customize.attributes_not_set')]]
</h4> </p>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{newAttributes}}" attributes="{{newAttributes}}"
></ha-form-customize-attributes> ></ha-form-customize-attributes>

View File

@ -998,6 +998,7 @@
"picker": { "picker": {
"header": "Customizations", "header": "Customizations",
"introduction": "Tweak per-entity attributes. Added/edited customizations will take effect immediately. Removed customizations will take effect when the entity is updated.", "introduction": "Tweak per-entity attributes. Added/edited customizations will take effect immediately. Removed customizations will take effect when the entity is updated.",
"documentation": "Customization documentation",
"entity": "Entity" "entity": "Entity"
}, },
"warning": { "warning": {