fix: update duration step in graphs for trace and log (#503)
diff --git a/.gitignore b/.gitignore
index 9501864..5424cd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
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 3ad6952..bc0973f 100644
--- a/src/utils/dateFormat.ts
+++ b/src/utils/dateFormat.ts
@@ -49,6 +49,14 @@
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 0c1ce7f..408d6d0 100644
--- a/src/views/components/alarm/alarm-tool.vue
+++ b/src/views/components/alarm/alarm-tool.vue
@@ -80,7 +80,6 @@
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 01c70dd..0daefab 100644
--- a/src/views/components/log/log-conditions.vue
+++ b/src/views/components/log/log-conditions.vue
@@ -200,15 +200,8 @@
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 fc92ac2..eb7cc52 100644
--- a/src/views/components/trace/trace-search.vue
+++ b/src/views/components/trace/trace-search.vue
@@ -139,15 +139,8 @@
}
}
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),