-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add group binding to the ZHA config panel and misc. cleanup #4466
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
Merged
bramkragten
merged 19 commits into
home-assistant:dev
from
dmulcahey:dm/zha-group-binding-2
Jan 17, 2020
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
23b1f11
clean up zha device card and usage
dmulcahey 0551629
group binding tile
dmulcahey 1ced19a
add cluster selection to group binding tile
dmulcahey f934626
fix css class name
dmulcahey 01d2302
fix filtering
dmulcahey 1472f4b
multiselect for clusters in group binding
dmulcahey b81f358
pass narrow to cluster table
dmulcahey ade91ca
fix tables
dmulcahey aabe7c4
fix device page
dmulcahey fc10de3
address remaing comments from previous PR
dmulcahey 041af47
fix bad cherry-pick
dmulcahey 6ab21e0
css cleanup
dmulcahey 3e315b0
consistency
dmulcahey 1794fd4
use properties
dmulcahey e9ab10d
translations
dmulcahey 68df117
add confirmation dialog to remove button
dmulcahey 1c0e273
fix css
dmulcahey 714fc66
review comments
dmulcahey 424dd71
remove noise
dmulcahey 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,92 @@ | ||
| import "../../../components/data-table/ha-data-table"; | ||
| import "../../../components/entity/ha-state-icon"; | ||
|
|
||
| import memoizeOne from "memoize-one"; | ||
|
|
||
| import { | ||
| LitElement, | ||
| html, | ||
| TemplateResult, | ||
| property, | ||
| customElement, | ||
| } from "lit-element"; | ||
| import { HomeAssistant } from "../../../types"; | ||
| // tslint:disable-next-line | ||
| import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table"; | ||
| // tslint:disable-next-line | ||
| import { Cluster } from "../../../data/zha"; | ||
| import { formatAsPaddedHex } from "./functions"; | ||
|
|
||
| export interface ClusterRowData extends Cluster { | ||
| cluster?: Cluster; | ||
| cluster_id?: string; | ||
| } | ||
|
|
||
| @customElement("zha-clusters-data-table") | ||
| export class ZHAClustersDataTable extends LitElement { | ||
| @property() public hass!: HomeAssistant; | ||
| @property() public narrow = false; | ||
| @property() public clusters: Cluster[] = []; | ||
|
|
||
| private _clusters = memoizeOne((clusters: Cluster[]) => { | ||
| let outputClusters: ClusterRowData[] = clusters; | ||
|
|
||
| outputClusters = outputClusters.map((cluster) => { | ||
| return { | ||
| ...cluster, | ||
| cluster_id: cluster.endpoint_id + "-" + cluster.id, | ||
| }; | ||
| }); | ||
|
|
||
| return outputClusters; | ||
| }); | ||
|
|
||
| private _columns = memoizeOne( | ||
| (narrow: boolean): DataTableColumnContainer => | ||
| narrow | ||
| ? { | ||
| name: { | ||
| title: "Name", | ||
| sortable: true, | ||
| direction: "asc", | ||
| }, | ||
| } | ||
| : { | ||
| name: { | ||
| title: "Name", | ||
| sortable: true, | ||
| direction: "asc", | ||
| }, | ||
| id: { | ||
| title: "ID", | ||
| template: (id: number) => { | ||
| return html` | ||
| ${formatAsPaddedHex(id)} | ||
| `; | ||
| }, | ||
| sortable: true, | ||
| }, | ||
| endpoint_id: { | ||
| title: "Endpoint ID", | ||
| sortable: true, | ||
| }, | ||
| } | ||
| ); | ||
|
|
||
| protected render(): TemplateResult { | ||
| return html` | ||
| <ha-data-table | ||
| .columns=${this._columns(this.narrow)} | ||
| .data=${this._clusters(this.clusters)} | ||
| .id=${"cluster_id"} | ||
|
bramkragten marked this conversation as resolved.
|
||
| selectable | ||
| ></ha-data-table> | ||
| `; | ||
| } | ||
| } | ||
|
|
||
| declare global { | ||
| interface HTMLElementTagNameMap { | ||
| "zha-clusters-data-table": ZHAClustersDataTable; | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.