diff --git a/nezha-fronted/src/assets/css/components/common/alert/alertMessageInfo.scss b/nezha-fronted/src/assets/css/components/common/alert/alertMessageInfo.scss new file mode 100644 index 000000000..b6425b44a --- /dev/null +++ b/nezha-fronted/src/assets/css/components/common/alert/alertMessageInfo.scss @@ -0,0 +1,31 @@ +.chart-fullscreen.nz-dialog .panel-chart--fullscreen{ + .alert-message-info-header{ + border-bottom: 1px solid rgba(0,0,0,0.09);; + padding-bottom: 20px; + } + .alert-message-info-box{ + padding: 20px; + display: flex; + width: 100%; + height: 100%; + overflow-y: auto; + .info-box-left{ + width: 66%; + min-width: 500px; + min-height: 600px; + margin-right: 20px; + .nz-chart { + height: 36%; + margin-bottom: 20px; + border: 1px solid $--border-color-light; + } + .alert-message-info-tab{ + flex: 1; + } + } + .info-box-right{ + flex: 1; + } + } +} + diff --git a/nezha-fronted/src/assets/css/components/index.scss b/nezha-fronted/src/assets/css/components/index.scss index 5035175e9..58b86386d 100644 --- a/nezha-fronted/src/assets/css/components/index.scss +++ b/nezha-fronted/src/assets/css/components/index.scss @@ -5,6 +5,7 @@ @import './common/alert/alertLabel.scss'; @import './common/alert/alertRuleInfo.scss'; @import './common/alert/selectAlertSilence.scss'; +@import './common/alert/alertMessageInfo.scss'; @import './common/alert/alertDaysInfo.scss'; @import './common/bottomBox/bottomBox.scss'; @import './common/bottomBox/panelTabNew.scss'; diff --git a/nezha-fronted/src/components/chart/ChartScreenHeader.vue b/nezha-fronted/src/components/chart/ChartScreenHeader.vue index a941da521..8d4ee025d 100644 --- a/nezha-fronted/src/components/chart/ChartScreenHeader.vue +++ b/nezha-fronted/src/components/chart/ChartScreenHeader.vue @@ -26,7 +26,10 @@ -
{{chartInfo.name}}
+
+ + {{chartInfo.name}} +
diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue index 7de2e3200..6dd01ca81 100644 --- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue @@ -72,6 +72,15 @@ export default { methods: { initChart (chartOptions = this.chartOption) { const chartOption = lodash.cloneDeep(chartOptions) + if (this.chartInfo.isAlertMessage) { + chartOption.title = { + show: true, + text: this.$t('project.endpoint.dialogTitle'), + top: 20 + } + chartOption.grid.top = 70 + chartOption.toolbox.top = 20 + } this.legends = [] this.series = chartOption.series = this.handleTimeSeries(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends if (!this.series.length) { diff --git a/nezha-fronted/src/components/common/alert/alertMessageInfo.vue b/nezha-fronted/src/components/common/alert/alertMessageInfo.vue new file mode 100644 index 000000000..fc77df4ab --- /dev/null +++ b/nezha-fronted/src/components/common/alert/alertMessageInfo.vue @@ -0,0 +1,330 @@ + + + diff --git a/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue b/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue new file mode 100644 index 000000000..29100db04 --- /dev/null +++ b/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue @@ -0,0 +1,26 @@ + + + + + diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 3b32c088c..3b01328dc 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -113,7 +113,7 @@ fullscreen :modal-append-to-body="false" > - + > { this.currentMsg = { ...row, alertRule: { ...res.data } } this.$nextTick(() => { @@ -606,8 +603,9 @@ export default { }, queryDate () { this.chartLoading = true + let chartInfo = {} if (this.currentMsg.alertRule.type === 1) { - const chartInfo = lodash.cloneDeep(lineData) + chartInfo = lodash.cloneDeep(lineData) chartInfo.elements = [{}] if (!isNaN(this.currentMsg.alertRule.threshold)) { chartInfo.param.enable.thresholds = true @@ -616,12 +614,8 @@ export default { color: '#d64f40' }] } - chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '') - chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))) - chartInfo.unit = this.currentMsg.alertRule.unit - this.showFullscreen(true, chartInfo) } else if (this.currentMsg.alertRule.type === 2) { - const chartInfo = lodash.cloneDeep(logData) + chartInfo = lodash.cloneDeep(logData) chartInfo.elements = [{}] if (!isNaN(this.currentMsg.alertRule.threshold)) { chartInfo.param.enable.thresholds = true @@ -630,11 +624,13 @@ export default { color: '#d64f40' }] } - chartInfo.elements[0].expression = encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '')) - chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))) - chartInfo.unit = this.currentMsg.alertRule.unit - this.showFullscreen(true, chartInfo) } + chartInfo.name = this.currentMsg.alertRule.name + chartInfo.isAlertMessage = true + chartInfo.elements && (chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '')) + chartInfo.elements && (chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels)))) + chartInfo.unit = this.currentMsg.alertRule.unit + this.showFullscreen(true, chartInfo) }, exportLog ({ limit, descending }) { const start = this.searchTimeDialog[0] ? this.searchTimeDialog[0] : bus.computeTimezoneTime(new Date().getTime() - 1 * 60 * 60 * 1000)