diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index 44af0d61a..cd8c87526 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -1414,7 +1414,6 @@ export default { // 设置图表的尺寸 setChartSize (item, index) { - // console.log(item) this.$nextTick(() => { const chartBox = document.getElementById('chart-' + item.id) if (chartBox) { diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index b508f2185..cf436f35c 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -77,6 +77,20 @@ :chart-index="index" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" :chart-data="item"> + 0) { + if (filterType === 'showFullScreen') { // 全屏查询 + this.$refs['editChart' + chartItem.id][0].setData(chartItem, null, + this.filter.panelId, null, filterType) + } else { + this.$refs['editChart' + chartItem.id][0].setData(chartItem, null, + this.filter.panelId, null, '') + } + } + return + } if (this.isModel) { this.modelStaticData(chartInfo, filterType) } else { @@ -890,6 +925,8 @@ export default { if (numInterval >= 60000) { // 大于1分钟,则start、end均往后移numInterval,否则时间不变 startTime = this.getNewTime(this.filter.start_time, numInterval) endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') + this.filter.start_time = startTime + this.filter.end_time = endTime } else { startTime = this.filter.start_time endTime = this.filter.end_time @@ -918,6 +955,9 @@ export default { if (this.from === fromRoute.chartTemp) { return chartTempData } + if (chartInfo.type == 'logs') { + return chartTempData + } return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step) }) // 一个图表的所有element单独获取数据 @@ -1186,6 +1226,14 @@ export default { this.$refs['editChart' + chartItem.id][0].setData(chartItem, singleStatRlt, this.filter.panelId, this.filter, '', errorMsg) } + } else if (chartItem.type === 'logs') { + if (filterType === 'showFullScreen') { // 全屏查询 + this.$refs['editChart' + chartItem.id][0].setData(chartItem, singleStatRlt, + this.filter.panelId, this.filter, filterType, errorMsg) + } else { + this.$refs['editChart' + chartItem.id][0].setData(chartItem, singleStatRlt, + this.filter.panelId, this.filter, '', errorMsg) + } } } } else { @@ -1215,6 +1263,14 @@ export default { this.$refs['editChart' + chartItem.id][0].setData(chartItem, '', this.filter.panelId, this.filter) } + } else if (chartItem.type === 'logs') { + if (filterType === 'showFullScreen') { // 全屏查询 + this.$refs['editChart' + chartItem.id][0].setData(chartItem, '', + this.filter.panelId, this.filter, filterType) + } else { + this.$refs['editChart' + chartItem.id][0].setData(chartItem, '', + this.filter.panelId, this.filter) + } } } } @@ -1361,6 +1417,14 @@ export default { this.$refs['editChart' + chartInfo.id][0].setData(chartInfo, singleStatRlt, this.filter.panelId, this.filter, '', errorMsg) } + } else if (chartInfo.type === 'logs') { + if (filterType === 'showFullScreen') { // 全屏查询 + this.$refs['editChart' + chartInfo.id][0].setData(chartInfo, singleStatRlt, + this.filter.panelId, this.filter, filterType, errorMsg) + } else { + this.$refs['editChart' + chartInfo.id][0].setData(chartInfo, singleStatRlt, + this.filter.panelId, this.filter, '', errorMsg) + } } } }, diff --git a/nezha-fronted/src/components/charts/logs.vue b/nezha-fronted/src/components/charts/logs.vue new file mode 100644 index 000000000..82e878917 --- /dev/null +++ b/nezha-fronted/src/components/charts/logs.vue @@ -0,0 +1,710 @@ + + + + + diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 09cc14501..1819705aa 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -314,6 +314,9 @@ const cn = { }, group: { label: '组' + }, + logs: { + label: '日志' } }, statisticsVal: { diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 3d1cb418a..d618f3912 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -330,6 +330,9 @@ const en = { }, group: { label: 'Group' + }, + logs: { + label: 'Logs' } }, statisticsVal: { diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue index fa9731e13..3f646113e 100644 --- a/nezha-fronted/src/components/page/dashboard/chartBox.vue +++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue @@ -287,7 +287,7 @@ --> - + {{item.label}} @@ -312,6 +312,33 @@ + + + + + + + + + + + +
@@ -350,6 +377,7 @@ :expression-list="expressions" :id="promqlKeys[index-1]" :index="index-1" + :type="promqlType" :key="promqlKeys[index-1]" :plugins="['metric-selector', 'metric-input', 'remove']" :ref="'promql-'+(index-1)" @@ -596,6 +624,10 @@ export default { id: 'alertList', name: this.$t('dashboard.panel.chartForm.typeVal.alertList.label') }, + { + id: 'logs', + name: this.$t('dashboard.panel.chartForm.typeVal.logs.label') + }, { id: 'text', name: this.$t('dashboard.panel.chartForm.typeVal.text.label') @@ -651,7 +683,8 @@ export default { { name: 'Asset', id: 1 }, { name: 'Endpoint', id: 2 } ], - topologyDialog: false + topologyDialog: false, + promqlType: 'metric' // metricStore: [] } }, @@ -1436,6 +1469,7 @@ export default { const chartType = this.editChart.type this.editChart.param.url = '' this.editChart.height = 4 + this.promqlType = 'metric' if (chartType === 'url') { this.setIsUrl() /* if(this.$refs.chartTag){ @@ -1490,6 +1524,8 @@ export default { this.showPicker = [{ bac: false, text: false }] this.statisticsList = JSON.parse(JSON.stringify(this.$CONSTANTS.statisticsList)) this.statisticsList.push({ value: 'null', label: i18n.t('dashboard.panel.chartForm.statisticsVal.null') }) + } else if (chartType == 'logs') { + this.promqlType = 'log' } /* if(this.$refs.chartTag){ this.$refs.chartTag.forEach((item, index) => { diff --git a/nezha-fronted/src/components/page/dashboard/explore/logTab.vue b/nezha-fronted/src/components/page/dashboard/explore/logTab.vue index 3ca927935..5a245cc69 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/logTab.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/logTab.vue @@ -1,7 +1,7 @@