mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Fix key type errors for blueprints
This commit is contained in:
parent
e241b20378
commit
b444d0030f
@ -5,7 +5,12 @@ import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { stopPropagation } from "../common/dom/stop_propagation";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import { Blueprint, Blueprints, fetchBlueprints } from "../data/blueprint";
|
||||
import {
|
||||
Blueprint,
|
||||
BlueprintDomain,
|
||||
Blueprints,
|
||||
fetchBlueprints,
|
||||
} from "../data/blueprint";
|
||||
import { HomeAssistant } from "../types";
|
||||
import "./ha-select";
|
||||
|
||||
@ -17,7 +22,7 @@ class HaBluePrintPicker extends LitElement {
|
||||
|
||||
@property() public value = "";
|
||||
|
||||
@property() public domain = "automation";
|
||||
@property() public domain: BlueprintDomain = "automation";
|
||||
|
||||
@property() public blueprints?: Blueprints;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { HomeAssistant } from "../types";
|
||||
import { Selector } from "./selector";
|
||||
|
||||
export type BlueprintDomain = "automation" | "script";
|
||||
|
||||
export type Blueprints = Record<string, BlueprintOrError>;
|
||||
|
||||
export type BlueprintOrError = Blueprint | { error: string };
|
||||
@ -9,7 +11,7 @@ export interface Blueprint {
|
||||
}
|
||||
|
||||
export interface BlueprintMetaData {
|
||||
domain: string;
|
||||
domain: BlueprintDomain;
|
||||
name: string;
|
||||
input?: Record<string, BlueprintInput | null>;
|
||||
description?: string;
|
||||
@ -30,7 +32,7 @@ export interface BlueprintImportResult {
|
||||
validation_errors: string[] | null;
|
||||
}
|
||||
|
||||
export const fetchBlueprints = (hass: HomeAssistant, domain: string) =>
|
||||
export const fetchBlueprints = (hass: HomeAssistant, domain: BlueprintDomain) =>
|
||||
hass.callWS<Blueprints>({ type: "blueprint/list", domain });
|
||||
|
||||
export const importBlueprint = (hass: HomeAssistant, url: string) =>
|
||||
@ -38,7 +40,7 @@ export const importBlueprint = (hass: HomeAssistant, url: string) =>
|
||||
|
||||
export const saveBlueprint = (
|
||||
hass: HomeAssistant,
|
||||
domain: string,
|
||||
domain: BlueprintDomain,
|
||||
path: string,
|
||||
yaml: string,
|
||||
source_url?: string
|
||||
@ -53,7 +55,7 @@ export const saveBlueprint = (
|
||||
|
||||
export const deleteBlueprint = (
|
||||
hass: HomeAssistant,
|
||||
domain: string,
|
||||
domain: BlueprintDomain,
|
||||
path: string
|
||||
) =>
|
||||
hass.callWS<BlueprintImportResult>({
|
||||
|
@ -25,6 +25,7 @@ import "../../../components/ha-icon-button";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import { showAutomationEditor } from "../../../data/automation";
|
||||
import {
|
||||
BlueprintDomain,
|
||||
BlueprintMetaData,
|
||||
Blueprints,
|
||||
deleteBlueprint,
|
||||
@ -124,7 +125,7 @@ class HaBlueprintOverview extends LitElement {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.blueprint.overview.headers.type"
|
||||
),
|
||||
template: (type: string) =>
|
||||
template: (type: BlueprintDomain) =>
|
||||
html`${this.hass.localize(
|
||||
`ui.panel.config.blueprint.overview.types.${type}`
|
||||
)}`,
|
||||
@ -148,7 +149,7 @@ class HaBlueprintOverview extends LitElement {
|
||||
title: "",
|
||||
width: narrow ? undefined : "20%",
|
||||
type: narrow ? "icon-button" : undefined,
|
||||
template: (_, blueprint: any) =>
|
||||
template: (_, blueprint: BlueprintMetaDataPath) =>
|
||||
blueprint.error
|
||||
? ""
|
||||
: narrow
|
||||
|
@ -2200,6 +2200,7 @@
|
||||
"confirm_delete_header": "Delete this blueprint?",
|
||||
"confirm_delete_text": "Are you sure you want to delete this blueprint?",
|
||||
"add_blueprint": "Import blueprint",
|
||||
"no_blueprints": "[%key:ui::panel::config::automation::editor::blueprint::no_blueprints%]",
|
||||
"create_automation": "Create automation",
|
||||
"create_script": "Create script",
|
||||
"delete_blueprint": "Delete blueprint",
|
||||
|
Loading…
x
Reference in New Issue
Block a user