Skip to content

Commit

Permalink
Item Details: Add a link to search for the item in the developer bar (#…
Browse files Browse the repository at this point in the history
…3004)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
  • Loading branch information
jimtng authored Jan 12, 2025
1 parent 03a7fa1 commit e7d9b65
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion bundles/org.openhab.ui/web/src/components/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
</f7-panel>

<f7-panel v-if="showDeveloperDock" right :visible-breakpoint="1280" resizable>
<developer-dock :dock="activeDock" :helpTab="activeHelpTab" :toolTab="activeToolTab" />
<developer-dock :dock="activeDock" :helpTab="activeHelpTab" :toolTab="activeToolTab" :searchFor="developerSearch" />
</f7-panel>

<f7-block v-if="!ready && communicationFailureMsg" class="block-narrow">
Expand Down Expand Up @@ -384,6 +384,7 @@ export default {
activeDock: 'tools',
activeToolTab: 'pin',
activeHelpTab: 'current',
developerSearch: null,
currentUrl: ''
}
},
Expand Down Expand Up @@ -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()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<f7-button :active="activeHelpTab === 'faq'" icon-f7="question_diamond_fill" icon-size="18" @click="$f7.emit('selectDeveloperDock',{'dock': 'help','helpTab': 'faq'})" tooltip="FAQ" />
<f7-button :active="activeHelpTab === 'quick'" icon-f7="cursor_rays" icon-size="18" @click="$f7.emit('selectDeveloperDock',{'dock': 'help','helpTab': 'quick'})" tooltip="Quick Start" />
</f7-segmented>
<developer-sidebar v-if="dockView === 'tools'" :activeToolTab="activeToolTab" />
<developer-sidebar v-if="dockView === 'tools'" :activeToolTab="activeToolTab" :searchFor="searchFor" />
<help-sidebar v-if="dockView === 'help'" :activeHelpTab="activeHelpTab" />
</f7-page>
</template>
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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)
}
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</f7-list-button>
</f7-list>
<p class="developer-sidebar-tip text-align-center">
Tip: Use the developer sidebar (Shift+Alt+D) to search for usages of this Item
Tip: Use the developer sidebar (Shift+Alt+D) to <f7-link text="search for usages of this Item" @click="searchInSidebar" />
</p>
</f7-col>
</f7-row>
Expand Down Expand Up @@ -227,6 +227,9 @@ export default {
})
}
)
},
searchInSidebar () {
this.$f7.emit('selectDeveloperDock', { 'dock': 'tools', 'toolTab': 'pin', 'searchFor': this.item.name })
}
}
}
Expand Down

0 comments on commit e7d9b65

Please sign in to comment.