forked from platypush/platypush
Only refresh entities that are visible on the interface
This commit is contained in:
parent
1df71cb54a
commit
5b3e1317f4
1 changed files with 19 additions and 17 deletions
|
@ -127,7 +127,8 @@ export default {
|
||||||
this.$emit('input', value)
|
this.$emit('input', value)
|
||||||
},
|
},
|
||||||
|
|
||||||
resetGroupFilter() {
|
refreshGroupFilter(reset) {
|
||||||
|
if (reset)
|
||||||
this.selectedGroups = Object.keys(
|
this.selectedGroups = Object.keys(
|
||||||
this.entityGroups[this.value?.grouping] || {}
|
this.entityGroups[this.value?.grouping] || {}
|
||||||
).reduce(
|
).reduce(
|
||||||
|
@ -136,16 +137,17 @@ export default {
|
||||||
return obj
|
return obj
|
||||||
}, {}
|
}, {}
|
||||||
)
|
)
|
||||||
|
else {
|
||||||
|
for (const group of Object.keys(this.entityGroups[this.value?.grouping]))
|
||||||
|
if (this.selectedGroups[group] == null)
|
||||||
|
this.selectedGroups[group] = true
|
||||||
|
}
|
||||||
|
|
||||||
this.synchronizeSelectedEntities()
|
this.synchronizeSelectedEntities()
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleGroup(group) {
|
toggleGroup(group) {
|
||||||
if (this.selectedGroups[group])
|
this.selectedGroups[group] = !this.selectedGroups[group]
|
||||||
delete this.selectedGroups[group]
|
|
||||||
else
|
|
||||||
this.selectedGroups[group] = true
|
|
||||||
|
|
||||||
this.synchronizeSelectedEntities()
|
this.synchronizeSelectedEntities()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -160,10 +162,10 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.resetGroupFilter()
|
this.refreshGroupFilter(true)
|
||||||
this.$watch(() => this.value?.grouping, this.resetGroupFilter)
|
this.$watch(() => this.value?.grouping, () => { this.refreshGroupFilter(true) })
|
||||||
this.$watch(() => this.searchTerm, this.updateSearchTerm)
|
this.$watch(() => this.searchTerm, this.updateSearchTerm)
|
||||||
this.$watch(() => this.entityGroups, this.resetGroupFilter)
|
this.$watch(() => this.entityGroups, () => { this.refreshGroupFilter(false) })
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue