diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 5e124a4e7..39ada87e5 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -688,7 +688,8 @@ return element.name == item.seriesName; }) if(i===0){ - let t_date = new Date(item.data[0]); + let value=bus.computeTimezone(item.data[0]); + let t_date = new Date(value); str += [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + " " + [t_date.getHours(), t_date.getMinutes(),t_date.getSeconds()].join(':'); str +=``; @@ -813,6 +814,7 @@ intervale: 0, rotate: 0, formatter: function (value) { + value = bus.computeTimezone(value); var t_date = new Date(value); return [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n" + [t_date.getHours(), t_date.getMinutes()].join(':'); diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue index fc20c1ae8..b35cd3359 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue @@ -302,7 +302,8 @@ return element.name == item.seriesName; }) if(i===0){ - let t_date = new Date(item.data[0]); + let value=bus.computeTimezone(item.data[0]); + let t_date = new Date(value); str += [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + " " + [t_date.getHours(), t_date.getMinutes(),t_date.getSeconds()].join(':'); str +=``; @@ -396,6 +397,7 @@ intervale: 0, rotate: 0, formatter: function (value) { + value = bus.computeTimezone(value); var t_date = new Date(value); return [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n" + [t_date.getHours(), t_date.getMinutes()].join(':'); @@ -648,7 +650,7 @@ this.showEndpoint(); }, getTime:function(size,unit){//计算时间 - let now=!this.formatTime? new Date():new Date(this.formatTime); + let now=!this.formatTime? new Date(bus.computeTimezone(new Date().getTime())):new Date(this.formatTime); if(unit){ switch (unit) { case 'y': diff --git a/nezha-fronted/src/components/common/js/validate.js b/nezha-fronted/src/components/common/js/validate.js index 1f238dfc2..36dcb3158 100644 --- a/nezha-fronted/src/components/common/js/validate.js +++ b/nezha-fronted/src/components/common/js/validate.js @@ -109,15 +109,15 @@ export function domain(rule, value, callback){ }, 100) } -export function timezone(rule, value, callback){ +export function uSize(rule, value, callback){ setTimeout(() => { if(isNaN(Number(value))){ callback(new Error(vm.$t('validate.number'))) }else{ - let timezone=Math.abs(Number(value)); - if(timezone>12){ - callback(new Error(vm.$t('validate.timezone'))) + let num=Number(value); + if(num<0 || num > 49 ){ + callback(new Error(vm.$t('validate.usize'))) }else{ callback(); } diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index f6cb9088f..50c638aae 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -267,7 +267,7 @@ const en = { tel:'Invalid phone number',//'不合法的电话号码' host:'Invalid IP',//'不合法的IP' domain:'Invalid domain', - timezone:'Must be number(-12 - 12)', + usize:'Must be number(1 - 49)', fileSize:'文件过大',//File exceed max size. port:'Invalid Port', url:'Invalid URL', @@ -603,7 +603,8 @@ const en = { storageRetention:'Local Retention', systemName:'System Name', curUrl:'Current site URL', - timezone:'Timezone' + timezone:'Timezone', + defaultCabinetUsize:'Cabinet U Size' }, email:{ email:'Email', diff --git a/nezha-fronted/src/components/common/login.vue b/nezha-fronted/src/components/common/login.vue index 62b2e32bd..df2ff689b 100644 --- a/nezha-fronted/src/components/common/login.vue +++ b/nezha-fronted/src/components/common/login.vue @@ -57,7 +57,8 @@ export default { localStorage.setItem('nz-sys-name',res.data.systemName); localStorage.setItem('nz-sys-timezone',res.data.timezone); localStorage.setItem('nz-sys-default-cabinet-usize',res.data.defaultCabinetUsize); - localStorage.setItem('nz-sys-man-terminal-num',res.data.maxTerminalNum); + localStorage.setItem('nz-sys-max-terminal-num',res.data.maxTerminalNum); + localStorage.setItem('nz-sys-asset-ping-switch',res.data.assetPingSwith); this.$i18n.locale = this.lang; bus.$emit('login'); this.$router.push({ diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 04fccf525..9cd785c7d 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -475,6 +475,7 @@ checkAllFlag: false, checkAllHandler: false, assetClick: false, + assetPingSwitch:localStorage.getItem('nz-sys-asset-ping-switch'), } }, computed: { @@ -990,12 +991,26 @@ } //resize时刷新左侧列表滚动条 let _this = this; - window.onresize = function() { + window.onresize = function () { _this.$refs.leftScrollbar.update(); } }); - let localStorageTitle=localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path); + let localStorageTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path); this.tablelable = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle; + // this.assetPingSwit + if (this.assetPingSwitch == 'off') { + console.log(this.assetPingSwitch) + console.log(this.tablelable) + for (let i in this.tablelable) { + let label = this.tablelable[i]; + + if (label.prop == 'pingStatus') { + this.tablelable.splice(i, 1); + console.log(this.tablelable) + break; + } + } + } this.dropCol = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle; }, destroyed() { diff --git a/nezha-fronted/src/components/page/config/system.vue b/nezha-fronted/src/components/page/config/system.vue index 1f1d0adac..f095ec9f8 100644 --- a/nezha-fronted/src/components/page/config/system.vue +++ b/nezha-fronted/src/components/page/config/system.vue @@ -45,6 +45,9 @@ s + + + @@ -160,7 +163,7 @@ - + @@ -170,7 +173,7 @@ - {{item.label}} + {{item.label}} @@ -195,8 +198,7 @@ import {port} from '../../common/js/validate' import {domain} from '../../common/js/validate' import {host} from '../../common/js/validate' - import {timezone} from '../../common/js/validate' - import {integer} from '../../common/js/validate' + import {uSize} from '../../common/js/validate' import bus from '../../../libs/bus'; export default { @@ -213,6 +215,7 @@ system_name:'', current_site_url:'', timezone:'', + default_cabinet_usize:'', }, basicRules:{ system_name:[{required:true,message:this.$t('validate.required'),trigger:'blur'},], @@ -222,6 +225,7 @@ scrape_interval:[{required:true,message:this.$t('validate.required'),trigger:'blur'},{validator:positiveInteger,trigger:'blur'}], storage_local_retention:[{required:true,message:this.$t('validate.required'),trigger:'blur'},{validator:positiveInteger,trigger:'blur'}], timezone:[{required:true,message:this.$t('validate.required'),trigger:'blur'}], + default_cabinet_usize:[{validator:positiveInteger,trigger:'blur'},{validator:uSize,trigger:'blur'}], }, basicRules2:{ system_name:[{required:true,message:this.$t('validate.required'),trigger:'blur'},], @@ -230,6 +234,7 @@ scrape_interval:[{required:true,message:this.$t('validate.required'),trigger:'blur'},{validator:positiveInteger,trigger:'blur'}], storage_local_retention:[{required:true,message:this.$t('validate.required'),trigger:'blur'},{validator:positiveInteger,trigger:'blur'}], timezone:[{required:true,message:this.$t('validate.required'),trigger:'blur'}], + default_cabinet_usize:[{validator:positiveInteger,trigger:'blur'},{validator:uSize,trigger:'blur'}], }, timezoneOption:[ {label:'UTC-12:00',value:'-12'}, @@ -370,6 +375,14 @@ this.resetForm(formName); setTimeout(()=>{ this.querySetInfo(type); + if(type == 'basic'){ + localStorage.setItem('nz-sys-name',this.basic.system_name); + localStorage.setItem('nz-sys-timezone',this.basic.timezone); + localStorage.setItem('nz-sys-asset-ping-switch',this.basic.asset_ping_switch); + localStorage.setItem('nz-sys-default-cabinet-usize',this.basic.default_cabinet_usize); + }else if(type == 'terminal'){ + localStorage.setItem('nz-sys-max-terminal-num',this.terminal.max_terminal_num); + } },200) }else{ this.$message.error(response.msg); @@ -492,7 +505,9 @@ webkit-box-shadow: unset !important; box-shadow: unset !important; height: 100%; + width: 100%; border-bottom: unset; + border-left: unset; } .sys-reset-label .el-checkbox__original:checked + span{ background-color: orange; @@ -501,4 +516,7 @@ -webkit-transform: rotate(45deg) scaleY(1); transform: rotate(45deg) scaleY(1); } + .reset-form .el-checkbox-group{ + margin-left: -28px !important; + } diff --git a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue index de6f99cab..0847fe6e1 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue @@ -1,5 +1,6 @@