Skip to content

Add button to duplicate script#7511

Merged
bramkragten merged 3 commits intohome-assistant:devfrom
cnorick:feat-duplicate-scripts
Nov 10, 2020
Merged

Add button to duplicate script#7511
bramkragten merged 3 commits intohome-assistant:devfrom
cnorick:feat-duplicate-scripts

Conversation

@cnorick
Copy link
Contributor

@cnorick cnorick commented Oct 28, 2020

Breaking change

Proposed change

Now you can duplicate scripts just like you do for automations.
demo

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@cnorick
Copy link
Contributor Author

cnorick commented Oct 28, 2020

I added the new translation strings to en.json. Is that all I have to do for i18n or are there more steps I missed?

showScriptEditor(this, {
...this._config,
alias: `${this._config?.alias} (${this.hass.localize(
"ui.panel.config.script.picker.duplicate"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should share this variable with the automation editor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean share the alias?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use: [%key:ui::panel::config::automation::picker::duplicate%] in en.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. done.

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
showScriptEditor(this, {
...this._config,
alias: `${this._config?.alias} (${this.hass.localize(
"ui.panel.config.automation.picker.duplicate"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still be script, but in the en.json you can reference the translation of the automation section.

Suggested change
"ui.panel.config.automation.picker.duplicate"
"ui.panel.config.script.picker.duplicate"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's cool! Let me try again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that look right?

@cnorick cnorick force-pushed the feat-duplicate-scripts branch from 3371c20 to 0e7ccf6 Compare October 30, 2020 13:48
@cnorick
Copy link
Contributor Author

cnorick commented Nov 6, 2020

Just wanted to follow up with this PR. Is there anything else I need to do to get this one merged? @bramkragten

@bramkragten bramkragten merged commit fa28b48 into home-assistant:dev Nov 10, 2020
@bramkragten
Copy link
Member

Nope!

@bramkragten bramkragten mentioned this pull request Nov 11, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automation/Script Editors: Ability to duplicate

4 participants