diff --git a/nezha-fronted/src/components/common/mixin/mainMixinFun.js b/nezha-fronted/src/components/common/mixin/mainMixinFun.js
index 24356f389..f62e1cb57 100644
--- a/nezha-fronted/src/components/common/mixin/mainMixinFun.js
+++ b/nezha-fronted/src/components/common/mixin/mainMixinFun.js
@@ -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) {
diff --git a/nezha-fronted/src/components/common/table/asset/licenseMangeTable.vue b/nezha-fronted/src/components/common/table/asset/licenseMangeTable.vue
index 50a8a5f6b..868c2899b 100644
--- a/nezha-fronted/src/components/common/table/asset/licenseMangeTable.vue
+++ b/nezha-fronted/src/components/common/table/asset/licenseMangeTable.vue
@@ -60,7 +60,7 @@
{{scope.row.type ? scope.row.type.category : '-'}}
- {{ scope.row[item.prop] ? momentTz(scope.row[item.prop]) : '-'}}
+ {{ scope.row[item.prop] ? momentTz(scope.row[item.prop] * 1000) : '-'}}
{{scope.row[item.prop]}}
-
diff --git a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
index aaa46cd63..0817e249a 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
+++ b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
@@ -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 = {
diff --git a/nezha-fronted/src/components/page/dashboard/explore/exploreItemMixin.js b/nezha-fronted/src/components/page/dashboard/explore/exploreItemMixin.js
index 4ddcbdeaa..9d1b9bebd 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/exploreItemMixin.js
+++ b/nezha-fronted/src/components/page/dashboard/explore/exploreItemMixin.js
@@ -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,
diff --git a/nezha-fronted/src/components/page/dashboard/explore/logTab.vue b/nezha-fronted/src/components/page/dashboard/explore/logTab.vue
index 4b4586552..00e0583dd 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/logTab.vue
+++ b/nezha-fronted/src/components/page/dashboard/explore/logTab.vue
@@ -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) {