Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspector add search history #890

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions frontend/src/views/inspector/ButtonBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,21 @@
/>
</div>
<div class="inspector-search">
<v-text-field
<v-combobox
outlined
dense
height=26
v-model="searchStr"
class="inspector-search-text"
:items="searchHistory"
class="inspector-search-text custom-combobox"
label="Separate multiple keywords by spaces or |"
clearable
hide-no-data
hide-selected
:menu-props="{ contentClass: 'custom-combobox-menu' }"
@click:clear="clearInspectorSearch"
@update:search-input="updateSearchStr"
@blur="saveSearchHistory"
/>
</div>

Expand Down Expand Up @@ -168,12 +174,18 @@

<script>
import TempMockDrawer from '@/views/inspector/TempMockDrawer.vue'
import { debounce } from 'lodash'

export default {
name: 'buttonBar',
components: {
TempMockDrawer
},
data() {
return {
searchHistory: [],
}
},
computed: {
diffMode: {
get () {
Expand Down Expand Up @@ -252,7 +264,7 @@ export default {
set (val) {
this.$store.commit('setSearchStr', val)
}
}
},
},
methods: {
showMockDataSelector () {
Expand All @@ -271,6 +283,14 @@ export default {
clearInspectorSearch () {
this.$store.commit('setSearchStr', '')
},
saveSearchHistory() {
if (this.searchStr && !this.searchHistory.includes(this.searchStr)) {
this.searchHistory.unshift(this.searchStr);
if (this.searchHistory.length > 10) {
this.searchHistory.pop();
}
}
},
saveSelectedFlow () {
if (Object.keys(this.activatedGroups).length <= 0) {
this.$bus.$emit('msg.info', 'Select a mock group')
Expand All @@ -284,7 +304,13 @@ export default {
},
onActivateClick (group) {
this.$store.dispatch('activateGroup', group)
}
},
updateSearchStr(val) {
this.$store.commit('setSearchStr', val);
},
debouncedUpdateSearchStr: debounce(function(val) {
this.$store.commit('setSearchStr', val);
}, 500),
}
}
</script>
Expand Down Expand Up @@ -433,4 +459,18 @@ export default {
font-size: 14px !important;
top: 5px !important;
}
.custom-combobox .v-input__icon--append:not(.v-input__icon--clear) {
display: none !important;
}
.custom-combobox .v-input__icon--clear {
display: flex !important;
}
.custom-combobox-menu .v-list-item {
min-height: 24px !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
}
.custom-combobox-menu .v-list-item__content {
padding: 4px 0 !important;
}
</style>
9 changes: 7 additions & 2 deletions frontend/src/views/inspector/FlowList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,13 @@ export default {
searchStr () {
return this.$store.state.inspector.searchStr
},
focusedFlowDetail () {
return this.$store.state.inspector.focusedFlowDetail
focusedFlowDetail: {
get() {
return this.$store.state.inspector.focusedFlowDetail;
},
set(value) {
this.$store.commit('setFocusedFlowDetail', value);
}
},
selectedFlows: {
get () {
Expand Down
Loading