Update import blueprint dialog (#13840)

This commit is contained in:
Paul Bottein 2022-09-22 15:24:15 +02:00 committed by GitHub
parent db8bc9d34a
commit 5422fda990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 41 deletions

View File

@ -1,4 +1,5 @@
import "@material/mwc-button";
import { mdiOpenInNew } from "@mdi/js";
import { css, html, LitElement, TemplateResult } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { fireEvent } from "../../../common/dom/fire_event";
@ -105,28 +106,42 @@ class DialogImportBlueprint extends LitElement {
>
<pre>${this._result.raw_data}</pre>
</ha-expansion-panel>`
: html`${this.hass.localize(
"ui.panel.config.blueprint.add.import_introduction_link",
"community_link",
html`<a
: html`
<p>
${this.hass.localize(
"ui.panel.config.blueprint.add.import_introduction"
)}
</p>
<a
href="https://www.home-assistant.io/get-blueprints"
target="_blank"
rel="noreferrer noopener"
>${this.hass.localize(
>
${this.hass.localize(
"ui.panel.config.blueprint.add.community_forums"
)}</a
>`
)}<ha-textfield
)}
<ha-svg-icon .path=${mdiOpenInNew}></ha-svg-icon>
</a>
<ha-textfield
id="input"
.label=${this.hass.localize(
"ui.panel.config.blueprint.add.url"
)}
.value=${this._url || ""}
dialogInitialFocus
></ha-textfield>`}
></ha-textfield>
`}
</div>
<mwc-button
slot="primaryAction"
@click=${this.closeDialog}
.disabled=${this._saving}
>
${this.hass.localize("ui.common.cancel")}
</mwc-button>
${!this._result
? html`<mwc-button
? html`
<mwc-button
slot="primaryAction"
@click=${this._import}
.disabled=${this._importing}
@ -140,15 +155,12 @@ class DialogImportBlueprint extends LitElement {
)}
></ha-circular-progress>`
: ""}
${this.hass.localize("ui.panel.config.blueprint.add.import_btn")}
</mwc-button>`
: html`<mwc-button
slot="secondaryAction"
@click=${this.closeDialog}
.disabled=${this._saving}
>
${this.hass.localize("ui.common.cancel")}
${this.hass.localize(
"ui.panel.config.blueprint.add.import_btn"
)}
</mwc-button>
`
: html`
<mwc-button
slot="primaryAction"
@click=${this._save}
@ -164,7 +176,8 @@ class DialogImportBlueprint extends LitElement {
></ha-circular-progress>`
: ""}
${this.hass.localize("ui.panel.config.blueprint.add.save_btn")}
</mwc-button>`}
</mwc-button>
`}
</ha-dialog>
`;
}
@ -215,9 +228,19 @@ class DialogImportBlueprint extends LitElement {
static styles = [
haStyleDialog,
css`
p {
margin-top: 0;
margin-bottom: 8px;
}
ha-textfield {
display: block;
margin-top: 8px;
margin-top: 24px;
}
a {
text-decoration: none;
}
a ha-svg-icon {
--mdc-icon-size: 16px;
}
`,
];

View File

@ -2258,15 +2258,15 @@
"add": {
"header": "Import a blueprint",
"import_header": "Blueprint ''{name}''",
"import_introduction_link": "You can import blueprints of other users from Github and the {community_link}. Enter the URL of the blueprint below.",
"community_forums": "community forums",
"url": "URL of the blueprint",
"import_introduction": "Import blueprints of other users from GitHub and the community forums by pasting the address below.",
"community_forums": "View blueprints on the community forums",
"url": "Blueprint address",
"raw_blueprint": "Blueprint content",
"importing": "Loading blueprint…",
"import_btn": "Preview blueprint",
"import_btn": "Preview",
"saving": "Importing blueprint…",
"save_btn": "Import blueprint",
"error_no_url": "Please enter the URL of the blueprint.",
"error_no_url": "Please enter the blueprint address.",
"unsupported_blueprint": "This blueprint is not supported",
"file_name": "Blueprint Path"
}