Skip to content

Commit

Permalink
Fix configuration panel
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-git committed Mar 24, 2019
1 parent b3b91d4 commit e59109e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/elements/ha-config-custom-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HaConfigCustomUi extends EventsMixin(Polymer.Element) {
<app-header slot="header" fixed>
<app-toolbar>
<paper-icon-button
icon='mdi:arrow-left'
icon='hass:arrow-left'
on-click='_backHandler'
></paper-icon-button>
<div main-title>Custom UI settings</div>
Expand Down
13 changes: 12 additions & 1 deletion src/utils/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,25 @@ window.customUI = window.customUI || {
}
});
}
} else {
} else if (haPanelConfig.shadowRoot) {
const root = haPanelConfig.shadowRoot || haPanelConfig;
if (root.lastElementChild.tagName !== 'HA-CONFIG-CUSTOM-UI') {
const haConfigCustomUi = getHaConfigCustomUi();
root.appendChild(haConfigCustomUi);
}
const visible = window.location.pathname.startsWith('/config/customui');
root.lastElementChild.style.display = visible ? '' : 'none';
} else if (haPanelConfig.routerOptions && haPanelConfig.routerOptions.routes) {
if (!haPanelConfig.routerOptions.routes.customui) {
haPanelConfig.routerOptions.routes.customui = {
tag: 'ha-config-custom-ui',
load: () => Promise.resolve(),
};
// CustomUI panel is the entrypoint, so we need to reload the page.
if (window.location.pathname.startsWith('/config/customui')) {
haPanelConfig.update(new Map([['route', undefined]]));
}
}
}
},

Expand Down

0 comments on commit e59109e

Please sign in to comment.