Blueprints: Added missing labels & tooltips, optimize input display + text tweaks (#7748)

This commit is contained in:
Philip Allgaier 2020-11-26 18:14:57 +01:00 committed by GitHub
parent 5cb2743780
commit e3293837a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 80 additions and 40 deletions

View File

@ -132,7 +132,7 @@ class HaAutomationPicker extends LitElement {
: "hass:pencil-off"} : "hass:pencil-off"}
.disabled=${!automation.attributes.id} .disabled=${!automation.attributes.id}
title="${this.hass.localize( title="${this.hass.localize(
"ui.panel.config.automation.picker.show_info_automation" "ui.panel.config.automation.picker.edit_automation"
)}" )}"
></ha-icon-button> ></ha-icon-button>
</a> </a>

View File

@ -71,7 +71,7 @@ class DialogImportBlueprint extends LitElement {
html`<b>${this._result.blueprint.metadata.name}</b>`, html`<b>${this._result.blueprint.metadata.name}</b>`,
"domain", "domain",
this._result.blueprint.metadata.domain this._result.blueprint.metadata.domain
)} )} <br /><br />
${this._result.validation_errors ${this._result.validation_errors
? html` ? html`
<p class="error"> <p class="error">
@ -89,7 +89,9 @@ class DialogImportBlueprint extends LitElement {
<paper-input <paper-input
id="input" id="input"
.value=${this._result.suggested_filename} .value=${this._result.suggested_filename}
label="Filename" .label=${this.hass.localize(
"ui.panel.config.blueprint.add.file_name"
)}
></paper-input> ></paper-input>
`} `}
<pre>${this._result.raw_data}</pre>` <pre>${this._result.raw_data}</pre>`

View File

@ -1,6 +1,6 @@
import "@material/mwc-fab"; import "@material/mwc-fab";
import "@material/mwc-icon-button"; import "@material/mwc-icon-button";
import { mdiPlus, mdiHelpCircle, mdiDelete } from "@mdi/js"; import { mdiPlus, mdiHelpCircle, mdiDelete, mdiRobot } from "@mdi/js";
import "@polymer/paper-tooltip/paper-tooltip"; import "@polymer/paper-tooltip/paper-tooltip";
import { import {
CSSResult, CSSResult,
@ -80,7 +80,7 @@ class HaBlueprintOverview extends LitElement {
}); });
private _columns = memoizeOne( private _columns = memoizeOne(
(_language): DataTableColumnContainer => { (narrow, _language): DataTableColumnContainer => {
const columns: DataTableColumnContainer = { const columns: DataTableColumnContainer = {
name: { name: {
title: this.hass.localize( title: this.hass.localize(
@ -92,19 +92,15 @@ class HaBlueprintOverview extends LitElement {
grows: true, grows: true,
}, },
}; };
columns.domain = {
title: "Domain", if (narrow) {
sortable: true, columns.name.template = (name, entity: any) => {
filterable: true, return html`
direction: "asc", ${name}<br />
width: "20%", <div class="secondary">
}; ${entity.path}
columns.path = { </div>
title: "Path", `;
sortable: true,
filterable: true,
direction: "asc",
width: "20%",
}; };
columns.create = { columns.create = {
title: "", title: "",
@ -112,24 +108,61 @@ class HaBlueprintOverview extends LitElement {
template: (_, blueprint: any) => template: (_, blueprint: any) =>
blueprint.error blueprint.error
? "" ? ""
: html`<mwc-icon-button : html` <mwc-icon-button
.blueprint=${blueprint} .blueprint=${blueprint}
.label=${this.hass.localize(
"ui.panel.config.blueprint.overview.use_blueprint"
)}
title=${this.hass.localize(
"ui.panel.config.blueprint.overview.use_blueprint"
)}
@click=${(ev) => this._createNew(ev)} @click=${(ev) => this._createNew(ev)}
><ha-svg-icon .path=${mdiPlus}></ha-svg-icon ><ha-svg-icon .path=${mdiRobot}></ha-svg-icon
></mwc-icon-button>`, ></mwc-icon-button>`,
}; };
} else {
columns.path = {
title: this.hass.localize(
"ui.panel.config.blueprint.overview.headers.file_name"
),
sortable: true,
filterable: true,
direction: "asc",
width: "25%",
};
columns.create = {
title: "",
width: "180px",
template: (_, blueprint: any) =>
blueprint.error
? ""
: html` <mwc-button
.blueprint=${blueprint}
@click=${(ev) => this._createNew(ev)}
>
${this.hass.localize(
"ui.panel.config.blueprint.overview.use_blueprint"
)}
</mwc-button>`,
};
}
columns.delete = { columns.delete = {
title: "", title: "",
type: "icon-button", type: "icon-button",
template: (_, blueprint: any) => template: (_, blueprint: any) =>
blueprint.error blueprint.error
? "" ? ""
: html`<mwc-icon-button : html` <mwc-icon-button
.blueprint=${blueprint} .blueprint=${blueprint}
.label=${this.hass.localize(
"ui.panel.config.blueprint.overview.delete_blueprint"
)}
@click=${(ev) => this._delete(ev)} @click=${(ev) => this._delete(ev)}
><ha-svg-icon .path=${mdiDelete}></ha-svg-icon ><ha-svg-icon .path=${mdiDelete}></ha-svg-icon
></mwc-icon-button>`, ></mwc-icon-button>`,
}; };
return columns; return columns;
} }
); );
@ -142,7 +175,7 @@ class HaBlueprintOverview extends LitElement {
back-path="/config" back-path="/config"
.route=${this.route} .route=${this.route}
.tabs=${configSections.automation} .tabs=${configSections.automation}
.columns=${this._columns(this.hass.language)} .columns=${this._columns(this.narrow, this.hass.language)}
.data=${this._processedBlueprints(this.blueprints)} .data=${this._processedBlueprints(this.blueprints)}
id="entity_id" id="entity_id"
.noDataText=${this.hass.localize( .noDataText=${this.hass.localize(

View File

@ -1129,7 +1129,7 @@
}, },
"editor": { "editor": {
"enable_disable": "Enable/Disable automation", "enable_disable": "Enable/Disable automation",
"introduction": "Use automations to bring your home alive.", "introduction": "Use automations to bring your home to live.",
"default_name": "New Automation", "default_name": "New Automation",
"load_error_not_editable": "Only automations in automations.yaml are editable.", "load_error_not_editable": "Only automations in automations.yaml are editable.",
"load_error_unknown": "Error loading automation ({err_no}).", "load_error_unknown": "Error loading automation ({err_no}).",
@ -1447,15 +1447,19 @@
"introduction": "The blueprint editor allows you to create and edit blueprints.", "introduction": "The blueprint editor allows you to create and edit blueprints.",
"learn_more": "Learn more about blueprints", "learn_more": "Learn more about blueprints",
"headers": { "headers": {
"name": "Name" "name": "Name",
"domain": "Domain",
"file_name": "File name"
}, },
"confirm_delete_header": "Delete this blueprint?", "confirm_delete_header": "Delete this blueprint?",
"confirm_delete_text": "Are you sure you want to delete this blueprint", "confirm_delete_text": "Are you sure you want to delete this blueprint?",
"add_blueprint": "Add blueprint" "add_blueprint": "Add blueprint",
"use_blueprint": "Create automation",
"delete_blueprint": "Delete blueprint"
}, },
"add": { "add": {
"header": "Add new blueprint", "header": "Add new blueprint",
"import_header": "Import {name} ({domain})", "import_header": "Import \"{name}\" (type: {domain})",
"import_introduction": "You can import blueprints of other users from Github and the community forums. Enter the URL of the blueprint below.", "import_introduction": "You can import blueprints of other users from Github and the community forums. Enter the URL of the blueprint below.",
"url": "URL of the blueprint", "url": "URL of the blueprint",
"importing": "Importing blueprint...", "importing": "Importing blueprint...",
@ -1463,7 +1467,8 @@
"saving": "Saving blueprint...", "saving": "Saving blueprint...",
"save_btn": "Save blueprint", "save_btn": "Save blueprint",
"error_no_url": "Please enter the URL of the blueprint.", "error_no_url": "Please enter the URL of the blueprint.",
"unsupported_blueprint": "This blueprint is not supported" "unsupported_blueprint": "This blueprint is not supported",
"file_name": "Local blueprint file name"
} }
}, },
"script": { "script": {
@ -1537,7 +1542,7 @@
} }
}, },
"editor": { "editor": {
"introduction": "Use scenes to bring your home alive.", "introduction": "Use scenes to bring your home to live.",
"default_name": "New Scene", "default_name": "New Scene",
"load_error_not_editable": "Only scenes in scenes.yaml are editable.", "load_error_not_editable": "Only scenes in scenes.yaml are editable.",
"load_error_unknown": "Error loading scene ({err_no}).", "load_error_unknown": "Error loading scene ({err_no}).",