feat : 添加alertMessageinfo detail
This commit is contained in:
@@ -73,6 +73,23 @@
|
|||||||
.el-tabs__nav{
|
.el-tabs__nav{
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
.info-box-header{
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.info-box-title{
|
||||||
|
font-size: 16px;
|
||||||
|
color: $--color-text-primary;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.info-box-content{
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666666;
|
||||||
|
font-weight: 400;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="">
|
<div class="info-box-header">
|
||||||
<div v-for="item in cardNames" :key="item.key" v-if="infoData[item.key]">
|
<div v-for="item in cardNames" :key="item.key" v-if="infoData[item.key]">
|
||||||
<div>{{item.label}}</div>
|
<div class="info-box-title">{{item.label}}</div>
|
||||||
<div v-if="item.key === 'summary' || item.key === 'remark'">
|
<div v-if="item.key === 'summary' || item.key === 'remark'" class="info-box-content">
|
||||||
{{infoData[item.key]}}
|
{{infoData[item.key]}}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item.key==='labels'">
|
<div v-if="item.key==='labels'" class="info-box-content">
|
||||||
labels
|
<span v-for="(item, i) in labelsSort(infoData.labels)" :key="i">
|
||||||
|
<span
|
||||||
|
@mouseenter="labelHover(infoData, item.label, true, true, $event)"
|
||||||
|
@mouseleave="labelHover(infoData, item.label, false, true,)">
|
||||||
|
<nz-alert-tag
|
||||||
|
v-if="item.label !== 'alertname' && item.label !== 'severity'" :key="item.label" :cursor-point="tagType(item.label) !== 'info'"
|
||||||
|
:label="item.label"
|
||||||
|
:type="tagType(item.label)"
|
||||||
|
style="margin: 5px 0 5px 5px;"
|
||||||
|
>
|
||||||
|
{{item.value}}
|
||||||
|
</nz-alert-tag>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item.key==='startAt'">
|
<div v-if="item.key==='startAt'" class="info-box-content">
|
||||||
{{utcTimeToTimezoneStr(infoData[item.key])}}
|
{{utcTimeToTimezoneStr(infoData[item.key])}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<alertLabel
|
||||||
|
v-if="alertLabelShow"
|
||||||
|
:id="alertLabelId"
|
||||||
|
:that="alertLabelObj"
|
||||||
|
:type="alertLabelType"
|
||||||
|
></alertLabel>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import alertMessageLabelMixin from '@/components/common/alert/alertMessageLabelMixin'
|
||||||
|
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'alertMessageInfoDetail',
|
name: 'alertMessageInfoDetail',
|
||||||
props: {
|
props: {
|
||||||
@@ -23,6 +44,7 @@ export default {
|
|||||||
type: Object
|
type: Object
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mixins: [alertMessageLabelMixin, alertLabelMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
cardNames: [
|
cardNames: [
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import nzAlertTag from '@/components/page/alert/nzAlertTag'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
nzAlertTag
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
exclusiveLabels: ['_id', 'severity', '__name__']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tagType () {
|
||||||
|
return (key) => {
|
||||||
|
if (key == 'asset' || key == 'module' || key == 'project' || key == 'dc' || key == 'endpoint') {
|
||||||
|
return 'normal'
|
||||||
|
} else {
|
||||||
|
return 'info'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tagValue () {
|
||||||
|
return (key, value) => {
|
||||||
|
if (key == 'type') {
|
||||||
|
if (value == 1) {
|
||||||
|
value = this.$t('project.project.projectName')
|
||||||
|
} else if (value == 2) {
|
||||||
|
value = this.$t('module.module.module')
|
||||||
|
} else if (value == 3) {
|
||||||
|
value = this.$t('asset.asset')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return key + ':' + value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
labelsSort (obj) {
|
||||||
|
const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'datacenter', 'project', 'parent_asset', 'user']
|
||||||
|
if (typeof obj === 'string') obj = JSON.parse(obj)
|
||||||
|
const labels = JSON.parse(JSON.stringify(obj))
|
||||||
|
const result = []
|
||||||
|
for (const key of this.exclusiveLabels) {
|
||||||
|
Object.keys(labels).forEach(labelsKey => {
|
||||||
|
if (labelsKey.indexOf(key) !== -1) {
|
||||||
|
delete labels[labelsKey]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for (const key of buildIn) {
|
||||||
|
if (key in labels) {
|
||||||
|
if (key === 'datacenter') {
|
||||||
|
result.push({ label: 'dc', value: labels.datacenter })
|
||||||
|
delete labels.datacenter
|
||||||
|
} else {
|
||||||
|
result.push({ label: key, value: labels[key] })
|
||||||
|
}
|
||||||
|
delete labels[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object.keys(labels).sort().forEach(key => {
|
||||||
|
result.push({ label: key, value: labels[key] })
|
||||||
|
delete labels[key]
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
|
import alertLabel from '@/components/common/alert/alertLabel'
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
alertLabel
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
alertLabelShow: false,
|
alertLabelShow: false,
|
||||||
|
|||||||
@@ -139,19 +139,16 @@
|
|||||||
import bus from '../../../../libs/bus'
|
import bus from '../../../../libs/bus'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import table from '@/components/common/mixin/table'
|
import table from '@/components/common/mixin/table'
|
||||||
import nzAlertTag from '../../../page/alert/nzAlertTag'
|
|
||||||
import chartDataFormat from '../../../charts/chartDataFormat'
|
import chartDataFormat from '../../../charts/chartDataFormat'
|
||||||
import alertRuleInfo from '../../alert/alertRuleInfo'
|
import alertRuleInfo from '../../alert/alertRuleInfo'
|
||||||
import alertLabel from '../../alert/alertLabel'
|
|
||||||
import { calcDurationByStringTimeB } from '../../js/tools'
|
import { calcDurationByStringTimeB } from '../../js/tools'
|
||||||
import { alertMessage as alertMessageConstant } from '@/components/common/js/constants'
|
import { alertMessage as alertMessageConstant } from '@/components/common/js/constants'
|
||||||
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||||
|
import alertMessageLabelMixin from '@/components/common/alert/alertMessageLabelMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'alertMessageTable',
|
name: 'alertMessageTable',
|
||||||
components: {
|
components: {
|
||||||
nzAlertTag,
|
|
||||||
alertRuleInfo: alertRuleInfo,
|
alertRuleInfo: alertRuleInfo,
|
||||||
alertLabel: alertLabel
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
nowTime: {
|
nowTime: {
|
||||||
@@ -165,7 +162,7 @@ export default {
|
|||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
chartAlertList: Boolean
|
chartAlertList: Boolean
|
||||||
},
|
},
|
||||||
mixins: [table, bus, alertLabelMixin],
|
mixins: [table, bus, alertLabelMixin, alertMessageLabelMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
/* 二级列表相关 */
|
/* 二级列表相关 */
|
||||||
@@ -176,7 +173,6 @@ export default {
|
|||||||
graphShow: false,
|
graphShow: false,
|
||||||
chartDatas: [],
|
chartDatas: [],
|
||||||
sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'dc'],
|
sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'dc'],
|
||||||
exclusiveLabels: ['_id', 'severity', '__name__'],
|
|
||||||
legend: [],
|
legend: [],
|
||||||
searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],
|
searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],
|
||||||
currentMsg: {},
|
currentMsg: {},
|
||||||
@@ -254,29 +250,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
tagType () {
|
|
||||||
return (key) => {
|
|
||||||
if (key == 'asset' || key == 'module' || key == 'project' || key == 'dc' || key == 'endpoint') {
|
|
||||||
return 'normal'
|
|
||||||
} else {
|
|
||||||
return 'info'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tagValue () {
|
|
||||||
return (key, value) => {
|
|
||||||
if (key == 'type') {
|
|
||||||
if (value == 1) {
|
|
||||||
value = this.$t('project.project.projectName')
|
|
||||||
} else if (value == 2) {
|
|
||||||
value = this.$t('module.module.module')
|
|
||||||
} else if (value == 3) {
|
|
||||||
value = this.$t('asset.asset')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return key + ':' + value
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getDuration () {
|
getDuration () {
|
||||||
return function (record) {
|
return function (record) {
|
||||||
if (record.endAt) {
|
if (record.endAt) {
|
||||||
@@ -297,35 +270,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
labelsSort (obj) {
|
|
||||||
const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'datacenter', 'project', 'parent_asset', 'user']
|
|
||||||
if (typeof obj === 'string') obj = JSON.parse(obj)
|
|
||||||
const labels = JSON.parse(JSON.stringify(obj))
|
|
||||||
const result = []
|
|
||||||
for (const key of this.exclusiveLabels) {
|
|
||||||
Object.keys(labels).forEach(labelsKey => {
|
|
||||||
if (labelsKey.indexOf(key) !== -1) {
|
|
||||||
delete labels[labelsKey]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
for (const key of buildIn) {
|
|
||||||
if (key in labels) {
|
|
||||||
if (key === 'datacenter') {
|
|
||||||
result.push({ label: 'dc', value: labels.datacenter })
|
|
||||||
delete labels.datacenter
|
|
||||||
} else {
|
|
||||||
result.push({ label: key, value: labels[key] })
|
|
||||||
}
|
|
||||||
delete labels[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Object.keys(labels).sort().forEach(key => {
|
|
||||||
result.push({ label: key, value: labels[key] })
|
|
||||||
delete labels[key]
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
},
|
|
||||||
chartUnitChange: function (unit) {
|
chartUnitChange: function (unit) {
|
||||||
this.chartUnit = unit
|
this.chartUnit = unit
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user