fix: 优化精简代码

This commit is contained in:
刘洪洪
2023-03-24 16:37:12 +08:00
parent 50296a6291
commit 102f99e4f5
13 changed files with 177 additions and 175 deletions

View File

@@ -217,3 +217,56 @@ export const dataForDnsTrafficLine = {
{ analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' }
]
}
export const dataForNpmEventsHeader = {
chartData: [
{
eventSeverity: 'critical',
count: '-',
index: 0
},
{
eventSeverity: 'high',
count: '-',
index: 1
},
{
eventSeverity: 'medium',
count: '-',
index: 2
},
{
eventSeverity: 'low',
count: '-',
index: 3
},
{
eventSeverity: 'info',
count: '-',
index: 4
}
]
}
export const dataForNpmRecentEvents = {
customTableTitles: [
{ label: 'network.severity', prop: 'eventSeverity' },
{ label: 'network.entity', prop: 'eventKey' },
{ label: 'detections.eventType', prop: 'eventType' }
],
// 下钻后
customTableTitles1: [
{ label: 'network.severity', prop: 'eventSeverity' },
{ label: 'detections.eventType', prop: 'eventType' },
{ label: 'detection.list.startTime', prop: 'startTime' }
]
}
export const dataForNpmNetworkQuantity = {
npmNetworkName: [
{ name: 'networkAppPerformance.tcpConnectionEstablishLatency' },
{ name: 'networkAppPerformance.httpResponse' },
{ name: 'networkAppPerformance.sslResponseLatency' },
{ name: 'networkAppPerformance.packetLoss' },
{ name: 'overall.packetRetrans' }
]
}

View File

@@ -1194,6 +1194,48 @@ export function getQueryByType (type, condition) {
case 'serverCity': {
return `server_city='${condition.split(/'(.*?)'/)[1]}'`
}
default: return condition
default: {
return condition
}
}
}
/**
根据EventSeverity获取对应的键值index
*/
export function getIndexByEventSeverity (type) {
switch (type) {
case 'critical': {
return 0
}
case 'high': {
return 1
}
case 'medium': {
return 2
}
case 'low': {
return 3
}
case 'info': {
return 4
}
}
}
export function getQueryByFlag2 (type, condition) {
switch (type) {
case 'country':
case 'asn':
case 'province':
case 'city':
case 'isp': {
return `${type}='${condition[1]}'`
}
case 'idcRenter': {
return `idc_renter='${condition[1]}'`
}
default: {
return `${condition[0]}'${condition[1]}'`
}
}
}