-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script editor updates (match automation editor) #20791
Conversation
@piitaya - Since you asked, here's my attempt at bringing automation editor style to the script editor. I might have gone a little overboard doing refactoring trying to make the script editor and automation editor look more line-by-line equivalent, though when I got done I realized maybe this has become unreviewable 😅 . I almost didn't want to put it up for that reason, but if you were planning on tackling this, I'll leave it up to you if you'd rather fight through this review, or if you can do a cleaner job yourself, I'm happy to just close this and let you drive it, I didn't know this was on your todo list. Thanks! |
}, | ||
}, | ||
{ | ||
name: "icon", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop icon
from the UI? It's not clear to me how this interacts with icon from the entity registry, if one is considered priority over the other, or if this is just vestigial.
If we want to keep it I guess could fork the rename dialog (or share it with automations) and add it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should drop it to be aligned with automation editor.
Currently, automation editor save name (as alias
key) and description to yaml and icon to entity registry. You can also override the name in the entity registry.
IMO, name
, description
and icon
should be editable without opening the more info settings dialog.
name
and icon
should be stored in the entity registry as it can be used everywhere (dashboard, automation list). description
should be stored in the yaml as it's only used in the editor.
I will discuss this point with the rest of the UX/UI team so we can discuss how we manage the migration if we do changes (if it's needed).
src/panels/config/automation/automation-mode-dialog/show-dialog-automation-mode.ts
Outdated
Show resolved
Hide resolved
src/panels/config/automation/automation-rename-dialog/show-dialog-automation-rename.ts
Outdated
Show resolved
Hide resolved
}, | ||
}, | ||
{ | ||
name: "icon", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should drop it to be aligned with automation editor.
Currently, automation editor save name (as alias
key) and description to yaml and icon to entity registry. You can also override the name in the entity registry.
IMO, name
, description
and icon
should be editable without opening the more info settings dialog.
name
and icon
should be stored in the entity registry as it can be used everywhere (dashboard, automation list). description
should be stored in the yaml as it's only used in the editor.
I will discuss this point with the rest of the UX/UI team so we can discuss how we manage the migration if we do changes (if it's needed).
If you're spending time thinking about scripts & names, I'll also point out that I think the use of unique_id for scripts also seems to cause a lot of confusion. I believe when the script is first created, the unique_id is assigned (this is its key in scripts.yaml), and that id is forever used for the name of the service that is created to run this script, and no amount of renaming can change that. I think that cause a lot of user confusion why when they change alias/friendly_names/entity_ids the script services are not updated with the new name. I'm not sure if that can be improved in some way. I know the duplicate button is used to migrate services from readonly to services.yaml, maybe we can have some kind of similar pattern for "migrating" a script to a new unique_id, if user wants that to be changed. |
@karwosts I approved the PR. I will open another PR to add the icon to the rename dialog so user can edit the icon without opening the more info settings dialog. We will look if we can sync the name between yaml and entity registry to avoid confusion. I wonder if we can use the |
Proposed change
Updates the script editor to match the style of the automation editor:
ha-card
. This impliesentity_id
andicon
are no longer offered for configuration in the UI.alias
anddescription
Type of change
Example configuration
Additional information
Unify the Automation and Scripts 3-dot Menu #15314
Add description field to scripts #16259
https://community.home-assistant.io/t/add-description-field-in-ui-script-editor/726084
Checklist
If user exposed functionality or configuration variables are added/changed: