Skip to content

Commit

Permalink
fix: 全量日志匹配规则修改
Browse files Browse the repository at this point in the history
  • Loading branch information
KT-core committed Oct 16, 2024
1 parent ecc0bb6 commit bf19613
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 100 deletions.
8 changes: 4 additions & 4 deletions frontend/src/api/logs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { get, post } from 'src/utils/request'
import { del, get, post } from 'src/utils/request'

// 获取故障现场分页日志
export const getLogPageListApi = (params) => {
Expand Down Expand Up @@ -46,7 +46,7 @@ export const updateLogRuleApi = (params) => {
}
//删除
export const deleteLogRuleApi = (params) => {
return post(`/api/log/rule/delete`, params)
return del(`/api/log/rule/delete`, params)
}
//获取指定service的route map
export const getLogRuleServiceRouteRuleApi = (params) => {
Expand All @@ -66,7 +66,7 @@ export const getLogOtherTableInfoApi = (params) => {
export const addLogOtherTableApi = (params) => {
return post(`/api/log/other/add`, params)
}
//新增外部日志表信息
//删除外部日志表信息
export const deleteLogOtherTableApi = (params) => {
return post(`/api/log/other/delete`, params)
return del(`/api/log/other/delete`, params)
}
3 changes: 2 additions & 1 deletion frontend/src/contexts/LogsContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ export const LogsProvider = ({ children }) => {
throw error // 如果发生错误,可以抛出异常让调用方处理
}
}

const getLogTableInfo = () => {
// @ts-ignore
dispatch({ type: 'updateLoading', payload: true })
getLogTableInfoAPi().then((res) => {
// @ts-ignore
dispatch({ type: 'setLogRules', payload: res.parses ?? [] })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function LogRouteRuleFormList() {
}
>
{fields.map((field, index) => (
<div key={field.key} className=" px-3 pt-3 pb-0 rounded relative">
<div key={field.name} className=" px-3 pt-3 pb-0 rounded relative">
<Row gutter={12}>
<Col span={11} key={index}>
<Form.Item
Expand Down Expand Up @@ -87,7 +87,9 @@ export default function LogRouteRuleFormList() {
<IoIosRemoveCircleOutline
size={20}
className="mt-1 cursor-pointer"
onClick={() => remove(field.name)}
onClick={() => {
remove(field.name)
}}
/>
</Col>
</Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,17 @@ const ConfigLogRuleModal = ({ modalVisible, closeModal, logRuleInfo }) => {
let result = form.getFieldValue('routeRule') || []

Object.entries(res?.routeRule)?.forEach(([key, value]) => {
result.push({
key: {
key: key,
value: key,
label: key,
},
value: value,
})
if (result)
result.push({
key: {
key: key,
value: key,
label: key,
},
value: value,
})
})
result = result.filter((item) => item.key && item.value)
result = result.filter((item) => item?.key && item.value)
form.setFieldValue('routeRule', result)
})
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { Form, Input, Modal, Select, TreeSelect } from 'antd'
import React, { Children, useEffect, useState } from 'react'
import LogRouteRuleFormList from './component/LogRouteRuleFormList'
import {
addLogOtherTableApi,
addLogRuleApi,
getLogOtherTableInfoApi,
getLogOtherTableListApi,
getLogRuleApi,
updateLogRuleApi,
} from 'src/api/logs'
import { Form, Modal, Select, TreeSelect } from 'antd'
import React, { useEffect, useState } from 'react'
import { addLogOtherTableApi, getLogOtherTableInfoApi, getLogOtherTableListApi } from 'src/api/logs'
import { showToast } from 'src/utils/toast'
import { useLogsContext } from 'src/contexts/LogsContext'

Expand Down

0 comments on commit bf19613

Please sign in to comment.