-
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
Handle sequences under parallel actions #18470
Closed
Closed
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3b1f542
Handle sequences under parallel actions
surfingbytes 0bd4adc
Better descriptions, sequences are collapsible
surfingbytes 0f30f56
Use of ha-sortable component
surfingbytes 8c0f67e
rebase and fix
bramkragten ed32dc5
Merge branch 'dev' into parallel-sequence
surfingbytes 52b3fa1
Merge branch 'home-assistant:dev' into parallel-sequence
surfingbytes 9438ddb
Merge branch 'home-assistant:dev' into parallel-sequence
surfingbytes 9f3eafe
New "Sequence" action type. Parallel almost reverted.
surfingbytes 2d65d43
Merge branch 'home-assistant:dev' into parallel-sequence
surfingbytes 1a8f550
Merge branch 'home-assistant:dev' into parallel-sequence
surfingbytes a187b1c
Button moved into slot
surfingbytes 5311370
Moved button to the same row with other buttons
surfingbytes 0136918
Revert ParallelAction interface
surfingbytes 995d889
Merge branch 'home-assistant:dev' into parallel-sequence
surfingbytes cd79431
Fixed compilation error
surfingbytes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/panels/config/automation/action/types/ha-automation-action-sequence.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { CSSResultGroup, html, LitElement } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import { fireEvent } from "../../../../../common/dom/fire_event"; | ||
import "../../../../../components/ha-textfield"; | ||
import { Action, SequenceAction } from "../../../../../data/script"; | ||
import { haStyle } from "../../../../../resources/styles"; | ||
import type { HomeAssistant, ItemPath } from "../../../../../types"; | ||
import "../ha-automation-action"; | ||
import type { ActionElement } from "../ha-automation-action-row"; | ||
|
||
@customElement("ha-automation-action-sequence") | ||
export class HaSequenceAction extends LitElement implements ActionElement { | ||
@property({ attribute: false }) public hass!: HomeAssistant; | ||
|
||
@property({ type: Boolean }) public disabled = false; | ||
|
||
@property({ attribute: false }) public path?: ItemPath; | ||
|
||
@property({ attribute: false }) public action!: SequenceAction; | ||
|
||
public static get defaultConfig() { | ||
return { | ||
sequence: [], | ||
}; | ||
} | ||
|
||
protected render() { | ||
const action = this.action; | ||
|
||
return html` | ||
<ha-automation-action | ||
.path=${[...(this.path ?? []), "sequence"]} | ||
.actions=${action.sequence} | ||
.disabled=${this.disabled} | ||
@value-changed=${this._actionsChanged} | ||
.hass=${this.hass} | ||
></ha-automation-action> | ||
`; | ||
} | ||
|
||
private _actionsChanged(ev: CustomEvent) { | ||
ev.stopPropagation(); | ||
const value = ev.detail.value as Action[]; | ||
fireEvent(this, "value-changed", { | ||
value: { | ||
...this.action, | ||
sequence: value, | ||
}, | ||
}); | ||
} | ||
|
||
static get styles(): CSSResultGroup { | ||
return haStyle; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"ha-automation-action-sequence": HaSequenceAction; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It should still accept config that is not in a list right?
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.
Sorry, this was forgotten there and is now fixed.
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.
Does this look good now @bramkragten , or do I need to fix anything more?