-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Change take control of blueprint UX #21254
Conversation
WalkthroughWalkthroughThe updates revolve around enhancing automation and script editors by introducing or modifying blueprint handling features. This includes supporting blueprint configurations, enabling users to take control of blueprints, revert to original configurations, and save changes. Various UI elements and methods related to alerts and disabled states have been removed for cleaner and more intuitive user interactions. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant HaAutomationEditor
participant BlueprintService
participant UIServices
User->>HaAutomationEditor: Interact with blueprint
HaAutomationEditor->>BlueprintService: Get blueprint config
BlueprintService-->>HaAutomationEditor: Return blueprint config
HaAutomationEditor->>UIServices: Display config (read-only)
User->>HaAutomationEditor: Take control of blueprint
HaAutomationEditor->>BlueprintService: Set new config
BlueprintService-->>HaAutomationEditor: Confirm update
HaAutomationEditor->>UIServices: Update to editable mode
User->>HaAutomationEditor: Save changes after edit
HaAutomationEditor->>BlueprintService: Save new config
BlueprintService-->>HaAutomationEditor: Confirm save
HaAutomationEditor->>UIServices: Notify save success
Tip AI model upgrade
|
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.
Actionable comments posted: 10
"text": "This script is based on a blueprint. You are about to take control, which will separate it from the blueprint and give you the ability to fully edit the script. Would you like to proceed?", | ||
"action": "[%key:ui::panel::config::automation::editor::take_control_confirmation::action%]" | ||
}, | ||
"confirm_take_control": "Your are viewing a preview of the script config, do you want to take control?", |
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.
Fix typo in confirmation message.
There is a typo in the confirmation message: "Your are" should be "You are".
- "confirm_take_control": "Your are viewing a preview of the script config, do you want to take control?"
+ "confirm_take_control": "You are viewing a preview of the script config, do you want to take control?"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"confirm_take_control": "Your are viewing a preview of the script config, do you want to take control?", | |
"confirm_take_control": "You are viewing a preview of the script config, do you want to take control?" |
"text": "This automation is based on a blueprint. You are about to take control, which will separate it from the blueprint and give you the ability to fully edit the automation. Would you like to proceed?", | ||
"action": "Take control" | ||
}, | ||
"confirm_take_control": "Your are viewing a preview of the automation config, do you want to take control?", |
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.
Fix typo in confirmation message.
There is a typo in the confirmation message: "Your are" should be "You are".
- "confirm_take_control": "Your are viewing a preview of the automation config, do you want to take control?"
+ "confirm_take_control": "You are viewing a preview of the automation config, do you want to take control?"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"confirm_take_control": "Your are viewing a preview of the automation config, do you want to take control?", | |
"confirm_take_control": "You are viewing a preview of the automation config, do you want to take control?", |
blueprint-script-editor, | ||
:not(.yaml-mode) > ha-alert { |
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.
Ensure blueprint-script-editor
and manual-script-editor
are imported.
The blueprint-script-editor
and manual-script-editor
components are used here, but there is no import statement for them. Ensure they are imported to avoid runtime errors.
+ import "./blueprint-script-editor";
+ import "./manual-script-editor";
Committable suggestion was skipped due to low confidence.
@@ -653,14 +654,33 @@ | |||
description: config.description, | |||
}; | |||
|
|||
this._blueprintConfig = config; |
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.
Avoid using any
type.
Replace the any
type with a more specific type to improve type safety.
- } catch (err: any) {
+ } catch (err: Error) {
Committable suggestion was skipped due to low confidence.
if (this._mode === "yaml") { | ||
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config); | ||
} | ||
this._readOnly = true; |
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.
Fix read-only state logic.
The read-only state should be set to false
after taking control of the blueprint.
- this._readOnly = true;
+ this._readOnly = false;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (this._mode === "yaml") { | |
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config); | |
} | |
this._readOnly = true; | |
if (this._mode === "yaml") { | |
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config); | |
} | |
this._readOnly = false; |
blueprint-automation-editor, | ||
:not(.yaml-mode) > ha-alert { |
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.
Ensure blueprint-automation-editor
and manual-automation-editor
are imported.
The blueprint-automation-editor
and manual-automation-editor
components are used here, but there is no import statement for them. Ensure they are imported to avoid runtime errors.
+ import "./blueprint-automation-editor";
+ import "./manual-automation-editor";
Committable suggestion was skipped due to low confidence.
this._blueprintConfig = config; | ||
this._config = newConfig; | ||
this._dirty = true; | ||
if (this._mode === "yaml") { | ||
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config); | ||
} | ||
this._readOnly = true; |
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.
Fix read-only state logic.
The read-only state should be set to false
after taking control of the blueprint.
- this._readOnly = true;
+ this._readOnly = false;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
this._blueprintConfig = config; | |
this._config = newConfig; | |
this._dirty = true; | |
if (this._mode === "yaml") { | |
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config); | |
} | |
this._readOnly = true; | |
this._blueprintConfig = config; | |
this._config = newConfig; | |
if (this._mode === "yaml") { | |
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config); | |
} | |
this._readOnly = false; |
.disabled=${this._blueprintConfig || | ||
(!this._readOnly && !this.automationId)} |
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.
Fix conditional logic for disabling the duplicate button.
The current logic might not cover all cases. Ensure that the button is correctly disabled based on the blueprint configuration and read-only state.
- .disabled=${this._blueprintConfig || (!this._readOnly && !this.automationId)}
+ .disabled=${!this._blueprintConfig && (!this._readOnly || !this.automationId)}
Committable suggestion was skipped due to low confidence.
Proposed change
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit
New Features
Bug Fixes
Style
Translation