From 1ca749dfda966ce1588cd9103ad1d9d6fcff5c07 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 16 Mar 2021 18:16:10 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9panel=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8expression=E6=A8=A1=E6=9D=BF=E9=97=AA=E9=80=80?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF=E7=BB=99=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E7=9A=84=E5=8F=96=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/js/tools.js | 6 +++--- .../components/page/dashboard/explore/promqlInput.vue | 11 +++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index cdc61ebee..9f2f315dd 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -298,13 +298,13 @@ export function calcDurationByStringTime(startTime, endTime) { export function calcDurationByStringTimeB(startTime, endTime) { let durationSecond = stringTimeParseToUnix(endTime)-stringTimeParseToUnix(startTime); let result = `${durationSecond%60}s`; - if(durationSecond > 60*60 *24){ + if(durationSecond >= 60*60 *24){ result = `${(Math.floor(durationSecond/3600))%24}h` result = `${Math.floor(durationSecond/(60*60*24))}d ${result}`; - } else if (durationSecond > 60*60) { + } else if (durationSecond >= 60*60) { result = `${(Math.floor(durationSecond/60))%60}m` result = `${Math.floor(durationSecond/(60*60))}h ${result}`; - }else if(durationSecond > 60) { + }else if(durationSecond >= 60) { result = `${(Math.floor(durationSecond/60))%60}m ${result}`; } diff --git a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue index 6c91719a8..d2cf9f767 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue @@ -105,12 +105,12 @@ Variable - + - + @@ -374,11 +374,6 @@ format(str){ let arr=str.split('.') let keyword=arr[0].toLowerCase(); - if(arr.length!==1&&arr.length!==2){ - return { - key:false - } - } switch(keyword){ case 'asset': case 'module': @@ -388,7 +383,7 @@ return { arr:this[keyword+'Option'], key:keyword, - value:arr[1]?arr[1]:((keyword=='module'||keyword=='project'||keyword=='datacenter')?'name':'host') + value:((keyword=='module'||keyword=='project'||keyword=='datacenter')?'name':'host') }; default: return {