mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
ha-dialog-import-blueprint: add "enlarge" (#24734)
* add enlarge * removed unused "createCloseHeading" * restore deleted "import" line * import ha-dialog-header
This commit is contained in:
parent
4c8b7a30f4
commit
1519e1b90c
@ -1,14 +1,15 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { mdiOpenInNew } from "@mdi/js";
|
import { mdiOpenInNew, mdiClose } from "@mdi/js";
|
||||||
import { css, html, LitElement, nothing } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import "../../../components/ha-spinner";
|
import "../../../components/ha-spinner";
|
||||||
import { createCloseHeading } from "../../../components/ha-dialog";
|
|
||||||
import "../../../components/ha-expansion-panel";
|
import "../../../components/ha-expansion-panel";
|
||||||
import "../../../components/ha-markdown";
|
import "../../../components/ha-markdown";
|
||||||
import "../../../components/ha-alert";
|
import "../../../components/ha-alert";
|
||||||
import "../../../components/ha-textfield";
|
import "../../../components/ha-textfield";
|
||||||
|
import "../../../components/ha-dialog";
|
||||||
|
import "../../../components/ha-dialog-header";
|
||||||
import type { HaTextField } from "../../../components/ha-textfield";
|
import type { HaTextField } from "../../../components/ha-textfield";
|
||||||
import type { BlueprintImportResult } from "../../../data/blueprint";
|
import type { BlueprintImportResult } from "../../../data/blueprint";
|
||||||
import { importBlueprint, saveBlueprint } from "../../../data/blueprint";
|
import { importBlueprint, saveBlueprint } from "../../../data/blueprint";
|
||||||
@ -19,6 +20,8 @@ import type { HomeAssistant } from "../../../types";
|
|||||||
class DialogImportBlueprint extends LitElement {
|
class DialogImportBlueprint extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean, reflect: true }) public large = false;
|
||||||
|
|
||||||
@state() private _params?;
|
@state() private _params?;
|
||||||
|
|
||||||
@state() private _importing = false;
|
@state() private _importing = false;
|
||||||
@ -37,6 +40,7 @@ class DialogImportBlueprint extends LitElement {
|
|||||||
this._params = params;
|
this._params = params;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._url = this._params.url;
|
this._url = this._params.url;
|
||||||
|
this.large = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog(): void {
|
||||||
@ -51,15 +55,18 @@ class DialogImportBlueprint extends LitElement {
|
|||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
const heading = this.hass.localize("ui.panel.config.blueprint.add.header");
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog open .heading=${heading} @closed=${this.closeDialog}>
|
||||||
open
|
<ha-dialog-header slot="heading">
|
||||||
@closed=${this.closeDialog}
|
<ha-icon-button
|
||||||
.heading=${createCloseHeading(
|
slot="navigationIcon"
|
||||||
this.hass,
|
dialogAction="cancel"
|
||||||
this.hass.localize("ui.panel.config.blueprint.add.header")
|
.label=${this.hass.localize("ui.common.close")}
|
||||||
)}
|
.path=${mdiClose}
|
||||||
>
|
></ha-icon-button>
|
||||||
|
<span slot="title" @click=${this._enlarge}> ${heading} </span>
|
||||||
|
</ha-dialog-header>
|
||||||
<div>
|
<div>
|
||||||
${this._error ? html` <div class="error">${this._error}</div> ` : ""}
|
${this._error ? html` <div class="error">${this._error}</div> ` : ""}
|
||||||
${this._result
|
${this._result
|
||||||
@ -198,6 +205,10 @@ class DialogImportBlueprint extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _enlarge() {
|
||||||
|
this.large = !this.large;
|
||||||
|
}
|
||||||
|
|
||||||
private async _import() {
|
private async _import() {
|
||||||
this._url = undefined;
|
this._url = undefined;
|
||||||
this._importing = true;
|
this._importing = true;
|
||||||
@ -259,6 +270,10 @@ class DialogImportBlueprint extends LitElement {
|
|||||||
a ha-svg-icon {
|
a ha-svg-icon {
|
||||||
--mdc-icon-size: 16px;
|
--mdc-icon-size: 16px;
|
||||||
}
|
}
|
||||||
|
:host([large]) ha-dialog {
|
||||||
|
--mdc-dialog-min-width: 90vw;
|
||||||
|
--mdc-dialog-max-width: 90vw;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user