CN-743 下钻配置增加unit相关内容

This commit is contained in:
hyx
2022-10-12 11:11:22 +08:00
parent e005eb7cb4
commit c025109b49
5 changed files with 49 additions and 25 deletions

View File

@@ -97,7 +97,8 @@ export const unitTypes = {
byte: 'byte',
bps: 'bps',
string: 'string',
percent: 'percent'
percent: 'percent',
qps: 'qps'
}
export const chartTableDefaultPageSize = 10 // table类型图表默认每页数据量
export const chartTableTopOptions = [10, 100] // table类型图表的TOP-N选项
@@ -958,7 +959,7 @@ export const dnsServiceInsightsTabList = [
},
{
label: 'QNames',
prop: 'dnsServerRole',
prop: 'qname',
queryCycleTotalProp: 'qnames',
dillDownProp: ['dns_qname'],
checked: true,
@@ -1123,7 +1124,7 @@ export const networkTable = {
bytesCycleColumnNameGroup: bytesCycleColumnNameGroupForDns,
defaultOrderBy: 'totalBytes'
},
linkMonitor:{
linkMonitor: {
tabList: linkMonitorTabList,
column: customTableTitlesForLinkMonitor,
url: linkMonitorUrl,

View File

@@ -4,6 +4,7 @@ import _ from 'lodash'
const numberUnit = ['', 'K', 'M', 'G', 'T', 'P', 'E']
const byteUnit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']
const bpsUnit = ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps']
const qpsUnit = ['qps', 'Kqps', 'Mqps', 'Gqps', 'Tqps', 'Pqps', 'Eqps']
const timeUnit = [ // 时间单位步进倍数以ms为基数
{ unit: 'ms', step: 1 },
{ unit: 's', step: 1000 },
@@ -35,6 +36,9 @@ export function numberUnitConvert (value, sourceUnit, targetUnit, dot = 2) {
export function bpsUnitConvert (value, sourceUnit, targetUnit, dot = 2) {
return asciiCompute(value, 1000, bpsUnit, dot)
}
export function qpsUnitConvert (value, sourceUnit, targetUnit, dot = 2) {
return asciiCompute(value, 1000, qpsUnit, dot)
}
export function byteUnitConvert (value, unitType, sourceUnit = 'B', targetUnit, dot = 2) {
return asciiCompute(value, 1024, byteUnit, dot)
}
@@ -109,6 +113,9 @@ export default function unitConvert (value, unitType, sourceUnit, targetUnit, do
case unitTypes.byte: {
return byteUnitConvert(value, unitType, sourceUnit, targetUnit, dot)
}
case unitTypes.qps: {
return qpsUnitConvert(value, sourceUnit, targetUnit, dot)
}
}
}
}