From e7d9b65bc2e2d0bda4e9bb68bb6781f76aa2ea7a Mon Sep 17 00:00:00 2001 From: jimtng <2554958+jimtng@users.noreply.github.com> Date: Mon, 13 Jan 2025 01:07:02 +1000 Subject: [PATCH] Item Details: Add a link to search for the item in the developer bar (#3004) Signed-off-by: Jimmy Tanagra --- bundles/org.openhab.ui/web/src/components/app.vue | 4 +++- .../web/src/components/developer/developer-dock.vue | 4 ++-- .../web/src/components/developer/developer-sidebar.vue | 8 +++++++- .../web/src/pages/settings/items/item-details.vue | 5 ++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/app.vue b/bundles/org.openhab.ui/web/src/components/app.vue index 6acd7b240d..075ffc0b8b 100644 --- a/bundles/org.openhab.ui/web/src/components/app.vue +++ b/bundles/org.openhab.ui/web/src/components/app.vue @@ -148,7 +148,7 @@ - + @@ -384,6 +384,7 @@ export default { activeDock: 'tools', activeToolTab: 'pin', activeHelpTab: 'current', + developerSearch: null, currentUrl: '' } }, @@ -576,6 +577,7 @@ export default { if (dockOpts.dock) this.activeDock = dockOpts.dock if (dockOpts.helpTab) this.activeHelpTab = dockOpts.helpTab if (dockOpts.toolTab) this.activeToolTab = dockOpts.toolTab + if (dockOpts.searchFor) this.developerSearch = dockOpts.searchFor } if (!this.showDeveloperDock) this.toggleDeveloperDock() }, diff --git a/bundles/org.openhab.ui/web/src/components/developer/developer-dock.vue b/bundles/org.openhab.ui/web/src/components/developer/developer-dock.vue index deada26c9c..3907944231 100644 --- a/bundles/org.openhab.ui/web/src/components/developer/developer-dock.vue +++ b/bundles/org.openhab.ui/web/src/components/developer/developer-dock.vue @@ -21,7 +21,7 @@ - + @@ -47,7 +47,7 @@ import DeveloperSidebar from './developer-sidebar.vue' import HelpSidebar from './help-sidebar.vue' export default { - props: ['dock', 'helpTab', 'toolTab'], + props: ['dock', 'helpTab', 'toolTab', 'searchFor'], components: { DeveloperSidebar, HelpSidebar diff --git a/bundles/org.openhab.ui/web/src/components/developer/developer-sidebar.vue b/bundles/org.openhab.ui/web/src/components/developer/developer-sidebar.vue index 2e99e1a711..0efab2a8af 100644 --- a/bundles/org.openhab.ui/web/src/components/developer/developer-sidebar.vue +++ b/bundles/org.openhab.ui/web/src/components/developer/developer-sidebar.vue @@ -395,7 +395,12 @@ export default { SearchResults, ExpressionTester }, - props: ['activeToolTab'], + props: ['activeToolTab', 'searchFor'], + watch: { + searchFor (val) { + if (val) this.$refs.searchbar.search(val) + } + }, data () { return { searchQuery: '', @@ -453,6 +458,7 @@ export default { this.$nextTick(() => { if (this.$device.desktop && this.$refs.searchbar) { this.$refs.searchbar.f7Searchbar.$inputEl.focus() + if (this.searchFor) this.$refs.searchbar.search(this.searchFor) } }) }, diff --git a/bundles/org.openhab.ui/web/src/pages/settings/items/item-details.vue b/bundles/org.openhab.ui/web/src/pages/settings/items/item-details.vue index 0e19b0b98e..1f3845c395 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/items/item-details.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/items/item-details.vue @@ -95,7 +95,7 @@

- Tip: Use the developer sidebar (Shift+Alt+D) to search for usages of this Item + Tip: Use the developer sidebar (Shift+Alt+D) to

@@ -227,6 +227,9 @@ export default { }) } ) + }, + searchInSidebar () { + this.$f7.emit('selectDeveloperDock', { 'dock': 'tools', 'toolTab': 'pin', 'searchFor': this.item.name }) } } }