diff --git a/frontend/src/views/inspector/ButtonBar.vue b/frontend/src/views/inspector/ButtonBar.vue index 415ab7ef3..a4c111dbd 100644 --- a/frontend/src/views/inspector/ButtonBar.vue +++ b/frontend/src/views/inspector/ButtonBar.vue @@ -97,7 +97,7 @@ height=26 v-model="searchStr" class="inspector-search-text" - label="Separate multiple keywords by spaces" + label="Separate multiple keywords by spaces or |" clearable @click:clear="clearInspectorSearch" /> diff --git a/frontend/src/views/inspector/FlowList.vue b/frontend/src/views/inspector/FlowList.vue index eb31b556f..d928084fc 100644 --- a/frontend/src/views/inspector/FlowList.vue +++ b/frontend/src/views/inspector/FlowList.vue @@ -307,20 +307,32 @@ export default { filterMethod (value, option) { return option.toUpperCase().indexOf(value.toUpperCase()) !== -1 }, + isMatchByAnd (url, searchList) { + for (const searchItem of searchList) + if (!searchItem || !this.filterMethod(searchItem, url)) + return false + return true + }, + isMatch (url, searchList) { + for (const searchItem of searchList) + if(this.isMatchByAnd(url, searchItem)) + return true + return false + }, refreshFlowList () { let displayFlowList = [] let searchStr = typeof(this.searchStr) === 'string' ? this.searchStr.trim() : '' - // Split searchStr by one or more spaces - let searchStrList = searchStr.split(/\s+/) + if(!searchStr){ + displayFlowList = this.originFlowList + } + // Split searchStr by one or more (spaces, |) + let searchStrList = searchStr.split(/\|+/) + for(const idx in searchStrList){ + searchStrList[idx] = searchStrList[idx].trim() + searchStrList[idx] = searchStrList[idx].split(/\s+/) + } for (const flow of this.originFlowList) { - let isMatch = true - for (const searchItem of searchStrList) { - if (!this.filterMethod(searchItem, flow.request.url)) { - isMatch = false - break - } - } - isMatch ? displayFlowList.push(flow) : null + this.isMatch(flow.request.url, searchStrList) ? displayFlowList.push(flow) : null } this.displayFlowCount = displayFlowList.length this.pageCount = Math.max(Math.ceil(this.displayFlowCount / this.pageSize), 1)