ability to hide tabs (#3811)

* ability to hide tabs

* address review comments

* address review comments

* address review comments

* review comments
This commit is contained in:
Ian Richardson 2019-10-11 06:14:34 -05:00 committed by Bram Kragten
parent 88c480759f
commit 495f4aa19c
2 changed files with 22 additions and 1 deletions

View File

@ -18,6 +18,11 @@ export interface LovelaceViewConfig {
theme?: string;
panel?: boolean;
background?: string;
visible?: boolean | ShowViewConfig[];
}
export interface ShowViewConfig {
user?: string;
}
export interface LovelaceCardConfig {

View File

@ -236,7 +236,20 @@ class HUIRoot extends LitElement {
>
${this.lovelace!.config.views.map(
(view) => html`
<paper-tab aria-label="${view.title}">
<paper-tab
aria-label="${view.title}"
class="${classMap({
"hide-tab": Boolean(
!this._editMode &&
view.visible !== undefined &&
((Array.isArray(view.visible) &&
!view.visible.some(
(e) => e.user === this.hass!.user!.id
)) ||
view.visible === false)
),
})}"
>
${this._editMode
? html`
<ha-paper-icon-button-arrow-prev
@ -392,6 +405,9 @@ class HUIRoot extends LitElement {
paper-item {
cursor: pointer;
}
.hide-tab {
display: none;
}
`,
];
}