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