Use summary=true for lists & counters (#640)

Use the summary option added to some API resources in
https://github.com/openhab/openhab-core/pull/1827
when displaying counters or lists that don't
need the entire object.

Signed-off-by: Yannick Schaus <github@schaus.net>
pull/641/head
Yannick Schaus 2020-12-14 11:49:05 +01:00 committed by GitHub
parent 91a9d05526
commit e6d81d5a38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -360,9 +360,9 @@ export default {
Promise.resolve(this.cachedObjects[3])
] : [
this.$oh.api.get('/rest/items'),
this.$oh.api.get('/rest/things'),
this.$oh.api.get('/rest/rules'),
this.$oh.api.get('/rest/ui/components/ui:page')
this.$oh.api.get('/rest/things?summary=true'),
this.$oh.api.get('/rest/rules?summary=true'),
Promise.resolve(this.$store.getters.pages)
]
this.searchResultsLoading = true

View File

@ -156,7 +156,7 @@ export default {
this.loading = true
this.$set(this, 'selectedItems', [])
this.showCheckboxes = false
this.$oh.api.get('/rest/rules' + (this.showScripts ? '?tags=Script' : '')).then(data => {
this.$oh.api.get('/rest/rules?summary=true' + (this.showScripts ? '&tags=Script' : '')).then(data => {
this.rules = data.sort((a, b) => {
return a.name.localeCompare(b.name)
})

View File

@ -209,9 +209,9 @@ export default {
loadCounters () {
if (!this.apiEndpoints) return
if (this.$store.getters.apiEndpoint('inbox')) this.$oh.api.get('/rest/inbox').then((data) => { this.inboxCount = data.filter((e) => e.flag === 'NEW').length.toString() })
if (this.$store.getters.apiEndpoint('things')) this.$oh.api.get('/rest/things').then((data) => { this.thingsCount = data.length.toString() })
if (this.$store.getters.apiEndpoint('things')) this.$oh.api.get('/rest/things?summary=true').then((data) => { this.thingsCount = data.length.toString() })
if (this.$store.getters.apiEndpoint('items')) this.$oh.api.get('/rest/items').then((data) => { this.itemsCount = data.length.toString() })
if (this.$store.getters.apiEndpoint('ui')) this.$oh.api.get('/rest/ui/components/system:sitemap').then((data) => { this.sitemapsCount = data.length })
if (this.$store.getters.apiEndpoint('ui')) this.$oh.api.get('/rest/ui/components/system:sitemap?summary=true').then((data) => { this.sitemapsCount = data.length })
},
onPageInit () {
this.loadMenu()

View File

@ -168,7 +168,7 @@ export default {
},
load () {
this.loading = true
this.$oh.api.get('/rest/things').then((data) => {
this.$oh.api.get('/rest/things?summary=true').then((data) => {
this.things = data.sort((a, b) => a.label.localeCompare(b.label))
this.initSearchbar = true
this.loading = false