From 9790aaa29acb6a4897aef50119900cbbef2b53d4 Mon Sep 17 00:00:00 2001 From: Jimmy Tanagra Date: Tue, 14 Jan 2025 15:14:23 +1000 Subject: [PATCH] Things List: Add searchFor prop Signed-off-by: Jimmy Tanagra --- .../web/src/pages/settings/things/things-list.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/things/things-list.vue b/bundles/org.openhab.ui/web/src/pages/settings/things/things-list.vue index 72a3a66a2f..e52bba8350 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/things/things-list.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/things/things-list.vue @@ -168,6 +168,7 @@ import ClipboardIcon from '@/components/util/clipboard-icon.vue' export default { mixins: [thingStatus], + props: ['searchFor'], components: { 'empty-state-placeholder': () => import('@/components/empty-state-placeholder.vue'), ClipboardIcon @@ -267,6 +268,10 @@ export default { if (this.initSeachbar) this.$f7.data.lastThingsSearchQuery = this.$refs.searchbar?.f7Searchbar.query this.initSeachbar = false + if (this.searchFor) { + this.$refs.searchbar?.f7Searchbar.$inputEl.val(this.searchFor) + } + this.$oh.api.get('/rest/things?summary=true').then((data) => { this.things = data.sort((a, b) => (a.label || a.UID).localeCompare(b.label || a.UID)) this.filteredThings = this.things @@ -278,7 +283,7 @@ export default { if (this.$device.desktop && this.$refs.searchbar) { this.$refs.searchbar.f7Searchbar.$inputEl[0].focus() } - this.$refs.searchbar?.f7Searchbar.search(this.$f7.data.lastThingsSearchQuery || '') + this.$refs.searchbar?.f7Searchbar.search(this.searchFor || this.$f7.data.lastThingsSearchQuery || '') }) if (!this.eventSource) this.startEventSource() })