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

Commit

Permalink
fix: update duration step in graphs for trace and log (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fine0830 authored Jun 6, 2021
1 parent 2157d35 commit fa44d5f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ yarn-debug.log*
yarn-error.log*
node
yarn.lock
.env*

# Editor directories and files
.idea
Expand Down
8 changes: 8 additions & 0 deletions src/utils/dateFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
}

Expand Down
1 change: 0 additions & 1 deletion src/views/components/alarm/alarm-tool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 2 additions & 9 deletions src/views/components/log/log-conditions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
11 changes: 2 additions & 9 deletions src/views/components/trace/trace-search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit fa44d5f

Please sign in to comment.