NEZ-3248 fix:Explore Logs 数据源模式下点击 分屏,请求异常
This commit is contained in:
@@ -83,6 +83,7 @@ export default {
|
||||
momentTz (timestamp, fmt) { // moment 转化时间戳为str
|
||||
const offset = localStorage.getItem('nz-sys-timezone')
|
||||
const format = fmt || localStorage.getItem('nz-default-dateFormat')
|
||||
console.log(timestamp, fmt, offset, localStorage.getItem('nz-default-dateFormat'), format)
|
||||
return moment.tz(timestamp, offset).format(format)
|
||||
},
|
||||
momentStrToTimestamp (str, fmt) {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
{{scope.row.type ? scope.row.type.category : '-'}}
|
||||
</div>
|
||||
</template>
|
||||
<span v-else-if="item.prop === 'production_date' || item.prop === 'expiration_date'">{{ scope.row[item.prop] ? momentTz(scope.row[item.prop]) : '-'}}</span>
|
||||
<span v-else-if="item.prop === 'production_date' || item.prop === 'expiration_date'">{{ scope.row[item.prop] ? momentTz(scope.row[item.prop] * 1000) : '-'}}</span>
|
||||
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
|
||||
@@ -3887,7 +3887,7 @@ export default {
|
||||
const requestArr = []
|
||||
// 过滤掉state为0的元素
|
||||
this.expressions.forEach((item, index) => {
|
||||
if (item != '' && this.promqlKeys[index].state) {
|
||||
if (item != '' && this.promqlKeys[index].state && item) {
|
||||
requestArr.push(this.$get('/logs/loki/api/v1/query_range?format=1&query=' + encodeURIComponent(item) + '&start=' + this.$stringTimeParseToUnix(bus.formateTimeToTime(this.filterTime[0])) + '&end=' + this.$stringTimeParseToUnix(bus.formateTimeToTime(this.filterTime[1])) + '&limit=' + limit))
|
||||
}
|
||||
})
|
||||
@@ -4369,7 +4369,8 @@ export default {
|
||||
} else {
|
||||
const promiseArr = []
|
||||
this.expressions.forEach((item, index) => {
|
||||
if (item != '' && this.promqlKeys[index].state) {
|
||||
console.log(item)
|
||||
if (item != '' && this.promqlKeys[index].state && item) {
|
||||
promiseArr.push(this.$get('logs/loki/api/v1/format_query', { query: item }))
|
||||
} else {
|
||||
promiseArr.push('')
|
||||
@@ -4384,6 +4385,7 @@ export default {
|
||||
this.updatePath()
|
||||
},
|
||||
initQueryFromPath () {
|
||||
console.log('initQueryFromPath')
|
||||
const param = this.$route.query[this.position]
|
||||
if (param) {
|
||||
const data = JSON.parse(param)
|
||||
@@ -4409,6 +4411,7 @@ export default {
|
||||
this.promqlCount = data.queries.length
|
||||
data.queries.forEach((item, index) => {
|
||||
this.$set(this.expressions, index, item.expr)
|
||||
console.log(item)
|
||||
this.promqlKeys[index] = {
|
||||
...item,
|
||||
id: getUUID(),
|
||||
@@ -4426,7 +4429,11 @@ export default {
|
||||
const queries = this.expressions.map((item, index) => {
|
||||
return {
|
||||
expr: item,
|
||||
state: this.promqlKeys[index].state
|
||||
state: this.promqlKeys[index].state,
|
||||
oldName: this.promqlKeys[index].oldName,
|
||||
legend: this.promqlKeys[index].legend,
|
||||
step: this.promqlKeys[index].step,
|
||||
queryType: this.promqlKeys[index].queryType
|
||||
}
|
||||
})
|
||||
const q = {
|
||||
|
||||
@@ -421,13 +421,14 @@ export default {
|
||||
})
|
||||
this.expressionChange()
|
||||
} else {
|
||||
this.expressions.push(item.expression)
|
||||
this.expressionName.push(item.name)
|
||||
const expressionName = this.getExpressionName()
|
||||
this.expressions.push(item.expression || item.expr || '')
|
||||
this.expressionName.push(item.name || expressionName)
|
||||
this.expressionsShow.push({
|
||||
id: getUUID(),
|
||||
show: true,
|
||||
hideInput: true,
|
||||
oldName: item.name,
|
||||
oldName: item.name || expressionName,
|
||||
error: '',
|
||||
elementId: item.id,
|
||||
legend: item.legend,
|
||||
|
||||
@@ -380,7 +380,7 @@ export default {
|
||||
this.myChart.clear()
|
||||
this.myChart.setOption(option)
|
||||
this.$nextTick(() => {
|
||||
this.myChart.resize()
|
||||
this.myChart?.resize()
|
||||
})
|
||||
/* 点击legend
|
||||
* 1.当前如果是全高亮状态,则全部置灰,只留被点击的legend高亮
|
||||
@@ -424,7 +424,7 @@ export default {
|
||||
this.myChart.clear()
|
||||
this.myChart.setOption(option)
|
||||
this.$nextTick(() => {
|
||||
this.myChart.resize()
|
||||
this.myChart?.resize()
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -531,7 +531,7 @@ export default {
|
||||
},
|
||||
resizeChart () {
|
||||
setTimeout(() => {
|
||||
this.myChart.resize()
|
||||
this.myChart?.resize()
|
||||
})
|
||||
},
|
||||
aliasLegend (row) {
|
||||
|
||||
Reference in New Issue
Block a user