NEZ-2776 fix:Alert message 'History value' 图表缺少 threshold 线
This commit is contained in:
@@ -119,9 +119,20 @@ export default {
|
|||||||
}
|
}
|
||||||
// Thresholds 只对左Y轴有效
|
// Thresholds 只对左Y轴有效
|
||||||
if (s.yAxisIndex != 1) {
|
if (s.yAxisIndex != 1) {
|
||||||
|
chartInfo.param.thresholds = chartInfo.param.thresholds.reverse()
|
||||||
s.markLine.data = chartInfo.param.thresholds.map(threshold => {
|
s.markLine.data = chartInfo.param.thresholds.map(threshold => {
|
||||||
return {
|
return {
|
||||||
yAxis: threshold.value || 0,
|
yAxis: threshold.value || 0,
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
formatter () {
|
||||||
|
if (threshold.label) {
|
||||||
|
return threshold.label
|
||||||
|
} else {
|
||||||
|
return threshold.value || 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: threshold.color,
|
color: threshold.color,
|
||||||
width: 2,
|
width: 2,
|
||||||
|
|||||||
@@ -670,26 +670,36 @@ export default {
|
|||||||
queryDate () {
|
queryDate () {
|
||||||
this.chartLoading = true
|
this.chartLoading = true
|
||||||
let chartInfo = {}
|
let chartInfo = {}
|
||||||
|
const severityData = JSON.parse(localStorage.getItem('nz-severityDataWeight'))
|
||||||
|
const conditionArr = JSON.parse(this.currentMsg.alertRule.condition)
|
||||||
if (this.currentMsg.alertRule.type === 1 || this.currentMsg.alertRule.type === 3) {
|
if (this.currentMsg.alertRule.type === 1 || this.currentMsg.alertRule.type === 3) {
|
||||||
chartInfo = lodash.cloneDeep(lineData)
|
chartInfo = lodash.cloneDeep(lineData)
|
||||||
chartInfo.elements = [{}]
|
chartInfo.elements = [{}]
|
||||||
if (!isNaN(this.currentMsg.alertRule.threshold)) {
|
if (conditionArr.length) {
|
||||||
chartInfo.param.enable.thresholds = true
|
chartInfo.param.enable.thresholds = true
|
||||||
chartInfo.param.thresholds = [{
|
chartInfo.param.thresholds = conditionArr.map(item => {
|
||||||
value: this.currentMsg.alertRule.threshold,
|
const findItem = severityData.find(severity => severity.id === item.id)
|
||||||
color: '#d64f40'
|
if (findItem) {
|
||||||
}]
|
item.color = findItem.color
|
||||||
|
item.label = findItem.name
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}).filter(item => item.value)
|
||||||
}
|
}
|
||||||
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, ''))
|
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, ''))
|
||||||
} else if (this.currentMsg.alertRule.type === 2) {
|
} else if (this.currentMsg.alertRule.type === 2) {
|
||||||
chartInfo = lodash.cloneDeep(logData)
|
chartInfo = lodash.cloneDeep(logData)
|
||||||
chartInfo.elements = [{}]
|
chartInfo.elements = [{}]
|
||||||
if (!isNaN(this.currentMsg.alertRule.threshold)) {
|
if (conditionArr.length) {
|
||||||
chartInfo.param.enable.thresholds = true
|
chartInfo.param.enable.thresholds = true
|
||||||
chartInfo.param.thresholds = [{
|
chartInfo.param.thresholds = conditionArr.map(item => {
|
||||||
value: this.currentMsg.alertRule.threshold,
|
const findItem = severityData.find(severity => severity.id === item.id)
|
||||||
color: '#d64f40'
|
if (findItem) {
|
||||||
}]
|
item.color = findItem.color
|
||||||
|
item.label = findItem.name
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}).filter(item => item.value)
|
||||||
}
|
}
|
||||||
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\r|\n+/g, ''))
|
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\r|\n+/g, ''))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -718,26 +718,37 @@ export default {
|
|||||||
queryDate () {
|
queryDate () {
|
||||||
this.chartLoading = true
|
this.chartLoading = true
|
||||||
let chartInfo = {}
|
let chartInfo = {}
|
||||||
|
const severityData = JSON.parse(localStorage.getItem('nz-severityDataWeight'))
|
||||||
|
const conditionArr = JSON.parse(this.currentMsg.alertRule.condition)
|
||||||
|
console.log(this.currentMsg.alertRule.condition, this.severityData)
|
||||||
if (this.currentMsg.alertRule.type === 1 || this.currentMsg.alertRule.type === 3) {
|
if (this.currentMsg.alertRule.type === 1 || this.currentMsg.alertRule.type === 3) {
|
||||||
chartInfo = lodash.cloneDeep(lineData)
|
chartInfo = lodash.cloneDeep(lineData)
|
||||||
chartInfo.elements = [{}]
|
chartInfo.elements = [{}]
|
||||||
if (!isNaN(this.currentMsg.alertRule.threshold)) {
|
if (conditionArr.length) {
|
||||||
chartInfo.param.enable.thresholds = true
|
chartInfo.param.enable.thresholds = true
|
||||||
chartInfo.param.thresholds = [{
|
chartInfo.param.thresholds = conditionArr.map(item => {
|
||||||
value: this.currentMsg.alertRule.threshold,
|
const findItem = severityData.find(severity => severity.id === item.id)
|
||||||
color: '#d64f40'
|
if (findItem) {
|
||||||
}]
|
item.color = findItem.color
|
||||||
|
item.label = findItem.name
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}).filter(item => item.value)
|
||||||
}
|
}
|
||||||
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, ''))
|
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, ''))
|
||||||
} else if (this.currentMsg.alertRule.type === 2) {
|
} else if (this.currentMsg.alertRule.type === 2) {
|
||||||
chartInfo = lodash.cloneDeep(logData)
|
chartInfo = lodash.cloneDeep(logData)
|
||||||
chartInfo.elements = [{}]
|
chartInfo.elements = [{}]
|
||||||
if (!isNaN(this.currentMsg.alertRule.threshold)) {
|
if (conditionArr.length) {
|
||||||
chartInfo.param.enable.thresholds = true
|
chartInfo.param.enable.thresholds = true
|
||||||
chartInfo.param.thresholds = [{
|
chartInfo.param.thresholds = conditionArr.map(item => {
|
||||||
value: this.currentMsg.alertRule.threshold,
|
const findItem = severityData.find(severity => severity.id === item.id)
|
||||||
color: '#d64f40'
|
if (findItem) {
|
||||||
}]
|
item.color = findItem.color
|
||||||
|
item.label = findItem.name
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}).filter(item => item.value)
|
||||||
}
|
}
|
||||||
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\r|\n+/g, ''))
|
chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\r|\n+/g, ''))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user