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 {