Merge branch 'dev-2.0' of https://git.mesalab.cn/nezha/nezha-fronted into dev-2.0
This commit is contained in:
@@ -605,7 +605,8 @@ const cn = {
|
|||||||
confirmCancel: '您所做的修改将不会被保存?',
|
confirmCancel: '您所做的修改将不会被保存?',
|
||||||
copySuccess: '复制成功',
|
copySuccess: '复制成功',
|
||||||
lnglatError: '经纬度格式错误',
|
lnglatError: '经纬度格式错误',
|
||||||
tagError: '不符合正则 /^[a-zA-Z_][a-zA-Z0-9_]*/!'
|
tagError: '不符合正则 /^[a-zA-Z_][a-zA-Z0-9_]*/!',
|
||||||
|
syntaxError: '语法错误'
|
||||||
},
|
},
|
||||||
asset: {
|
asset: {
|
||||||
asset: '资产',
|
asset: '资产',
|
||||||
|
|||||||
@@ -612,7 +612,9 @@ const en = {
|
|||||||
confirmCancel: 'Changes you made are not saved?',
|
confirmCancel: 'Changes you made are not saved?',
|
||||||
copySuccess: 'Copy success',
|
copySuccess: 'Copy success',
|
||||||
lnglatError: 'Wrong format of latitude and longitude',
|
lnglatError: 'Wrong format of latitude and longitude',
|
||||||
tagError: 'Does not conform to regular expressions /^[a-zA-Z_][a-zA-Z0-9_]*/!'
|
tagError: 'Does not conform to regular expressions /^[a-zA-Z_][a-zA-Z0-9_]*/!',
|
||||||
|
syntaxError: 'Syntax error',
|
||||||
|
errorInRow: 'There are some syntax errors in rows'
|
||||||
},
|
},
|
||||||
asset: {
|
asset: {
|
||||||
asset: 'Asset ',
|
asset: 'Asset ',
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div class="explores">
|
<div class="explores">
|
||||||
<explore-item
|
<explore-item
|
||||||
v-for="item in exploreItems"
|
v-for="item in exploreItems"
|
||||||
|
ref="exploreItem"
|
||||||
:key="item"
|
:key="item"
|
||||||
:closable="closable"
|
:closable="closable"
|
||||||
:tab-index="item"
|
:tab-index="item"
|
||||||
@@ -38,6 +39,12 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.exploreItems.push(index === 0 ? 1 : 0)
|
this.exploreItems.push(index === 0 ? 1 : 0)
|
||||||
}
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.exploreItem.forEach(e => {
|
||||||
|
const component = e.$refs.logDetail
|
||||||
|
component && component.resizeChart()
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item v-if="showTab.indexOf('2') > -1" name="2" title="Logs">
|
<el-collapse-item v-if="showTab.indexOf('2') > -1" name="2" title="Logs">
|
||||||
<log-tab ref="logDetail" :log-data="logData" @exportLog="exportLog" @limitChange="queryLogData"></log-tab>
|
<log-tab ref="logDetail" :log-data="logData" :tab-index="tabIndex" @exportLog="exportLog" @limitChange="queryLogData"></log-tab>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</template>
|
</template>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
@@ -530,7 +530,7 @@ export default {
|
|||||||
},
|
},
|
||||||
queryLogData (limit) { // log的chart和table是一个请求
|
queryLogData (limit) { // log的chart和table是一个请求
|
||||||
if (!limit) {
|
if (!limit) {
|
||||||
limit = this.$refs.logDetail.getLimit()
|
limit = this.$refs.logDetail ? this.$refs.logDetail.getLimit() : 1000
|
||||||
}
|
}
|
||||||
if (this.expressions.length > 0) {
|
if (this.expressions.length > 0) {
|
||||||
const requestArr = []
|
const requestArr = []
|
||||||
@@ -544,6 +544,17 @@ export default {
|
|||||||
this.saveDisabled = false
|
this.saveDisabled = false
|
||||||
}
|
}
|
||||||
axios.all(requestArr).then(res => {
|
axios.all(requestArr).then(res => {
|
||||||
|
const errorRowIndex = []
|
||||||
|
res.forEach((r, i) => {
|
||||||
|
if (typeof r === 'string') {
|
||||||
|
errorRowIndex.push(i)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (errorRowIndex.length > 0) {
|
||||||
|
this.$message.error(this.$t('tip.errorInRow') + ': ' + errorRowIndex.map(e => e + 1).join(' ,'))
|
||||||
|
res = res.filter((r, i) => errorRowIndex.indexOf(i) === -1)
|
||||||
|
}
|
||||||
|
if (res.length > 0) {
|
||||||
this.logData = res.map(r => r.data)
|
this.logData = res.map(r => r.data)
|
||||||
const hasGraph = this.logData.some(d => d.resultType === 'matrix')
|
const hasGraph = this.logData.some(d => d.resultType === 'matrix')
|
||||||
const hasLog = this.logData.some(d => d.resultType === 'streamsFormat')
|
const hasLog = this.logData.some(d => d.resultType === 'streamsFormat')
|
||||||
@@ -570,6 +581,9 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
hasGraph && this.loadLogGraph()
|
hasGraph && this.loadLogGraph()
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
this.$message.error(this.$t('terminallog.statusItem.unknownError'))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="log-detail">
|
<div class="log-detail">
|
||||||
<div id="logChart" class="log-chart"></div>
|
<div :id="`logChart${tabIndex}`" class="log-chart"></div>
|
||||||
<div class="log-operations">
|
<div class="log-operations">
|
||||||
<div class="log-operation">
|
<div class="log-operation">
|
||||||
<span class="operation-label">{{$t('overall.time')}}</span>
|
<span class="operation-label">{{$t('overall.time')}}</span>
|
||||||
@@ -77,7 +77,8 @@ import * as echarts from 'echarts'
|
|||||||
export default {
|
export default {
|
||||||
name: 'logTab',
|
name: 'logTab',
|
||||||
props: {
|
props: {
|
||||||
logData: Array
|
logData: Array,
|
||||||
|
tabIndex: Number
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
tableTimeFormat () {
|
tableTimeFormat () {
|
||||||
@@ -175,7 +176,8 @@ export default {
|
|||||||
return this.timezoneToUtcTimeStr(this.toMillisecondTime(timestamp))
|
return this.timezoneToUtcTimeStr(this.toMillisecondTime(timestamp))
|
||||||
},
|
},
|
||||||
loadChart () {
|
loadChart () {
|
||||||
const dom = document.getElementById('logChart')
|
const vm = this
|
||||||
|
const dom = document.getElementById(`logChart${this.tabIndex}`)
|
||||||
if (!dom) {
|
if (!dom) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -222,7 +224,9 @@ export default {
|
|||||||
axisLabel: {
|
axisLabel: {
|
||||||
rotate: 0,
|
rotate: 0,
|
||||||
fontSize: 13 * window.devicePixelRatio,
|
fontSize: 13 * window.devicePixelRatio,
|
||||||
formatter: '{HH}:{mm}:{ss}'
|
formatter (value) {
|
||||||
|
return vm.$unixTimeParseToString(vm.toMillisecondTime(value) / 1000, 'hh:mm')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
boundaryGap: [0, '1%']
|
boundaryGap: [0, '1%']
|
||||||
},
|
},
|
||||||
@@ -388,6 +392,9 @@ export default {
|
|||||||
},
|
},
|
||||||
getLimit () {
|
getLimit () {
|
||||||
return this.limit
|
return this.limit
|
||||||
|
},
|
||||||
|
resizeChart () {
|
||||||
|
this.myChart.resize()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
Reference in New Issue
Block a user