mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 05:46:35 +00:00
Allow overriding blueprints (#18718)
This commit is contained in:
parent
6dafaac021
commit
0432cc95fc
@ -29,6 +29,7 @@ export interface BlueprintInput {
|
||||
export interface BlueprintImportResult {
|
||||
suggested_filename: string;
|
||||
raw_data: string;
|
||||
exists?: boolean;
|
||||
blueprint: Blueprint;
|
||||
validation_errors: string[] | null;
|
||||
}
|
||||
@ -44,7 +45,8 @@ export const saveBlueprint = (
|
||||
domain: BlueprintDomain,
|
||||
path: string,
|
||||
yaml: string,
|
||||
source_url?: string
|
||||
source_url?: string,
|
||||
allow_override?: boolean
|
||||
) =>
|
||||
hass.callWS({
|
||||
type: "blueprint/save",
|
||||
@ -52,6 +54,7 @@ export const saveBlueprint = (
|
||||
path,
|
||||
yaml,
|
||||
source_url,
|
||||
allow_override,
|
||||
});
|
||||
|
||||
export const deleteBlueprint = (
|
||||
|
@ -7,6 +7,7 @@ import "../../../components/ha-circular-progress";
|
||||
import { createCloseHeading } from "../../../components/ha-dialog";
|
||||
import "../../../components/ha-expansion-panel";
|
||||
import "../../../components/ha-markdown";
|
||||
import "../../../components/ha-alert";
|
||||
import "../../../components/ha-textfield";
|
||||
import type { HaTextField } from "../../../components/ha-textfield";
|
||||
import {
|
||||
@ -105,7 +106,21 @@ class DialogImportBlueprint extends LitElement {
|
||||
)}
|
||||
>
|
||||
<pre>${this._result.raw_data}</pre>
|
||||
</ha-expansion-panel>`
|
||||
</ha-expansion-panel>
|
||||
${this._result?.exists
|
||||
? html`
|
||||
<ha-alert
|
||||
alert-type="warning"
|
||||
.title=${this.hass.localize(
|
||||
"ui.panel.config.blueprint.add.override_title"
|
||||
)}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.blueprint.add.override_description"
|
||||
)}
|
||||
</ha-alert>
|
||||
`
|
||||
: nothing} `
|
||||
: html`
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
@ -175,7 +190,13 @@ class DialogImportBlueprint extends LitElement {
|
||||
)}
|
||||
></ha-circular-progress>`
|
||||
: ""}
|
||||
${this.hass.localize("ui.panel.config.blueprint.add.save_btn")}
|
||||
${this._result.exists
|
||||
? this.hass.localize(
|
||||
"ui.panel.config.blueprint.add.save_btn_override"
|
||||
)
|
||||
: this.hass.localize(
|
||||
"ui.panel.config.blueprint.add.save_btn"
|
||||
)}
|
||||
</mwc-button>
|
||||
`}
|
||||
</ha-dialog>
|
||||
@ -214,7 +235,8 @@ class DialogImportBlueprint extends LitElement {
|
||||
this._result!.blueprint.metadata.domain,
|
||||
filename,
|
||||
this._result!.raw_data,
|
||||
this._result!.blueprint.metadata.source_url
|
||||
this._result!.blueprint.metadata.source_url,
|
||||
this._result!.exists
|
||||
);
|
||||
this._params.importedCallback();
|
||||
this.closeDialog();
|
||||
|
@ -2961,6 +2961,9 @@
|
||||
"import_btn": "Preview",
|
||||
"saving": "Importing blueprint…",
|
||||
"save_btn": "Import blueprint",
|
||||
"save_btn_override": "Override blueprint",
|
||||
"override_title": "This blueprint already exists",
|
||||
"override_description": "Importing it will override the existing blueprint. If the updated blueprint is not compatible, it can break your automations. Automations will have to be adjusted manually.",
|
||||
"error_no_url": "Please enter the blueprint address.",
|
||||
"unsupported_blueprint": "This blueprint is not supported",
|
||||
"file_name": "Blueprint Path"
|
||||
|
Loading…
x
Reference in New Issue
Block a user