diff --git a/.gitignore b/.gitignore index 95018649..5424cd1b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ yarn-debug.log* yarn-error.log* node yarn.lock +.env* # Editor directories and files .idea diff --git a/src/utils/dateFormat.ts b/src/utils/dateFormat.ts index 3ad69525..bc0973fd 100644 --- a/src/utils/dateFormat.ts +++ b/src/utils/dateFormat.ts @@ -49,6 +49,14 @@ export default function dateFormatStep(date: Date, step: string, monthDayDiff?: if (step === 'MINUTE') { return `${year}-${month}-${day} ${hour}${minute}`; } + const secondTemp = date.getSeconds(); + let second: string = `${secondTemp}`; + if (secondTemp < 10) { + second = `0${secondTemp}`; + } + if (step === 'SECOND') { + return `${year}-${month}-${day} ${hour}${minute}${second}`; + } return ''; } diff --git a/src/views/components/alarm/alarm-tool.vue b/src/views/components/alarm/alarm-tool.vue index 0c1ce7f1..408d6d02 100644 --- a/src/views/components/alarm/alarm-tool.vue +++ b/src/views/components/alarm/alarm-tool.vue @@ -80,7 +80,6 @@ limitations under the License. --> this.handleRefresh({ pageNum: 1 }); }, ]); - this.handleRefresh({ pageNum: 1 }); } private handleRefresh(param: { pageNum: number; tagsMap?: Array<{ key: string; value: string }> }) { this.pageNum = param.pageNum; diff --git a/src/views/components/log/log-conditions.vue b/src/views/components/log/log-conditions.vue index 01c70dda..0daefabd 100644 --- a/src/views/components/log/log-conditions.vue +++ b/src/views/components/log/log-conditions.vue @@ -200,15 +200,8 @@ limitations under the License. --> localStorage.setItem(storageContent, JSON.stringify(list)); } private globalTimeFormat(time: Date[]) { - let step = 'MINUTE'; - const unix = Math.round(time[1].getTime()) - Math.round(time[0].getTime()); - if (unix <= 60 * 60 * 1000) { - step = 'MINUTE'; - } else if (unix <= 24 * 60 * 60 * 1000) { - step = 'HOUR'; - } else { - step = 'DAY'; - } + const step = 'SECOND'; + return { start: dateFormatStep(time[0], step, true), end: dateFormatStep(time[1], step, true), diff --git a/src/views/components/trace/trace-search.vue b/src/views/components/trace/trace-search.vue index fc92ac28..eb7cc527 100644 --- a/src/views/components/trace/trace-search.vue +++ b/src/views/components/trace/trace-search.vue @@ -139,15 +139,8 @@ limitations under the License. --> } } private globalTimeFormat(time: Date[]) { - let step = 'MINUTE'; - const unix = Math.round(time[1].getTime()) - Math.round(time[0].getTime()); - if (unix <= 60 * 60 * 1000) { - step = 'MINUTE'; - } else if (unix <= 24 * 60 * 60 * 1000) { - step = 'HOUR'; - } else { - step = 'DAY'; - } + const step = 'SECOND'; + return { start: dateFormatStep(time[0], step, false), end: dateFormatStep(time[1], step, false),