mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Don't check for entity id format for card editors (#16081)
Don't check for entity id format for cards
This commit is contained in:
parent
81ebdf1448
commit
ff715c6cb7
@ -1,17 +0,0 @@
|
||||
import { refine, string } from "superstruct";
|
||||
|
||||
const isEntityId = (value: string): boolean => value.includes(".");
|
||||
|
||||
export const entityId = () =>
|
||||
refine(string(), "entity ID (domain.entity)", isEntityId);
|
||||
|
||||
const isEntityIdOrAll = (value: string): boolean => {
|
||||
if (value === "all") {
|
||||
return true;
|
||||
}
|
||||
|
||||
return isEntityId(value);
|
||||
};
|
||||
|
||||
export const entityIdOrAll = () =>
|
||||
refine(string(), "entity ID (domain.entity or all)", isEntityIdOrAll);
|
@ -3,7 +3,6 @@ import { customElement, property, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { array, assert, assign, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import type { LocalizeFunc } from "../../../../common/translations/localize";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
@ -15,7 +14,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
states: optional(array()),
|
||||
theme: optional(string()),
|
||||
|
@ -2,7 +2,6 @@ import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -15,7 +14,7 @@ import { configElementStyle } from "./config-elements-style";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
show_name: optional(boolean()),
|
||||
icon: optional(string()),
|
||||
|
@ -18,7 +18,6 @@ import {
|
||||
} from "superstruct";
|
||||
import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event";
|
||||
import { customType } from "../../../../common/structs/is-custom-type";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import { computeRTLDirection } from "../../../../common/util/compute_rtl";
|
||||
import "../../../../components/entity/state-badge";
|
||||
import "../../../../components/ha-card";
|
||||
@ -184,7 +183,7 @@ const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
title: optional(union([string(), boolean()])),
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
theme: optional(string()),
|
||||
icon: optional(string()),
|
||||
show_header_toggle: optional(boolean()),
|
||||
|
@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -14,7 +13,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
icon: optional(string()),
|
||||
attribute: optional(string()),
|
||||
|
@ -12,7 +12,6 @@ import {
|
||||
string,
|
||||
} from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -31,7 +30,7 @@ const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
name: optional(string()),
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
unit: optional(string()),
|
||||
min: optional(number()),
|
||||
max: optional(number()),
|
||||
|
@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -13,7 +12,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
theme: optional(string()),
|
||||
})
|
||||
|
@ -2,7 +2,6 @@ import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -16,7 +15,7 @@ const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
name: optional(string()),
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
theme: optional(string()),
|
||||
icon: optional(string()),
|
||||
hold_action: optional(actionConfigStruct),
|
||||
|
@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/entity/ha-entity-picker";
|
||||
import "../../../../components/ha-theme-picker";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
@ -14,7 +13,7 @@ import { EditorTarget, EntitiesEditorEvent } from "../types";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
theme: optional(string()),
|
||||
})
|
||||
);
|
||||
|
@ -2,7 +2,6 @@ import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -15,7 +14,7 @@ import { configElementStyle } from "./config-elements-style";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
image: optional(string()),
|
||||
name: optional(string()),
|
||||
camera_image: optional(string()),
|
||||
|
@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -13,7 +12,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
theme: optional(string()),
|
||||
})
|
||||
|
@ -11,7 +11,6 @@ import {
|
||||
union,
|
||||
} from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -24,7 +23,7 @@ import { DEFAULT_HOURS_TO_SHOW } from "../../cards/hui-sensor-card";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
icon: optional(string()),
|
||||
graph: optional(union([literal("line"), literal("none")])),
|
||||
|
@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
@ -13,7 +12,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
theme: optional(string()),
|
||||
})
|
||||
|
@ -14,7 +14,6 @@ import {
|
||||
string,
|
||||
} from "superstruct";
|
||||
import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import { LocalizeFunc } from "../../../../common/translations/localize";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
@ -35,7 +34,7 @@ import "./hui-tile-card-features-editor";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
icon: optional(string()),
|
||||
color: optional(string()),
|
||||
|
@ -3,7 +3,6 @@ import { customElement, property, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { entityId } from "../../../../common/structs/is-entity-id";
|
||||
import type { LocalizeFunc } from "../../../../common/translations/localize";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
@ -18,7 +17,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(entityId()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
theme: optional(string()),
|
||||
show_current: optional(boolean()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user