You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/06/06 06:15:05 UTC

[skywalking-rocketbot-ui] branch master updated: fix: update duration step in graphs for trace and log (#503)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-rocketbot-ui.git


The following commit(s) were added to refs/heads/master by this push:
     new fa44d5f  fix: update duration step in graphs for trace and log (#503)
fa44d5f is described below

commit fa44d5fa1c0cbcb1cb05333cb6e5f2ae55ec2d67
Author: Qiuxia Fan <fi...@outlook.com>
AuthorDate: Sun Jun 6 14:14:41 2021 +0800

    fix: update duration step in graphs for trace and log (#503)
---
 .gitignore                                  |  1 +
 src/utils/dateFormat.ts                     |  8 ++++++++
 src/views/components/alarm/alarm-tool.vue   |  1 -
 src/views/components/log/log-conditions.vue | 11 ++---------
 src/views/components/trace/trace-search.vue | 11 ++---------
 5 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9501864..5424cd1 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 3ad6952..bc0973f 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 0c1ce7f..408d6d0 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 01c70dd..0daefab 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 fc92ac2..eb7cc52 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),