Skip to content

Commit

Permalink
fix: 优化编辑采集项时的表单提交 (#4893)
Browse files Browse the repository at this point in the history
Co-authored-by: Long <[email protected]>
Co-authored-by: unique0lai <[email protected]>
Co-authored-by: chenguo <[email protected]>
Co-authored-by: wencong1724427771 <[email protected]>
Co-authored-by: 热心网友陈德华 <[email protected]>
Co-authored-by: xlc <[email protected]>
Co-authored-by: LeeXT <[email protected]>
Co-authored-by: Jiahua Wu <[email protected]>
Co-authored-by: 闪烁 <[email protected]>
Co-authored-by: goodGai <[email protected]>
Co-authored-by: byron <[email protected]>
Co-authored-by: 17 <[email protected]>
Co-authored-by: liang ling <[email protected]>
Co-authored-by: JayCC1 <[email protected]>
Co-authored-by: q15971095971 <[email protected]>
Co-authored-by: HACK-WU <[email protected]>
Co-authored-by: tang202388 <[email protected]>
Co-authored-by: WuFantaotao <[email protected]>
Co-authored-by: ctenetlau <[email protected]>
Co-authored-by: yzygyin <[email protected]>
Co-authored-by: 奇客 <[email protected]>
  • Loading branch information
1 parent 0e96965 commit 5829266
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions bklog/web/src/components/collection-access/step-field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1545,28 +1545,28 @@
// 判断是否有设置字段清洗,如果没有则把etl_params设置成 bk_log_text
data.clean_type = !fieldTableData.length ? 'bk_log_text' : etlConfig;
data.etl_fields = fieldTableData;
if(!this.builtFieldShow){
this.copyBuiltField.forEach(field => {
if (field.hasOwnProperty('expand')) {
if (field.expand === false) {
this.copyBuiltField.push(...field.children)
}
}
})
data.etl_fields.push(...this.copyBuiltField)
}
data.alias_settings = fieldTableData.filter(item => item.query_alias).map(item => {
return {
field_name: item.alias_name || item.field_name,
query_alias: item.query_alias,
path_type: item.field_type
if(!this.builtFieldShow){
this.copyBuiltField.forEach(field => {
if (field.hasOwnProperty('expand')) {
if (field.expand === false) {
this.copyBuiltField.push(...field.children)
}
}
})
data.etl_fields = data.etl_fields.filter( item => !item.is_built_in )
} else {
data.etl_fields.push(...this.copyBuiltField)
}

delete data.etl_params['separator_regexp'];
delete data.etl_params['separator'];
}
data.alias_settings = fieldTableData.filter(item => item.query_alias).map(item => {
return {
field_name: item.alias_name || item.field_name,
query_alias: item.query_alias,
path_type: item.field_type
}
})
data.etl_fields = data.etl_fields.filter( item => !item.is_built_in )
let requestUrl;
const urlParams = {};
if (this.isSetEdit) {
Expand Down Expand Up @@ -1892,10 +1892,13 @@
etl_config,
etl_params: etlParams,
fields,
index_set_id
index_set_id,
alias_settings
} = this.curCollect;
const option = { time_zone: '', time_format: '' };
const copyFields = fields ? JSON.parse(JSON.stringify(fields)) : [];
this.alias_settings = this.changeAliasSettings(alias_settings)
this.concatenationQueryAlias(copyFields)
copyFields.forEach(row => {
row.value = '';
if (row.is_delete) {
Expand Down Expand Up @@ -2368,15 +2371,8 @@
})
.then(async res => {
if (res.data) {
const keys = Object.keys(res.data.alias_settings || {});
const arr = keys.map( key => {
return {
query_alias : key,
field_name : res.data.alias_settings[key].path
}
})
this.alias_settings = arr
this.concatenationQueryAlias( res.data.fields)
this.alias_settings = this.changeAliasSettings(res.data.alias_settings)
this.concatenationQueryAlias(res.data.fields)
this.$store.commit('collect/setCurCollect', res.data);
this.getDetail();
await this.getCleanStash(id);
Expand Down Expand Up @@ -2628,6 +2624,16 @@
},
deleteField(field) {
this.formData.fields = this.formData.fields.filter(item => item.field_index !== field.field_index)
},
// 转换alias_settings格式
changeAliasSettings(alias_settings){
const keys = Object.keys(alias_settings || {});
return keys.map( key => {
return {
query_alias : key,
field_name : alias_settings[key].path
}
})
}
},
};
Expand Down

0 comments on commit 5829266

Please sign in to comment.