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

feat: 日志索引集列表增加addition字段进行默认查询 --bug=134643555 #4153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 10 additions & 4 deletions bklog/web/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,17 +949,23 @@ const store = new Vuex.Store({
if (ids.length) {
delete result.unionList;
delete result.clusterParams;

const payload = {
...result,
ids,
selectIsUnionSearch: isUnionIndex,
items: ids.map(val => (list || []).find(item => item.index_set_id === val)).filter(val => val !== undefined),
isUnionIndex,
};
if (!payload.keyword && payload.items.length === 1 && payload.items[0].query_string) {
payload.keyword = payload.items[0].query_string;
payload.search_mode = 'sql';
if (payload.items.length === 1 && !payload.keyword && !payload.addition?.length) {
if (payload.items[0].query_string) {
payload.keyword = payload.items[0].query_string;
payload.search_mode = 'sql';
payload.addition = [];
} else if (payload.items[0].addition) {
payload.addition = payload.items[0].addition;
payload.search_mode = 'ui';
payload.keyword = '';
}
}
commit('updateIndexId', isUnionIndex ? undefined : ids[0]);
commit('updateIndexItem', payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,22 +366,31 @@ export default class QueryStatement extends tsc<object> {
@Emit('selected')
emitSelected() {
const ids = this.isAloneType ? this.selectAloneVal : this.selectedItemIDlist;
const { start_time, end_time, timezone, keyword, search_mode } = this.indexItem;
const { start_time, end_time, timezone, keyword, search_mode, addition } = this.indexItem;
const payload = {
start_time,
end_time,
timezone,
ids,
addition: addition || [],
keyword: keyword || '',
search_mode,
selectIsUnionSearch: !this.isAloneType,
items: ids.map(val => this.indexSetList.find(item => item.index_set_id === val)),
isUnionIndex: !this.isAloneType,
sort_list: [],
};
if (!payload.keyword && payload.items.length === 1 && payload.items[0].query_string) {
payload.keyword = payload.items[0].query_string;
payload.search_mode = 'sql';

if (payload.items.length === 1) {
if (!payload.keyword && payload.items[0].query_string) {
payload.keyword = payload.items[0].query_string;
payload.search_mode = 'sql';
payload.addition = [];
} else if (!payload.addition?.length && payload.items[0].addition) {
payload.addition = payload.items[0].addition;
payload.search_mode = 'ui';
payload.keyword = '';
}
}
return payload;
}
Expand Down
2 changes: 1 addition & 1 deletion bklog/web/src/views/retrieve-v2/monitor/monitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const getApmIndexSetList = async () => {
const getIndexSetList = () => {
if(!props.indexSetApi) return
getApmIndexSetList().then(res => {
if(!res.length) return
if(!res?.length) return
// 拉取完毕根据当前路由参数回填默认选中索引集
store.dispatch('updateIndexItemByRoute', { route, list: res }).then(() => {
store.dispatch('requestIndexSetFieldInfo').then(() => {
Expand Down
Loading