Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cgarwood committed Aug 29, 2020
1 parent a8591fd commit 2c8af5f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ import type { HomeAssistant, Route } from "../../../../../types";
import { computeTail } from "./ozw-config-router";
import "./ozw-network-router";

export const ozwNetworkTabs: PageNavigation[] = [
{
translationKey: "ui.panel.config.ozw.navigation.network",
path: `/config/ozw/network/${this.ozwInstance}/dashboard`,
iconPath: mdiServerNetwork,
},
{
translationKey: "ui.panel.config.ozw.navigation.nodes",
path: `/config/ozw/network/${this.ozwInstance}/nodes`,
iconPath: mdiNetwork,
},
];
export function ozwNetworkTabs(instance: number): PageNavigation[] {
return [
{
translationKey: "ui.panel.config.ozw.navigation.network",
path: `/config/ozw/network/${instance}/dashboard`,
iconPath: mdiServerNetwork,
},
{
translationKey: "ui.panel.config.ozw.navigation.nodes",
path: `/config/ozw/network/${instance}/nodes`,
iconPath: mdiNetwork,
},
];
}

@customElement("ozw-config-network")
class OZWConfigNetwork extends LitElement {
Expand Down Expand Up @@ -57,7 +59,7 @@ class OZWConfigNetwork extends LitElement {
.hass=${this.hass}
.narrow=${this.narrow}
.route=${route}
.tabs=${ozwNetworkTabs}
.tabs=${ozwNetworkTabs(this.ozwInstance)}
>
<ozw-network-router
.ozwInstance=${this.ozwInstance}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OZWNetworkDashboard extends LitElement {

@property() public configEntryId?: string;

@property() public ozw_instance = 0;
@property() public ozwInstance = 0;

@internalProperty() private _network?: OZWInstance;

Expand All @@ -53,7 +53,7 @@ class OZWNetworkDashboard extends LitElement {
@internalProperty() private _icon = mdiCircle;

protected firstUpdated() {
if (this.ozw_instance <= 0) {
if (this.ozwInstance <= 0) {
navigate(this, "/config/ozw/dashboard", true);
} else if (this.hass) {
this._fetchData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OZWNetworkNodes extends LitElement {

@property() public configEntryId?: string;

@property() public ozwInstance?: number;
@property() public ozwInstance = 0;

@internalProperty() private _nodes: OZWDevice[] = [];

Expand Down Expand Up @@ -106,7 +106,7 @@ class OZWNetworkNodes extends LitElement {
.hass=${this.hass}
.narrow=${this.narrow}
.route=${route}
.tabs=${ozwNetworkTabs}
.tabs=${ozwNetworkTabs(this.ozwInstance)}
.columns=${this._columns(this.narrow)}
.data=${this._nodes}
id="node_id"
Expand Down

0 comments on commit 2c8af5f

Please sign in to comment.