Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Commit fa44d5f

Browse files
authored
fix: update duration step in graphs for trace and log (#503)
1 parent 2157d35 commit fa44d5f

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ yarn-debug.log*
66
yarn-error.log*
77
node
88
yarn.lock
9+
.env*
910

1011
# Editor directories and files
1112
.idea

src/utils/dateFormat.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ export default function dateFormatStep(date: Date, step: string, monthDayDiff?:
4949
if (step === 'MINUTE') {
5050
return `${year}-${month}-${day} ${hour}${minute}`;
5151
}
52+
const secondTemp = date.getSeconds();
53+
let second: string = `${secondTemp}`;
54+
if (secondTemp < 10) {
55+
second = `0${secondTemp}`;
56+
}
57+
if (step === 'SECOND') {
58+
return `${year}-${month}-${day} ${hour}${minute}${second}`;
59+
}
5260
return '';
5361
}
5462

src/views/components/alarm/alarm-tool.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ limitations under the License. -->
8080
this.handleRefresh({ pageNum: 1 });
8181
},
8282
]);
83-
this.handleRefresh({ pageNum: 1 });
8483
}
8584
private handleRefresh(param: { pageNum: number; tagsMap?: Array<{ key: string; value: string }> }) {
8685
this.pageNum = param.pageNum;

src/views/components/log/log-conditions.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,8 @@ limitations under the License. -->
200200
localStorage.setItem(storageContent, JSON.stringify(list));
201201
}
202202
private globalTimeFormat(time: Date[]) {
203-
let step = 'MINUTE';
204-
const unix = Math.round(time[1].getTime()) - Math.round(time[0].getTime());
205-
if (unix <= 60 * 60 * 1000) {
206-
step = 'MINUTE';
207-
} else if (unix <= 24 * 60 * 60 * 1000) {
208-
step = 'HOUR';
209-
} else {
210-
step = 'DAY';
211-
}
203+
const step = 'SECOND';
204+
212205
return {
213206
start: dateFormatStep(time[0], step, true),
214207
end: dateFormatStep(time[1], step, true),

src/views/components/trace/trace-search.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,8 @@ limitations under the License. -->
139139
}
140140
}
141141
private globalTimeFormat(time: Date[]) {
142-
let step = 'MINUTE';
143-
const unix = Math.round(time[1].getTime()) - Math.round(time[0].getTime());
144-
if (unix <= 60 * 60 * 1000) {
145-
step = 'MINUTE';
146-
} else if (unix <= 24 * 60 * 60 * 1000) {
147-
step = 'HOUR';
148-
} else {
149-
step = 'DAY';
150-
}
142+
const step = 'SECOND';
143+
151144
return {
152145
start: dateFormatStep(time[0], step, false),
153146
end: dateFormatStep(time[1], step, false),

0 commit comments

Comments
 (0)