Skip to content

Commit f784419

Browse files
authored
Only load ignored inbox items in inbox view (#2400)
Depends on openhab/openhab-core#4108. In most places, the inbox content is loaded only to show a count of items in inbox. For any decent size systems the inbox may contain hundreds of entries that are ignored, which equates to lots of unnecessary data being transferred and processed in the browser. --------- Signed-off-by: Arne Seime <[email protected]>
1 parent 970afa0 commit f784419

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

bundles/org.openhab.ui/web/src/pages/settings/menu/settings-menu.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export default {
291291
},
292292
loadCounters () {
293293
if (!this.apiEndpoints) return
294-
if (this.$store.getters.apiEndpoint('inbox')) this.$oh.api.get('/rest/inbox').then((data) => { this.inboxCount = data.filter((e) => e.flag === 'NEW').length.toString() })
294+
if (this.$store.getters.apiEndpoint('inbox')) this.$oh.api.get('/rest/inbox?includeIgnored=false').then((data) => { this.inboxCount = data.filter((e) => e.flag === 'NEW').length.toString() })
295295
if (this.$store.getters.apiEndpoint('things')) this.$oh.api.get('/rest/things?staticDataOnly=true').then((data) => { this.thingsCount = data.length.toString() })
296296
if (this.$store.getters.apiEndpoint('items')) this.$oh.api.get('/rest/items?staticDataOnly=true').then((data) => { this.itemsCount = data.length.toString() })
297297
if (this.$store.getters.apiEndpoint('ui')) this.$oh.api.get('/rest/ui/components/system:sitemap').then((data) => { this.sitemapsCount = data.length })

bundles/org.openhab.ui/web/src/pages/settings/things/add/choose-binding.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
:link="binding.id"
3838
:title="binding.label"
3939
:header="binding.uid"
40-
:badge="inbox.filter((e) => e.thingTypeUID.split(':')[0] === binding.id && e.flag !== 'IGNORED').length || undefined"
40+
:badge="inbox.filter((e) => e.thingTypeUID.split(':')[0] === binding.id).length || undefined"
4141
badge-color="red"
4242
:footer="(binding.description && binding.description.indexOf('<br>') >= 0) ?
4343
binding.description.split('<br>')[0] : binding.description" />
@@ -88,7 +88,7 @@ export default {
8888
}
8989
})
9090
})
91-
this.$oh.api.get('/rest/inbox').then((data) => {
91+
this.$oh.api.get('/rest/inbox?includeIgnored=false').then((data) => {
9292
this.inbox = data
9393
})
9494
}

bundles/org.openhab.ui/web/src/pages/settings/things/add/choose-thing-type.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ export default {
156156
loadInbox () {
157157
if (this.loading) return
158158
this.loading = true
159-
this.$oh.api.get('/rest/inbox').then((data) => {
159+
this.$oh.api.get('/rest/inbox?includeIgnored=false').then((data) => {
160160
this.loading = false
161-
this.scanResults = data.filter((e) => e.thingTypeUID.split(':')[0] === this.bindingId && e.flag !== 'IGNORED')
161+
this.scanResults = data.filter((e) => e.thingTypeUID.split(':')[0] === this.bindingId)
162162
const searchbar = this.$refs.searchbar.$el.f7Searchbar
163163
const filterQuery = searchbar.query
164164
this.initSearchbar = false

bundles/org.openhab.ui/web/src/pages/settings/things/inbox/inbox-list.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export default {
187187
methods: {
188188
load () {
189189
this.loading = true
190-
this.$oh.api.get('/rest/inbox').then((data) => {
190+
this.$oh.api.get('/rest/inbox?includeIgnored=true').then((data) => {
191191
this.inbox = data.sort((a, b) => a.label.localeCompare(b.label))
192192
this.initSearchbar = true
193193
this.loading = false

bundles/org.openhab.ui/web/src/pages/settings/things/things-list.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export default {
218218
}
219219
},
220220
inboxCount () {
221-
return this.inbox.filter((e) => e.flag !== 'IGNORED').length
221+
return this.inbox.length
222222
},
223223
searchPlaceholder () {
224224
return window.innerWidth >= 1280 ? 'Search (for advanced search, use the developer sidebar (Shift+Alt+D))' : 'Search'
@@ -244,7 +244,7 @@ export default {
244244
this.loadInbox()
245245
},
246246
loadInbox () {
247-
this.$oh.api.get('/rest/inbox').then((data) => {
247+
this.$oh.api.get('/rest/inbox?includeIgnored=false').then((data) => {
248248
this.inbox = data
249249
})
250250
},

0 commit comments

Comments
 (0)