From 4b4393474307a5a755ce98b062b691484a03f917 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 28 Apr 2021 15:18:21 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feat:=E6=9C=AC=E5=9C=B0=E9=87=8D=E6=9E=84?= =?UTF-8?q?element-ui=E7=9A=84=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/.babelrc | 29 ++++++++++++++++++- nezha-fronted/build/webpack.base.conf.js | 23 +++++++++++---- nezha-fronted/package.json | 2 +- nezha-fronted/src/assets/css/common.scss | 23 +++++++++++++++ .../src/components/charts/chart-list.vue | 2 +- .../src/components/charts/chartPreview.vue | 4 +-- .../common/bottomBox/tabs/endpointQuery.vue | 4 +-- .../bottomBox/tabs/endpointQueryTab.vue | 4 +-- nezha-fronted/src/components/common/login.vue | 1 + .../src/components/common/multipleTime.vue | 5 ++-- .../components/common/myDatePicker/index.js | 9 +++++- .../myDatePicker/src/basic/date-table.vue | 8 +++-- .../myDatePicker/src/panel/date-range.vue | 18 +++++++----- .../common/myDatePicker/src/panel/date.vue | 3 ++ .../myDatePicker/src/panel/month-range.vue | 4 +++ .../myDatePicker/src/panel/time-range.vue | 2 ++ .../common/myDatePicker/src/panel/time.vue | 2 ++ .../common/myDatePicker/src/picker.vue | 12 +++++++- .../myDatePicker/src/picker/date-picker.js | 2 +- .../components/common/project/topologyL5.vue | 1 - .../common/rightBox/alertSilenceBox.vue | 8 ++--- .../rightBox/asset/assetBatchEditBox.vue | 8 ++--- .../common/rightBox/asset/assetBox.vue | 12 ++++---- .../components/common/rightBox/assetBox.vue | 4 +-- .../src/components/common/searchInput.vue | 4 +-- .../src/components/common/timePicker.vue | 6 ++-- .../page/asset/components/assetTagEx.vue | 8 ++--- .../page/config/system/apiKeyTable.vue | 4 +-- .../page/dashboard/metricPreview.vue | 8 ++--- .../src/components/page/dashboard/panel.vue | 2 +- nezha-fronted/src/main.js | 5 ++-- nezha-fronted/src/store/user.js | 2 ++ 32 files changed, 166 insertions(+), 63 deletions(-) diff --git a/nezha-fronted/.babelrc b/nezha-fronted/.babelrc index 3a280ba34..01be98850 100644 --- a/nezha-fronted/.babelrc +++ b/nezha-fronted/.babelrc @@ -8,5 +8,32 @@ }], "stage-2" ], - "plugins": ["transform-vue-jsx", "transform-runtime"] + "plugins": ["transform-vue-jsx", "transform-runtime"], + "env": { + "utils": { + "presets": [ + [ + "env", + { + "loose": true, + "modules": "commonjs", + "targets": { + "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] + } + } + ], + ], + "plugins": [ + ["module-resolver", { + "root": ["element-ui"], + "alias": { + "element-ui/src": "element-ui/lib" + } + }] + ] + }, + "test": { + "plugins": ["istanbul"] + } + } } diff --git a/nezha-fronted/build/webpack.base.conf.js b/nezha-fronted/build/webpack.base.conf.js index a07e68360..88adc5d03 100644 --- a/nezha-fronted/build/webpack.base.conf.js +++ b/nezha-fronted/build/webpack.base.conf.js @@ -8,8 +8,6 @@ function resolve (dir) { return path.join(__dirname, '..', dir) } - - module.exports = { context: path.resolve(__dirname, '../'), entry: { @@ -25,8 +23,8 @@ module.exports = { resolve: { extensions: ['.js', '.vue', '.json'], alias: { - 'vue$': 'vue/dist/vue.esm.js', - '@': resolve('src'), + vue$: 'vue/dist/vue.esm.js', + '@': resolve('src') } }, module: { @@ -37,9 +35,22 @@ module.exports = { options: vueLoaderConfig }, { - test: /\.js$/, + test: /\.(js)$/, loader: 'babel-loader', - include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] + include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client'), resolve('node_modules/element-ui/packages/scrollbar')], + exclude: '/node_modules/', + options: { + presets: [ + ['env', { + modules: false, + targets: { + browsers: ['> 1%', 'last 2 versions', 'not ie <= 8'] + } + }], + 'stage-2' + ], + plugins: ['transform-vue-jsx', 'transform-runtime'] + } }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, diff --git a/nezha-fronted/package.json b/nezha-fronted/package.json index 562ee896a..9073baa7a 100644 --- a/nezha-fronted/package.json +++ b/nezha-fronted/package.json @@ -48,7 +48,7 @@ }, "devDependencies": { "autoprefixer": "^7.1.2", - "babel-core": "^6.22.1", + "babel-core": "^6.26.0", "babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-loader": "^7.1.1", "babel-plugin-syntax-jsx": "^6.18.0", diff --git a/nezha-fronted/src/assets/css/common.scss b/nezha-fronted/src/assets/css/common.scss index 52ad24118..b68261d09 100644 --- a/nezha-fronted/src/assets/css/common.scss +++ b/nezha-fronted/src/assets/css/common.scss @@ -85,3 +85,26 @@ .orange-bg { background-color: var(--theme-color) !important; } +.timezone-area{ + display: inline-block; + vertical-align: middle; + width: auto; + font-size: 14px; + float: left; + margin-left: 10px; + font-family: PingFangSC-Regular; + color: #333333; + line-height: 20px; + font-weight: 400; +} +.timezone-offset{ + display: inline-block; + vertical-align: middle; + width: auto; + font-size: 14px; + margin-right: 10px; + font-family: PingFangSC-Regular; + color: #333333; + line-height: 20px; + font-weight: 400; +} diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 4f9c26796..86aa83298 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -674,7 +674,7 @@ export default { } if (!param.query) delete param.query // 根据panelId获得panel下的所有图表 - this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0').then(response => { + this.$get('visual/panel/chart?panelId=' + params.panelId + '&pageSize=-1').then(response => { if (response.code === 200) { response.data.list.forEach((item, index) => { item.isLoaded = false diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index f656ecdca..16367c439 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -60,7 +60,7 @@ + --> diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue index 376c3a1df..edd8814be 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue @@ -19,7 +19,7 @@
- - +
- - +
@@ -240,40 +232,40 @@ export default { init () { this.loading = true if (this.type === 'asset') { - this.$get('/asset/info?id=' + this.id).then((res) => { + this.$get('asset/asset/' + this.id).then((res) => { if (res.msg === 'success') { this.loading = false - this.alertLabelData = res.data.Basic + this.alertLabelData = res.data } else { this.$message.error(res.msg) } }) } if (this.type === 'project') { - this.$get('/project?id=' + this.id).then((res) => { + this.$get('monitor/project/' + this.id).then((res) => { if (res.msg === 'success') { this.loading = false - this.alertLabelData = res.data.list[0] + this.alertLabelData = res.data } else { this.$message.error(res.msg) } }) } if (this.type === 'module') { - this.$get('/module?id=' + this.id).then((res) => { + this.$get('monitor/module/' + this.id).then((res) => { if (res.msg === 'success') { this.loading = false - this.alertLabelData = res.data.list[0] + this.alertLabelData = res.data } else { this.$message.error(res.msg) } }) } if (this.type === 'endpoint') { - this.$get('/endpoint?id=' + this.id).then((res) => { + this.$get('monitor/endpoint/' + this.id).then((res) => { if (res.msg === 'success') { this.loading = false - this.alertLabelData = res.data.list[0] + this.alertLabelData = res.data } else { this.$message.error(res.msg) } @@ -392,13 +384,13 @@ export default { word-break: break-all; } .danger{ - background-color: #d64f40; + background-color: $--danger-color; color: white; padding: 2px 5px; border-radius: 4px; } .success{ - background-color: #50d050; + background-color: $--success-color; color: white; padding: 2px 5px; border-radius: 4px; diff --git a/nezha-fronted/src/components/common/elementSet.vue b/nezha-fronted/src/components/common/elementSet.vue index e1053958d..84978c413 100644 --- a/nezha-fronted/src/components/common/elementSet.vue +++ b/nezha-fronted/src/components/common/elementSet.vue @@ -54,13 +54,6 @@ export default { created () { const localStorageTitle = JSON.parse(localStorage.getItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId)) if (localStorageTitle) { - for (const title of this.originalTableTitle) { - for (const lsTitle of localStorageTitle) { - if (lsTitle.prop === title.prop) { - lsTitle.label = title.label - } - } - } localStorage.setItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId, JSON.stringify(localStorageTitle)) } }, diff --git a/nezha-fronted/src/components/common/overView/messageAsset.vue b/nezha-fronted/src/components/common/overView/messageAsset.vue index 6bc2a3782..04d2ef7d7 100644 --- a/nezha-fronted/src/components/common/overView/messageAsset.vue +++ b/nezha-fronted/src/components/common/overView/messageAsset.vue @@ -252,7 +252,7 @@ export default { clearTimeout(this.timer) } this.assetData.id = data - const boxWidth = document.getElementsByClassName('content-right')[0].offsetWidth + const boxWidth = document.getElementsByClassName('list-page')[0].offsetWidth this.boxWidth = boxWidth // this.assetData.rate=window.screen.height/1297; this.$nextTick(() => { diff --git a/nezha-fronted/src/components/common/table/nzDataList.vue b/nezha-fronted/src/components/common/table/nzDataList.vue index d8627fc34..d467372c4 100644 --- a/nezha-fronted/src/components/common/table/nzDataList.vue +++ b/nezha-fronted/src/components/common/table/nzDataList.vue @@ -36,7 +36,7 @@
-
- - - {{item.name}} - - +
+
- +
-
+
{{$store.state.consoleCount<=10?$store.state.consoleCount:'10+'}}
-
+
-
+
{{item.label}}
@@ -38,10 +34,10 @@
-
English
+
English
-
中文
+
中文
@@ -57,38 +53,18 @@
- - - - - - - - - - - - - - - - - - + + + diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss index 2347e4094..3473bf3ab 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss @@ -1,5 +1,6 @@ .overview { height: 100%; + padding: 0 10px; background-color: #f6f6f6; } .overview-content-header{ diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js index fb542779a..c7a78873a 100644 --- a/nezha-fronted/src/router/index.js +++ b/nezha-fronted/src/router/index.js @@ -31,7 +31,7 @@ export default new Router({ }, { path: 'overview', - component: resolve => require(['../components/page/dashboard/overview/overview2.vue'], resolve) + component: resolve => require(['../components/page/dashboard/overview/overview.vue'], resolve) }, { path: '/monitor/project', From 11b4bc7049489da7768373d02b91ad722c8bffb7 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Wed, 28 Apr 2021 18:09:14 +0800 Subject: [PATCH 07/12] =?UTF-8?q?NZ-584=20perf:=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=B7=B3=E8=BD=ACoverview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/store/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nezha-fronted/src/store/user.js b/nezha-fronted/src/store/user.js index 36ad10d7d..120374328 100644 --- a/nezha-fronted/src/store/user.js +++ b/nezha-fronted/src/store/user.js @@ -58,7 +58,7 @@ const user = { bus.$emit('login') router.push({ - path: menuList.find(menu => { return menu.route && menu.route != '/header' }).route, + path: 'overview', query: { t: +new Date() } From cc5e4fb7fdcdf80d503238a811d728971d27f0e8 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 28 Apr 2021 18:59:58 +0800 Subject: [PATCH 08/12] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9panel=20?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98=20=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=20endpoint=E7=BC=96=E8=BE=91=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/assets/css/common.scss | 8 ++++++++ nezha-fronted/src/assets/stylus/main.scss | 2 +- .../src/components/charts/chart-list.vue | 2 +- .../src/components/common/language/cn.js | 2 +- .../src/components/common/language/en.js | 2 +- .../common/myDatePicker/src/panel/date.vue | 4 ++-- .../components/common/project/topologyL5.vue | 16 ++++++---------- .../components/common/project/topologyPrev.vue | 17 ++++++++--------- .../common/rightBox/alertSilenceBox.vue | 2 -- .../common/rightBox/editEndpointBoxNew.vue | 2 +- .../common/table/settings/agentTable.vue | 2 +- .../common/table/settings/endpointTable.vue | 14 +++++++------- .../page/monitor/endpoint/endpointList.vue | 2 +- nezha-fronted/src/http.js | 2 +- nezha-fronted/src/libs/bus.js | 14 ++++++++++++++ 15 files changed, 53 insertions(+), 38 deletions(-) diff --git a/nezha-fronted/src/assets/css/common.scss b/nezha-fronted/src/assets/css/common.scss index b68261d09..63492aab8 100644 --- a/nezha-fronted/src/assets/css/common.scss +++ b/nezha-fronted/src/assets/css/common.scss @@ -108,3 +108,11 @@ line-height: 20px; font-weight: 400; } +.active-icon{ + margin-top:0px; + width:10px; + height:10px; + border-radius:50%; + display: inline-block; + margin-right: 5px; +} diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 3ab0311c3..336820f7f 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -1690,7 +1690,7 @@ li{ } /*列表中状态字段 的小圆点*/ .active-icon{ - margin-top:15px; + margin-top:0px; width:8px; height:8px; border-radius:50%; diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 86aa83298..4f9c26796 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -674,7 +674,7 @@ export default { } if (!param.query) delete param.query // 根据panelId获得panel下的所有图表 - this.$get('visual/panel/chart?panelId=' + params.panelId + '&pageSize=-1').then(response => { + this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0').then(response => { if (response.code === 200) { response.data.list.forEach((item, index) => { item.isLoaded = false diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index f745b600d..4977d22ea 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -1149,7 +1149,7 @@ const cn = { alerts: 'Alerts', privpin: '隐私密码', asset: 'Asset', - editEndpoint: '编辑 endpoint', + editEndpoint: '编辑 Endpoint', createEndpoint: '新增Endpoint', batchEndpoint: '批量 Endpoint', endpointName: 'Endpoint name' diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index e7df133c3..772546252 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -1177,7 +1177,7 @@ const en = { privpin: 'Priv password', alerts: 'Alerts', asset: 'Asset', - editEndpoint: 'edit endpoint', + editEndpoint: 'Edit endpoint', createEndpoint: 'Created endpoint', batchEndpoint: 'Batch Endpoint', endpointName: 'Endpoint name', diff --git a/nezha-fronted/src/components/common/myDatePicker/src/panel/date.vue b/nezha-fronted/src/components/common/myDatePicker/src/panel/date.vue index 9c47db359..91afe30eb 100644 --- a/nezha-fronted/src/components/common/myDatePicker/src/panel/date.vue +++ b/nezha-fronted/src/components/common/myDatePicker/src/panel/date.vue @@ -173,7 +173,7 @@ import TimePicker from './time' import YearTable from '../basic/year-table' import MonthTable from '../basic/month-table' import DateTable from '../basic/date-table' - +import bus from '@/libs/bus' export default { mixins: [Locale], @@ -373,7 +373,7 @@ export default { // NOTE: not a permanent solution // consider disable "now" button in the future if ((!this.disabledDate || !this.disabledDate(new Date())) && this.checkDateWithinRange(new Date())) { - this.date = new Date() + this.date = new Date(bus.computeTimezoneTime(new Date())) this.emit(this.date) } }, diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index c8acf506c..5af73549e 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -1549,7 +1549,6 @@ export default { upload () { const form = new FormData() form.append('file', this.file) - console.log(this.file) if (this.uploadPic.name) { form.append('name', this.uploadPic.name) } else { @@ -1562,7 +1561,7 @@ export default { if (res.code == 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.uploadPicShow = false - this.dealImg(`monitor/project/topo/icon/${res.data.id}/0`).then((data,header) => { + this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data,header) => { const group = this.tools.find(tool => tool.group === this.uploadPic.unit) if (group) { group.children.push({ @@ -1618,7 +1617,7 @@ export default { res.data.list.forEach((item, index) => { item.imageName = item.name delete item.name - promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/0`)) + promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/1`)) imgArr.push({ ...item }) }) Promise.all(promiseArr).then((res2,header) => { @@ -1662,7 +1661,7 @@ export default { const promiseArr = [] imgidList.forEach((item, index) => { if (item.data.imageId) { - promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/0`)) + promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`)) } else { promiseArr.push('') } @@ -1688,13 +1687,10 @@ export default { if (url) { return new Promise((resolve, reject) => { this.$axios - .get(url, { - responseType: 'arraybuffer' - }) - .then((res, resHeader) => { + .get(url) + .then((res) => { return { - data: ('data:image/jpeg;base64,' + btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))), - header: resHeader + data: ('data:image/jpeg;base64,' + res.data), } }) .then(data => { diff --git a/nezha-fronted/src/components/common/project/topologyPrev.vue b/nezha-fronted/src/components/common/project/topologyPrev.vue index 7bfbfafc4..82ef0ceab 100644 --- a/nezha-fronted/src/components/common/project/topologyPrev.vue +++ b/nezha-fronted/src/components/common/project/topologyPrev.vue @@ -1549,7 +1549,6 @@ export default { upload () { const form = new FormData() form.append('file', this.file) - console.log(this.file) if (this.uploadPic.name) { form.append('name', this.uploadPic.name) } else { @@ -1562,7 +1561,7 @@ export default { if (res.code == 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.uploadPicShow = false - this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data) => { + this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => { const group = this.tools.find(tool => tool.group === this.uploadPic.unit) if (group) { group.children.push({ @@ -1621,7 +1620,7 @@ export default { promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/1`)) imgArr.push({ ...item }) }) - Promise.all(promiseArr).then((res2) => { + Promise.all(promiseArr).then((res2, header) => { this.iconArray = [...res.data.list] this.iconArray.forEach((item, index) => { item.image = res2[index] @@ -1688,14 +1687,14 @@ export default { if (url) { return new Promise((resolve, reject) => { this.$axios - .get(url, { - responseType: 'arraybuffer' - }) - .then(res => { - return ('data:image/jpeg;base64,' + btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))) + .get(url) + .then((res) => { + return { + data: ('data:image/jpeg;base64,' + res.data) + } }) .then(data => { - resolve(data) + resolve(data.data, data.header) // changeImage(data,(img)=>{ // resolve(img) // }) diff --git a/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue b/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue index f76b95c23..1830a7054 100644 --- a/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue @@ -37,7 +37,6 @@ start time end time
- {{ $t("project.module.editEndpoint")}} + {{ $t("project.module.editEndpoint")}} {{editEndpoint.id}} {{ $t("project.module.batchEndpoint")}} diff --git a/nezha-fronted/src/components/common/table/settings/agentTable.vue b/nezha-fronted/src/components/common/table/settings/agentTable.vue index afc83aaef..786e35d36 100644 --- a/nezha-fronted/src/components/common/table/settings/agentTable.vue +++ b/nezha-fronted/src/components/common/table/settings/agentTable.vue @@ -42,7 +42,7 @@
-
+
diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 2812a1170..e7cf8501e 100644 --- a/nezha-fronted/src/components/common/table/settings/endpointTable.vue +++ b/nezha-fronted/src/components/common/table/settings/endpointTable.vue @@ -72,13 +72,13 @@
-
down +
down
-
up +
up
-
suspended +
suspended
@@ -183,16 +183,16 @@ export default { let str = '' arr.forEach((item, index) => { if (index === 0) { - str += `
DC
` + str += `
DC
` } if (index === 1) { - str += `
ASSET
` + str += `
ASSET
` } if (index === 2) { - str += `
ENDPOINT
` + str += `
ENDPOINT
` } if (index === 3) { - str += `
PROMETHEUS
` + str += `
PROMETHEUS
` } }) return str diff --git a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue index e9b290cfa..70199a742 100644 --- a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue +++ b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue @@ -65,7 +65,7 @@
- + diff --git a/nezha-fronted/src/http.js b/nezha-fronted/src/http.js index d7db8162a..8c042466a 100644 --- a/nezha-fronted/src/http.js +++ b/nezha-fronted/src/http.js @@ -28,7 +28,7 @@ export function get (url, params) { axios.get(url, { params: params }).then(response => { - resolve(response.data, response) + resolve(response.data) }).catch(err => { if (err.response) { resolve(err.response.data) diff --git a/nezha-fronted/src/libs/bus.js b/nezha-fronted/src/libs/bus.js index 16d94d825..72cd8ea68 100644 --- a/nezha-fronted/src/libs/bus.js +++ b/nezha-fronted/src/libs/bus.js @@ -272,6 +272,20 @@ export default new Vue({ return sourceTime } }, + // 将本地时区转为系统配置的时区 + computeTimezoneTime: function (sourceTime) { + let offset = localStorage.getItem('nz-sys-timezone') + offset = moment.tz(offset).format('Z') + if (offset && offset !== 'undefined') { + offset = Number.parseInt(offset) + const date = new Date(sourceTime) + const localOffset = date.getTimezoneOffset() * 60 * 1000 // 默认 一分钟显示时区偏移的结果 + const utcTime = date.getTime() + localOffset + return utcTime + (offset * 60 * 60 * 1000) + } else { + return sourceTime + } + }, getTimezontDateRange: function (offset = -1) { return [ new Date(new Date(this.computeTimezone(new Date().getTime())).setHours(new Date(this.computeTimezone(new Date().getTime())).getHours() + offset)), From d262a18b86c4083c68614fdd5a48b48b2732b5c7 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 28 Apr 2021 19:26:49 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E8=8A=82=E7=82=B9=20=E9=A2=91=E7=B9=81=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=8E=A5=E5=8F=A3=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/project/L5/CanvasProps.vue | 3 ++- .../page/dashboard/explore/promqlInput.vue | 23 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue index 4575750b9..c72146259 100644 --- a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue +++ b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue @@ -54,6 +54,7 @@ :styleType="2" :metricOptionsParent="metricOptions" @change="expressionChange" + :from-father-data="true" @removeExpression="removeExpression" > @@ -1128,7 +1129,7 @@ export default { }) }, mounted () { - this.queryMetrics() + // this.queryMetrics() // this.topologyData.data.grid= !!dataOption.grid; // this.topologyData.data.rule= !!dataOption.rule; // this.topologyData.data.projectInfo= !!dataOption.projectInfo; diff --git a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue index 2ed72a03a..199e58ebd 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue @@ -10,7 +10,7 @@ Metric