mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-12 20:06:33 +00:00
Section -> View Groups
This commit is contained in:
parent
811de0a3fa
commit
66a7e370d4
@ -20,7 +20,7 @@
|
||||
"author": "Paulus Schoutsen <Paulus@PaulusSchoutsen.nl> (http://paulusschoutsen.nl)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"home-assistant-js": "git+https://github.com/balloob/home-assistant-js.git#25db573e8534c41f21d0a25392cf4c2c47eec646",
|
||||
"home-assistant-js": "git+https://github.com/balloob/home-assistant-js.git#db429f74a860587a0e73a8a3c62d6811adcfbc15",
|
||||
"lodash": "^3.10.0",
|
||||
"moment": "^2.11.1"
|
||||
},
|
||||
|
@ -26,16 +26,16 @@
|
||||
<paper-toolbar class='medium'>
|
||||
<paper-icon-button icon='mdi:menu' class$='[[computeMenuButtonClass(narrow, showMenu)]]' on-tap='toggleMenu'></paper-icon-button>
|
||||
|
||||
<template is='dom-if' if='[[!hasSections]]'>
|
||||
<template is='dom-if' if='[[!hasViews]]'>
|
||||
<div class='title'>[[locationName]]</div>
|
||||
</template>
|
||||
|
||||
<template is='dom-if' if='[[hasSections]]'>
|
||||
<template is='dom-if' if='[[hasViews]]'>
|
||||
<div class='flex'>
|
||||
<paper-tabs selected='[[currentSection]]' attr-for-selected='data-entity'
|
||||
on-iron-select='sectionSelected' scrollable='true'>
|
||||
<paper-tabs selected='[[currentView]]' attr-for-selected='data-entity'
|
||||
on-iron-select='viewSelected' scrollable='true'>
|
||||
<paper-tab data-entity=''>[[locationName]]</paper-tab>
|
||||
<template is='dom-repeat' items='[[sections]]'>
|
||||
<template is='dom-repeat' items='[[views]]'>
|
||||
<paper-tab data-entity$='[[item.entityId]]'>
|
||||
<template is='dom-if' if='[[item.attributes.icon]]'>
|
||||
<iron-icon icon='[[item.attributes.icon]]'></iron-icon>
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
<div class='fit'>
|
||||
<ha-zone-cards
|
||||
show-introduction='[[computeShowIntroduction(currentSection, introductionLoaded, states)]]'
|
||||
show-introduction='[[computeShowIntroduction(currentView, introductionLoaded, states)]]'
|
||||
states='[[states]]' columns='[[columns]]'></ha-zone-cards>
|
||||
</div>
|
||||
</paper-header-panel>
|
||||
|
@ -8,8 +8,8 @@ require('../components/ha-zone-cards');
|
||||
|
||||
const {
|
||||
configGetters,
|
||||
sectionActions,
|
||||
sectionGetters,
|
||||
viewActions,
|
||||
viewGetters,
|
||||
voiceGetters,
|
||||
streamGetters,
|
||||
syncGetters,
|
||||
@ -63,32 +63,32 @@ export default new Polymer({
|
||||
observer: 'windowChange',
|
||||
},
|
||||
|
||||
currentSection: {
|
||||
currentView: {
|
||||
type: String,
|
||||
bindNuclear: [
|
||||
sectionGetters.currentSection,
|
||||
section => section || '',
|
||||
viewGetters.currentView,
|
||||
view => view || '',
|
||||
],
|
||||
},
|
||||
|
||||
sections: {
|
||||
views: {
|
||||
type: Array,
|
||||
bindNuclear: [
|
||||
sectionGetters.sections,
|
||||
sections => sections.valueSeq()
|
||||
.sortBy(section => section.attributes.order)
|
||||
viewGetters.views,
|
||||
views => views.valueSeq()
|
||||
.sortBy(view => view.attributes.order)
|
||||
.toArray(),
|
||||
],
|
||||
},
|
||||
|
||||
hasSections: {
|
||||
hasViews: {
|
||||
type: Boolean,
|
||||
computed: 'computeHasSections(sections)',
|
||||
computed: 'computeHasViews(views)',
|
||||
},
|
||||
|
||||
states: {
|
||||
type: Object,
|
||||
bindNuclear: sectionGetters.currentSectionEntities,
|
||||
bindNuclear: viewGetters.currentViewEntities,
|
||||
},
|
||||
|
||||
columns: {
|
||||
@ -137,20 +137,20 @@ export default new Polymer({
|
||||
}
|
||||
},
|
||||
|
||||
computeShowIntroduction(currentSection, introductionLoaded, states) {
|
||||
return currentSection === '' && (introductionLoaded || states.size === 0);
|
||||
computeShowIntroduction(currentView, introductionLoaded, states) {
|
||||
return currentView === '' && (introductionLoaded || states.size === 0);
|
||||
},
|
||||
|
||||
computeHasSections(sections) {
|
||||
return sections.length > 0;
|
||||
computeHasViews(views) {
|
||||
return views.length > 0;
|
||||
},
|
||||
|
||||
toggleMenu() {
|
||||
this.fire('open-menu');
|
||||
},
|
||||
|
||||
sectionSelected(ev) {
|
||||
viewSelected(ev) {
|
||||
const section = ev.detail.item.getAttribute('data-entity') || null;
|
||||
this.async(() => sectionActions.selectSection(section), 0);
|
||||
this.async(() => viewActions.selectView(section), 0);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user