CN-1173 fix: 检测功能UI开发与接口对接
This commit is contained in:
@@ -139,13 +139,13 @@ export const api = {
|
||||
},
|
||||
list: apiVersion + '/rule/detection/list', // 检测规则列表
|
||||
detail: apiVersion + '/rule/detection', // 检测规则详情
|
||||
delete: apiVersion + '/rule', // 检测规则删除
|
||||
delete: apiVersion + '/rule/detection', // 检测规则删除
|
||||
// 获取单位列表,如source、type、metric等
|
||||
statistics: apiVersion + '/detection/statistics',
|
||||
statistics: apiVersion + '/rule/detection/statistics',
|
||||
// 规则新建模块
|
||||
create: {
|
||||
topKeys: apiVersion + '/detection/topKeys', // topKeys列表
|
||||
create: apiVersion + '/rule/detection/create' // todo 规则新建编辑,此api为模拟,后续需要修改
|
||||
create: apiVersion + '/rule/detection'
|
||||
}
|
||||
},
|
||||
// Dashboard
|
||||
|
||||
@@ -2479,8 +2479,8 @@ export const psiphon3IpType = [
|
||||
]
|
||||
// detection新增页的第一步,选择mode
|
||||
export const detectionRuleType = {
|
||||
indicator: 'Indicator Match',
|
||||
threshold: 'Threshold'
|
||||
indicator: 'indicator_match',
|
||||
threshold: 'threshold'
|
||||
}
|
||||
|
||||
// 顶级域名列表
|
||||
|
||||
@@ -137,3 +137,73 @@ export const xAxisTimeRich = {
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
|
||||
function switchDateTypeByStr (str) {
|
||||
switch (str) {
|
||||
case 'Y':
|
||||
return 'years'
|
||||
case 'M':
|
||||
return 'months'
|
||||
case 'W':
|
||||
return 'weeks'
|
||||
case 'D':
|
||||
return 'days'
|
||||
case 'H':
|
||||
return 'hours'
|
||||
case 'm':
|
||||
return 'minutes'
|
||||
case 'S':
|
||||
return 'seconds'
|
||||
}
|
||||
}
|
||||
|
||||
function switchValueByDateType (str) {
|
||||
switch (str) {
|
||||
case 'years':
|
||||
return 'Y'
|
||||
case 'months':
|
||||
return 'M'
|
||||
case 'weeks':
|
||||
return 'W'
|
||||
case 'days':
|
||||
return 'D'
|
||||
case 'hours':
|
||||
return 'H'
|
||||
case 'minutes':
|
||||
return 'm'
|
||||
case 'seconds':
|
||||
return 'S'
|
||||
}
|
||||
}
|
||||
|
||||
export function getTimeByDurations (str) {
|
||||
if (str && str.indexOf('P') === 0) {
|
||||
const obj = {
|
||||
type: '',
|
||||
value: ''
|
||||
}
|
||||
for (let i = 1; i < str.length; i++) {
|
||||
const item = str[i]
|
||||
// P5M表示持续5个月,PT5M持续5分钟,T是位于时间分量之前的时间指示符,即T之前是年月周日,T之后是时分秒
|
||||
if (isNaN(item) && item !== 'T') {
|
||||
if (item === 'M' && i < str.indexOf('T')) {
|
||||
obj.type = switchDateTypeByStr('m')
|
||||
} else {
|
||||
obj.type = switchDateTypeByStr(item)
|
||||
}
|
||||
} else if (!isNaN(item)) {
|
||||
obj.value += item
|
||||
}
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
export function getDurationsTimeByType (number, type) {
|
||||
let T = ''
|
||||
if (['hours', 'minutes', 'seconds'].indexOf(type) > -1) {
|
||||
T = 'T'
|
||||
}
|
||||
return `P${T}${number}${switchValueByDateType(type)}`
|
||||
}
|
||||
|
||||
@@ -350,3 +350,53 @@ export const connectionList = [
|
||||
// label: 'OR'
|
||||
// }
|
||||
]
|
||||
|
||||
export const detectionUnitList = {
|
||||
statusList: [
|
||||
{ status: 1 },
|
||||
{ status: 0 }
|
||||
],
|
||||
categoryList: [
|
||||
{ value: 'security_event', label: 'Security Event' },
|
||||
{ value: 'performance_event', label: 'Performance Event' }
|
||||
],
|
||||
eventTypeList: [
|
||||
{ value: 'ddos', label: 'DDos' },
|
||||
{ value: 'lateral_movement', label: 'Lateral movement' },
|
||||
{ value: 'brute_force', label: 'Brute force' }
|
||||
],
|
||||
sourceList: [
|
||||
{ value: 'session_record', label: 'session_record' }
|
||||
],
|
||||
levelList: [
|
||||
{ value: 'critical', label: 'Critical' },
|
||||
{ value: 'high', label: 'High' },
|
||||
{ value: 'medium', label: 'Medium' },
|
||||
{ value: 'low', label: 'Low' },
|
||||
{ value: 'info', label: 'Info' }
|
||||
],
|
||||
metricList: [
|
||||
{ value: 'tcp_lostlen_ratio', label: 'Bits/second' },
|
||||
{ value: 's2c_byte_retrans_ratio', label: 'Packets/second' },
|
||||
{ value: 's2c_byte_retrans_ratio1', label: 'Sessions/second' }
|
||||
],
|
||||
conditionList: [
|
||||
{ value: 'than', label: 'Greater Than' },
|
||||
{ value: 'less', label: 'Greater Less' },
|
||||
{ value: 'equal', label: 'Greater Equal' }
|
||||
],
|
||||
libraryList: [
|
||||
{ value: 'library name', knowledgeId: 7, label: 'Library name' },
|
||||
{ value: 'library name1', knowledgeId: 8, label: 'Library name1' },
|
||||
{ value: 'library name2', knowledgeId: 9, label: 'Library name2' }
|
||||
],
|
||||
intervalList: [
|
||||
{ value: 'year', label: 'years' },
|
||||
{ value: 'months', label: 'months' },
|
||||
{ value: 'weeks', label: 'weeks' },
|
||||
{ value: 'days', label: 'days' },
|
||||
{ value: 'hours', label: 'hours' },
|
||||
{ value: 'minutes', label: 'minutes' },
|
||||
{ value: 'seconds', label: 'seconds' }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1320,9 +1320,9 @@ export function numberWithCommas (num) {
|
||||
export function switchStatus (status) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return 'Disabled'
|
||||
return 'detection.create.disabled'
|
||||
case 1:
|
||||
return 'Enabled'
|
||||
return 'detection.create.enabled'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user