Conversation
| if (!this.value.type && "entity" in this.value) { | ||
| // @ts-ignore | ||
| const domain = this.value.entity.split(".", 1)[0]; | ||
| rowType = `${ | ||
| DOMAIN_TO_ELEMENT_TYPE![domain] || | ||
| DOMAIN_TO_ELEMENT_TYPE!._domain_not_found | ||
| }-entity`; |
There was a problem hiding this comment.
If one of these types. I think I should set it to just be one a type of generic or something. BEcause it will see the type change and try and reload the same element again
There was a problem hiding this comment.
There is no type on the entity row for regular entities. The entity file comes from the Domain to Element Type. Well all of those domains will have the same editor file that needs loaded
There was a problem hiding this comment.
Oooh... can we make the check on the editor element instead of on the type?
There was a problem hiding this comment.
What do you mean? We get the editor element from the type?
There was a problem hiding this comment.
Yeah, and all those types return the same element right?
There was a problem hiding this comment.
They should. at least right now. My thought was to always load this editor. And if it exists in that then we don't need to get the config element from the element its self.
There was a problem hiding this comment.
I don't like that it is not future proof, but also can't think of a case that will need it, so we'll see it when it happens I guess
src/panels/lovelace/editor/config-elements/hui-generic-entity-row-editor.ts
Outdated
Show resolved
Hide resolved
src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts
Outdated
Show resolved
Hide resolved
| entity: EntityId, | ||
| name: optional(string()), | ||
| icon: optional(Icon), | ||
| icon: optional(string()), |
There was a problem hiding this comment.
Because idk why this was ever a thing :). If I am editing the icon. and I type anything but mdi:<Icon-name> then it is a struct error
There was a problem hiding this comment.
Oh, so it switches to the YAML editor?
There was a problem hiding this comment.
Same with the Entity ID. With this PR. I proposing using generic struct types and let the card error/warn about bad entity ids. Otherwise, trying to type an entity id into the code editor makes it jump because you haven't finished your input
| if (!isValidEntityId((config as EntityConfig).entity!)) { | ||
| throw new Error( | ||
| `Invalid entity ID at position ${index}: ${config.entity}` | ||
| `Invalid entity ID at position ${index}: ${ | ||
| (config as EntityConfig).entity | ||
| }` |
There was a problem hiding this comment.
I am not exactly sure what the best way to do this is. With the cast, it compains that entity doesn't exist in Type T.
Even if I add "entity" in config to the if statement.
|
This PR Seems to be ever growing. Feel free to push to 0.117 as I have had to change the typings in a lot of places recently |
|
Agree with 0.117. I can then wrap up changes to action editor/service_data using the same methodology and 0.117 can be a big editor release. |
| import { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; | ||
|
|
||
| export const processConfigEntities = <T extends EntityConfig>( | ||
| export const processConfigEntities = <T extends LovelaceRowConfig>( |
There was a problem hiding this comment.
This is not correct? We use this function for Glance etc? that is not extending LovelaceRowConfig? Should be EntityConfig?
There was a problem hiding this comment.
It should be both then
| @internalProperty() private _guiModeAvailable? = true; | ||
|
|
||
| @query("hui-card-editor") private _cardEditorEl?: HuiCardEditor; | ||
| @query("hui-element-editor") private _cardEditorEl?: HuiElementEditor; |
There was a problem hiding this comment.
We have hui-element so this is not a good name as we don't edit those?
src/panels/lovelace/editor/config-elements/hui-generic-entity-row-editor.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Bram Kragten <mail@bramkragten.nl>



Proposed change
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: