Merge branch 'dev-3.4' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.5
This commit is contained in:
@@ -380,20 +380,6 @@ export default {
|
|||||||
const self = this
|
const self = this
|
||||||
return function (val, index) {
|
return function (val, index) {
|
||||||
const value = formatScientificNotation(val, 6)
|
const value = formatScientificNotation(val, 6)
|
||||||
// let chartUnit = self.chartInfo.unit
|
|
||||||
// chartUnit = chartUnit || 2
|
|
||||||
// const unit = chartDataFormat.getUnit(chartUnit)
|
|
||||||
// // dot是判断最大值是否 小于1 大于1 默认是2 小于1 需要判断最大值是小数点后面几位
|
|
||||||
// if (chartDataFormat.Interval(maxValue, copies, unit.type, 'min') < 1 && dot < 2) { // 当其小于1 且 dot < 2 默认給2 如 0.9 dot为1
|
|
||||||
// dot = 2
|
|
||||||
// }
|
|
||||||
// if (!dot) { // 默认是2
|
|
||||||
// dot = 2
|
|
||||||
// }
|
|
||||||
// dot = bus.countDecimals(value)
|
|
||||||
// if (dot < self.chartDot) { // 根据具体值计算
|
|
||||||
// dot = self.chartDot
|
|
||||||
// }
|
|
||||||
return unit.compute(value, index, -1, dot)
|
return unit.compute(value, index, -1, dot)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -345,6 +345,8 @@ function asciiCompute (num, ascii, units, dot = 2) {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
num = Number(num)
|
num = Number(num)
|
||||||
|
const SIGN = num > 0 ? 1 : -1
|
||||||
|
num = Math.abs(num)
|
||||||
let carry = 0
|
let carry = 0
|
||||||
if (num > 1) {
|
if (num > 1) {
|
||||||
const log = Math.log(num) / Math.log(ascii)
|
const log = Math.log(num) / Math.log(ascii)
|
||||||
@@ -352,9 +354,9 @@ function asciiCompute (num, ascii, units, dot = 2) {
|
|||||||
num = num / Math.pow(ascii, carry)
|
num = num / Math.pow(ascii, carry)
|
||||||
}
|
}
|
||||||
if (Number.isInteger(num)) {
|
if (Number.isInteger(num)) {
|
||||||
return num + ' ' + units[carry]
|
return num * SIGN + ' ' + units[carry]
|
||||||
} else {
|
} else {
|
||||||
return num.toFixed(dot) + ' ' + units[carry]
|
return num.toFixed(dot) * SIGN + ' ' + units[carry]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ const newcn = {
|
|||||||
system: '系统',
|
system: '系统',
|
||||||
back: '返回',
|
back: '返回',
|
||||||
enabled: '启用',
|
enabled: '启用',
|
||||||
disabled: '已禁用'
|
disabled: '已禁用',
|
||||||
|
unavailable: '不可用'
|
||||||
},
|
},
|
||||||
...zhLocale
|
...zhLocale
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ const newen = {
|
|||||||
system: 'System',
|
system: 'System',
|
||||||
back: 'Back',
|
back: 'Back',
|
||||||
enabled: 'Enabled',
|
enabled: 'Enabled',
|
||||||
disabled: 'Disabled'
|
disabled: 'Disabled',
|
||||||
|
unavailable: 'Unavailable'
|
||||||
},
|
},
|
||||||
...enLocale
|
...enLocale
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,10 +499,32 @@ export default {
|
|||||||
for (let i = 0; i < this.constellation.length; i++) { // 循环遍历 判断碰撞
|
for (let i = 0; i < this.constellation.length; i++) { // 循环遍历 判断碰撞
|
||||||
for (let j = i + 1; j < this.constellation.length; j++) {
|
for (let j = i + 1; j < this.constellation.length; j++) {
|
||||||
if (this.impact(this.constellation[i], this.constellation[j])) {
|
if (this.impact(this.constellation[i], this.constellation[j])) {
|
||||||
const iSpeedX = this.constellation[i].data('speedX')
|
let iSpeedX = this.constellation[i].data('speedX')
|
||||||
const iSpeedY = this.constellation[i].data('speedY')
|
let iSpeedY = this.constellation[i].data('speedY')
|
||||||
this.constellation[i].data('speedX', this.constellation[j].data('speedX'))
|
let jSpeedX = this.constellation[j].data('speedX')
|
||||||
this.constellation[i].data('speedY', this.constellation[j].data('speedY'))
|
let jSpeedY = this.constellation[j].data('speedY')
|
||||||
|
if (iSpeedX > 0) {
|
||||||
|
iSpeedX = this.r(0, 1, 0.3)
|
||||||
|
} else {
|
||||||
|
iSpeedX = this.r(-1, 0, 0.3)
|
||||||
|
}
|
||||||
|
if (iSpeedY > 0) {
|
||||||
|
iSpeedY = this.r(0, 1, 0.3)
|
||||||
|
} else {
|
||||||
|
iSpeedY = this.r(-1, 0, 0.3)
|
||||||
|
}
|
||||||
|
if (jSpeedX > 0) {
|
||||||
|
jSpeedX = this.r(0, 1, 0.3)
|
||||||
|
} else {
|
||||||
|
jSpeedX = this.r(-1, 0, 0.3)
|
||||||
|
}
|
||||||
|
if (jSpeedY > 0) {
|
||||||
|
jSpeedY = this.r(0, 1, 0.3)
|
||||||
|
} else {
|
||||||
|
jSpeedY = this.r(-1, 0, 0.3)
|
||||||
|
}
|
||||||
|
this.constellation[i].data('speedX', jSpeedX)
|
||||||
|
this.constellation[i].data('speedY', jSpeedY)
|
||||||
this.constellation[j].data('speedX', iSpeedX)
|
this.constellation[j].data('speedX', iSpeedX)
|
||||||
this.constellation[j].data('speedY', iSpeedY)
|
this.constellation[j].data('speedY', iSpeedY)
|
||||||
}
|
}
|
||||||
@@ -543,15 +565,15 @@ export default {
|
|||||||
impact (obj, dobj) {
|
impact (obj, dobj) {
|
||||||
const position = obj.node.getBoundingClientRect()
|
const position = obj.node.getBoundingClientRect()
|
||||||
const o = {
|
const o = {
|
||||||
x: position.left,
|
x: position.left - 10,
|
||||||
y: position.top,
|
y: position.top - 10,
|
||||||
w: obj.data('width'),
|
w: obj.data('width'),
|
||||||
h: obj.data('height')
|
h: obj.data('height')
|
||||||
}
|
}
|
||||||
const position2 = dobj.node.getBoundingClientRect()
|
const position2 = dobj.node.getBoundingClientRect()
|
||||||
const d = {
|
const d = {
|
||||||
x: position2.left,
|
x: position2.left - 10,
|
||||||
y: position2.top,
|
y: position2.top - 10,
|
||||||
w: dobj.data('width'),
|
w: dobj.data('width'),
|
||||||
h: dobj.data('height')
|
h: dobj.data('height')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,10 @@
|
|||||||
<template v-if="showMetrics">
|
<template v-if="showMetrics">
|
||||||
<el-row style="line-height: 32px;">
|
<el-row style="line-height: 32px;">
|
||||||
<promql-input
|
<promql-input
|
||||||
|
v-if="showMetrics"
|
||||||
:from-father-data="true"
|
:from-father-data="true"
|
||||||
:metricOptionsParent="metricOptions"
|
:metricOptionsParent="metricOptions"
|
||||||
id="alert-box-input-promql"
|
id="alert-box-input-promql-metrics"
|
||||||
ref="promql"
|
ref="promql"
|
||||||
:expression-list.sync="expressions"
|
:expression-list.sync="expressions"
|
||||||
:index="0"
|
:index="0"
|
||||||
@@ -67,7 +68,8 @@
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<el-row style="line-height: 32px;">
|
<el-row style="line-height: 32px;">
|
||||||
<promql-input
|
<promql-input
|
||||||
id="alert-box-input-promql"
|
v-if="!showMetrics"
|
||||||
|
id="alert-box-input-promql-logs"
|
||||||
ref="promql"
|
ref="promql"
|
||||||
:expression-list.sync="expressions"
|
:expression-list.sync="expressions"
|
||||||
:index="0"
|
:index="0"
|
||||||
@@ -79,7 +81,7 @@
|
|||||||
></promql-input>
|
></promql-input>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="OID" prop="expr" v-if="!showSnmpTrap">
|
<el-form-item label="OID" prop="expr" v-if="!showSnmpTrap">
|
||||||
<el-input id="alert-box-input-oid" v-model="editAlertRule.expr" size="small" type="text"></el-input>
|
<el-input id="alert-box-input-oid" v-model="editAlertRule.expr" size="small" type="text"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -612,12 +614,21 @@ export default {
|
|||||||
this.editAlertRule.operator = '>'
|
this.editAlertRule.operator = '>'
|
||||||
}
|
}
|
||||||
if (val === 1) {
|
if (val === 1) {
|
||||||
this.showSnmpTrap = true // showSnmpTrap 为 true 时显示 expr,threshold,unit
|
this.showSnmpTrap = false // showSnmpTrap 为 true 时显示 expr,threshold,unit
|
||||||
this.showMetrics = true
|
this.showMetrics = true
|
||||||
|
this.expressions = ['']
|
||||||
this.$refs.alertRuleForm.clearValidate('expr') // 移除from表单的 expr 验证
|
this.$refs.alertRuleForm.clearValidate('expr') // 移除from表单的 expr 验证
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.showSnmpTrap = true
|
||||||
|
})
|
||||||
} else if (val === 2) {
|
} else if (val === 2) {
|
||||||
this.showMetrics = false // showMetrics 为 false 时,展示 Logs label
|
this.showMetrics = false
|
||||||
this.showSnmpTrap = true // showSnmpTrap 为 true 时显示 expr,threshold,unit
|
this.expressions = ['']
|
||||||
|
// showMetrics 为 false 时,展示 Logs label
|
||||||
|
this.showSnmpTrap = false // showSnmpTrap 为 true 时显示 expr,threshold,unit
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.showSnmpTrap = true
|
||||||
|
})
|
||||||
this.$refs.alertRuleForm.clearValidate('expr') // 移除from表单的 expr 验证
|
this.$refs.alertRuleForm.clearValidate('expr') // 移除from表单的 expr 验证
|
||||||
} else if (val === 3) {
|
} else if (val === 3) {
|
||||||
this.showSnmpTrap = false // showSnmpTrap 为 false 时,展示 OID
|
this.showSnmpTrap = false // showSnmpTrap 为 false 时,展示 OID
|
||||||
@@ -650,7 +661,7 @@ export default {
|
|||||||
this.editAlertRule = JSON.parse(JSON.stringify(n))
|
this.editAlertRule = JSON.parse(JSON.stringify(n))
|
||||||
if (this.editAlertRule.id || this.editAlertRule.name) {
|
if (this.editAlertRule.id || this.editAlertRule.name) {
|
||||||
this.expressions = [this.editAlertRule.expr]
|
this.expressions = [this.editAlertRule.expr]
|
||||||
this.showTypeSelect = true // 当 edit 时禁用 type下拉框
|
this.showTypeSelect = !!this.editAlertRule.id // 当 edit 时禁用 type下拉框
|
||||||
if (n.type === 1) {
|
if (n.type === 1) {
|
||||||
this.editAlertRule.type = 1
|
this.editAlertRule.type = 1
|
||||||
} else if (n.type === 2) {
|
} else if (n.type === 2) {
|
||||||
|
|||||||
@@ -1187,6 +1187,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
this.newView = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user