From 19dabef1abacb85c51b0498694a506609078976a Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 27 Oct 2023 14:11:10 +0800 Subject: [PATCH 1/6] =?UTF-8?q?NEZ-3287=20fix=EF=BC=9AoparetionLog=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A1=86=20=E5=87=BA=E7=8E=B0=E6=84=8F?= =?UTF-8?q?=E5=A4=96=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/searchSelectInfo.js | 24 +++++++++---------- .../components/page/config/operationLog.vue | 7 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/nezha-fronted/src/components/common/searchSelectInfo.js b/nezha-fronted/src/components/common/searchSelectInfo.js index a72d8cfb6..83bb37126 100644 --- a/nezha-fronted/src/components/common/searchSelectInfo.js +++ b/nezha-fronted/src/components/common/searchSelectInfo.js @@ -158,19 +158,19 @@ export default { { value: 'download', label: i18n.t('overall.download') - }, - { - value: 'createTask', - label: i18n.t('operationlog.createTask') - }, - { - value: 'sync', - label: i18n.t('operationlog.sync') - }, - { - value: 'diagnosis', - label: i18n.t('overall.diagnosis') } + // { + // value: 'createTask', + // label: i18n.t('operationlog.createTask') + // }, + // { + // value: 'sync', + // label: i18n.t('operationlog.sync') + // }, + // { + // value: 'diagnosis', + // label: i18n.t('overall.diagnosis') + // } ], alertMessageState: [ { diff --git a/nezha-fronted/src/components/page/config/operationLog.vue b/nezha-fronted/src/components/page/config/operationLog.vue index 33f0c75df..21e7bec1e 100644 --- a/nezha-fronted/src/components/page/config/operationLog.vue +++ b/nezha-fronted/src/components/page/config/operationLog.vue @@ -66,9 +66,10 @@ export default { }, { id: 13, name: this.$t('overall.option'), - type: 'selectString', + type: 'select', label: 'operation', - disabled: false + disabled: false, + readonly: true, }, { id: 14, name: this.$t('config.operationlog.operaId'), @@ -78,7 +79,7 @@ export default { }, { id: 16, name: this.$t('config.operationlog.state'), - type: 'selectString', + type: 'select', label: 'state', readonly: true, disabled: false From a00adcf2fcb6e3451070f121f8660754918151d3 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 27 Oct 2023 15:04:05 +0800 Subject: [PATCH 2/6] =?UTF-8?q?NEZ-3286=20fix:Data=20Centers=E4=B8=AD?= =?UTF-8?q?=E7=BB=8F=E7=BA=AC=E5=BA=A6=E5=9D=90=E6=A0=87=E4=B8=BA=E8=B4=9F?= =?UTF-8?q?=E6=95=B0=E6=97=B6=EF=BC=8C=E5=88=97=E8=A1=A8=E9=A1=B5=E4=B8=AD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/table/settings/dcTable.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/common/table/settings/dcTable.vue b/nezha-fronted/src/components/common/table/settings/dcTable.vue index c4e539e7b..6acf06e4a 100644 --- a/nezha-fronted/src/components/common/table/settings/dcTable.vue +++ b/nezha-fronted/src/components/common/table/settings/dcTable.vue @@ -153,7 +153,7 @@ export default { }, data () { return { - regNum: /^[0-9]+.?[0-9]*/, + regNum: /^-[0-9]+(\\.[0-9]+)?|[0-9]+(\\.[0-9]+)?$/, needAlertDaysData: true, trendKey: 'dcId', tableTitle: [ @@ -227,7 +227,7 @@ export default { showTableTooltip, hideTableTooltip, regNumTest (val) { // 校验是否是数字 - return this.regNum.test(val) + return !isNaN(val) }, messageStyle (title, row) { if (title.prop === 'alertNum') { From 245cef19b8a966030a351a85bfcab7c16fc802de Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 27 Oct 2023 19:14:12 +0800 Subject: [PATCH 3/6] =?UTF-8?q?NEZ-3289=20fix:=20alertMessage=20=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=97=B6=20=E6=B8=85=E7=A9=BA=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/page/alert/alertMessage.vue | 69 +++++++++++++++++-- nezha-fronted/src/entrance/app/App.vue | 8 +++ 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 226ed18e6..015ef7b73 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -406,7 +406,9 @@ export default { ], errorContent: '', isError: false, - defaultPick: 10 + defaultPick: 10, + defaultPickType: 'date', + defaultPickVal: 7, } }, computed: { @@ -450,6 +452,12 @@ export default { }, methods: { renderDefaultParams () { + if (sessionStorage.getItem('nz-reload') == 1) { + this.searchTime = [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24 * 7)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))), '7d'] + this.searchLabel = {} + sessionStorage.setItem('nz-reload', 0) + return + } const q = JSON.parse(this.$route.query.body) this.state = q.state this.searchTime[0] = q.startAt ? this.momentTz(q.startAt) : '' @@ -461,46 +469,74 @@ export default { switch (this.searchTime[2]) { case '5m' : this.defaultPick = 1 + this.defaultPickType = 'minute' + this.defaultPickVal = 5 break case '15m' : this.defaultPick = 2 + this.defaultPickType = 'minute' + this.defaultPickVal = 15 break case '30m' : this.defaultPick = 3 + this.defaultPickType = 'minute' + this.defaultPickVal = 30 break case '1h' : this.defaultPick = 4 + this.defaultPickType = 'hour' + this.defaultPickVal = 1 break case '3h' : this.defaultPick = 5 + this.defaultPickType = 'hour' + this.defaultPickVal = 3 break case '6h' : this.defaultPick = 6 + this.defaultPickType = 'hour' + this.defaultPickVal = 6 break case '12h' : this.defaultPick = 7 + this.defaultPickType = 'hour' + this.defaultPickVal = 12 break - case '1d' : - this.defaultPick = 8 - break + // case '1d' : + // this.defaultPick = 8 + // this.defaultPickType = 'hour' + // break case '24h' : this.defaultPick = 8 + this.defaultPickType = 'hour' + this.defaultPickVal = 24 break case '2d' : this.defaultPick = 9 + this.defaultPickType = 'date' + this.defaultPickVal = 2 break case '7d' : this.defaultPick = 10 + this.defaultPickType = 'date' + this.defaultPickVal = 7 break case '30d' : this.defaultPick = 11 + this.defaultPickType = 'date' + this.defaultPickVal = 30 break case 'all' : this.defaultPick = 12 + this.defaultPickType = 'all' + this.defaultPickVal = 'all' break default: this.defaultPick = 0 } + if (this.defaultPick && this.defaultPick !== 12) { + this.setDefaultSearchTime('') + } // this.defaultPick = 11 }, batchAck () { @@ -825,6 +861,30 @@ export default { this.setSearchTime('searchTime') this.getTableData() }, + setDefaultSearchTime () { + const type = this.defaultPickType + const val = this.defaultPickVal + const key = 'searchTime' + if (type === 'minute') { + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) + this.$set(this[key], 0, startTime) + this.$set(this[key], 1, endTime) + this.$set(this[key], 2, val + 'm') + } else if (type === 'hour') { + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) + this.$set(this[key], 0, startTime) + this.$set(this[key], 1, endTime) + this.$set(this[key], 2, val + 'h') + } else if (type === 'date') { + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) + this.$set(this[key], 0, startTime) + this.$set(this[key], 1, endTime) + this.$set(this[key], 2, val + 'd') + } + }, getTableData (state) { if (state) { this.state = state @@ -873,6 +933,7 @@ export default { ...this.searchLabel, body: encodeURIComponent(JSON.stringify(this.searchLabel.body)) } + console.log(this.searchLabel.body) this.$get('/alert/message/query', { ...queryParams }).then(response => { this.tools.loading = false if (response.code == 200) { diff --git a/nezha-fronted/src/entrance/app/App.vue b/nezha-fronted/src/entrance/app/App.vue index 483bfa8b7..54e35de22 100644 --- a/nezha-fronted/src/entrance/app/App.vue +++ b/nezha-fronted/src/entrance/app/App.vue @@ -39,6 +39,14 @@ export default { if (window.outerWidth <= defaultWindowWidth) { // outerWidth 获取设备宽度 document.querySelector('meta[name=viewport]').setAttribute('content', `width=device-width, initial-scale=${window.outerWidth / (defaultWindowWidth * window.devicePixelRatio)}, maximum-scale=1.0, user-scalable=0`) } + window.addEventListener('unload', this.clearUrl) + }, + methods: { + clearUrl () { + sessionStorage.setItem('nz-reload', 1) + } + }, + beforeDestroy () { } } From 2639604e438b8e33964a871d6b4b69a97728eb85 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 30 Oct 2023 10:58:51 +0800 Subject: [PATCH 4/6] =?UTF-8?q?NEZ-3289=20=20fix=EF=BC=9A=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=B5=8F=E8=A7=88=E5=99=A8=E5=88=B7=E6=96=B0=20?= =?UTF-8?q?=E4=B8=8D=E6=B8=85=E7=A9=BA=E6=89=80=E6=9C=89=E5=8F=82=E6=95=B0?= =?UTF-8?q?=20=E5=8F=AA=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/pickTime.vue | 6 ++--- .../src/components/common/timePicker.vue | 7 ++--- .../components/page/alert/alertMessage.vue | 27 ++++++++++--------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/nezha-fronted/src/components/common/pickTime.vue b/nezha-fronted/src/components/common/pickTime.vue index dad9eb56c..4da1b1b0e 100644 --- a/nezha-fronted/src/components/common/pickTime.vue +++ b/nezha-fronted/src/components/common/pickTime.vue @@ -76,7 +76,7 @@ export default { }, data () { return { - searchTime: [], + searchTime: ['', ''], visible: false, intervalTimer: null, interval: -1, @@ -146,10 +146,10 @@ export default { }, timeFormate (timeRange) { if (timeRange && timeRange.length < 2) { - return [] + return ['', ''] } if (!timeRange[0]) { - return [] + return ['', ''] } const startTime = bus.timeFormate(timeRange[0], this.pickTimer) const endTime = bus.timeFormate(timeRange[1], this.pickTimer) diff --git a/nezha-fronted/src/components/common/timePicker.vue b/nezha-fronted/src/components/common/timePicker.vue index 9c099b0b2..9feb9b291 100644 --- a/nezha-fronted/src/components/common/timePicker.vue +++ b/nezha-fronted/src/components/common/timePicker.vue @@ -237,8 +237,9 @@ export default { this.getUtcStr() this.getRangeHistoryArr() const timeTemp = this.$lodash.cloneDeep(this.searchTime) - this.oldSearchTime[0] = timeTemp[0] - this.oldSearchTime[1] = timeTemp[1] + console.log(this.searchTime) + this.oldSearchTime[0] = timeTemp[0] || '' + this.oldSearchTime[1] = timeTemp[1] || '' // 监听dateFormat变化 改变日期格式 window.addEventListener('storage', this.watchDateFormat) }, @@ -606,7 +607,7 @@ export default { } } if (this.showEmpty && this.defaultPick === 12) { - this.searchTime = [] + this.searchTime = ['', ''] } } } diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 015ef7b73..42a8f3e9d 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -408,7 +408,7 @@ export default { isError: false, defaultPick: 10, defaultPickType: 'date', - defaultPickVal: 7, + defaultPickVal: 7 } }, computed: { @@ -452,19 +452,16 @@ export default { }, methods: { renderDefaultParams () { - if (sessionStorage.getItem('nz-reload') == 1) { - this.searchTime = [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24 * 7)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))), '7d'] - this.searchLabel = {} - sessionStorage.setItem('nz-reload', 0) - return - } + sessionStorage.setItem('nz-reload', 0) const q = JSON.parse(this.$route.query.body) this.state = q.state this.searchTime[0] = q.startAt ? this.momentTz(q.startAt) : '' this.searchTime[1] = q.endAt ? this.momentTz(q.endAt) : '' this.searchTime[2] = q.timeType - if (!q.startAt) { - this.searchTime[2] = 'all' + if (!q.startAt && !q.timeType) { + this.searchTime = ['', '', 'all'] + } else if (q.timeType === 'all') { + this.searchTime = ['', '', 'all'] } switch (this.searchTime[2]) { case '5m' : @@ -922,10 +919,16 @@ export default { ...this.searchLabel } const path = this.fromRoute.alertMessage - const routePathParams = this.$lodash.cloneDeep(param) + const routePathParams = JSON.parse(JSON.stringify(param)) delete routePathParams.statistics - routePathParams.body.startAt = this.searchTime[0] ? this.momentStrToTimestamp(this.searchTime[0]) : '' - routePathParams.body.endAt = this.searchTime[1] ? this.momentStrToTimestamp(this.searchTime[1]) : '' + console.log(this.searchTime[2]) + if (!this.searchTime[2]) { + routePathParams.body.startAt = this.searchTime[0] ? this.momentStrToTimestamp(this.searchTime[0]) : '' + routePathParams.body.endAt = this.searchTime[1] ? this.momentStrToTimestamp(this.searchTime[1]) : '' + } else { + delete routePathParams.body.startAt + delete routePathParams.body.endAt + } routePathParams.body.timeType = this.searchTime[2] routePathParams.body = JSON.stringify(routePathParams.body) this.updatePath(routePathParams, path) From 9f149c3e8bbd3f4ab800d1bc2d553cb5549adcfa Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 30 Oct 2023 11:25:06 +0800 Subject: [PATCH 5/6] =?UTF-8?q?NEZ-3289=20fix=EF=BC=9A=E9=80=82=E9=85=8D3.?= =?UTF-8?q?9=20=E6=9B=B4=E5=A4=9A=E7=9A=84=E7=9B=B8=E5=AF=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/mixin/routerPathParams.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/common/mixin/routerPathParams.js b/nezha-fronted/src/components/common/mixin/routerPathParams.js index 16c22e14d..53fec37aa 100644 --- a/nezha-fronted/src/components/common/mixin/routerPathParams.js +++ b/nezha-fronted/src/components/common/mixin/routerPathParams.js @@ -311,42 +311,42 @@ export default { case '0t' : this.defaultPick = 13 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '0' break case '1t' : this.defaultPick = 14 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '1' break case '2t' : this.defaultPick = 15 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '2' break case '7t' : this.defaultPick = 16 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '7' break case '0w' : this.defaultPick = 17 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '0' break case '1w' : this.defaultPick = 18 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '1' break case '0m' : this.defaultPick = 19 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '0' break case '1m' : this.defaultPick = 20 this.defaultPickType = 'relative' - this.defaultPickVal = 'all' + this.defaultPickVal = '1' break default: this.defaultPick = 0 From 673c3b9f0be56e1c11b356fe4d201119f529ac92 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 30 Oct 2023 11:25:30 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix=EF=BC=9AMIB=20Files=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=ADModels=E6=82=AC=E6=B5=AE=E6=A1=86=E6=9C=AA=E8=BF=94?= =?UTF-8?q?=E5=9B=9EType=20=E5=8F=96=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/table/settings/mibTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/common/table/settings/mibTable.vue b/nezha-fronted/src/components/common/table/settings/mibTable.vue index faaeb1e09..c2a9ea7c7 100644 --- a/nezha-fronted/src/components/common/table/settings/mibTable.vue +++ b/nezha-fronted/src/components/common/table/settings/mibTable.vue @@ -65,7 +65,7 @@
{{$t('overall.type')}}: - {{n.type}} + {{n.type ? n.type.name : ''}}