You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2019/09/24 13:42:50 UTC

[skywalking-rocketbot-ui] branch master updated: Fix auto refresh time range failure (#160)

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 70cfda2  Fix auto refresh time range failure (#160)
70cfda2 is described below

commit 70cfda2c10f3e8e3ff334f1f56fc488cc89018ab
Author: Kdump <ro...@gmail.com>
AuthorDate: Tue Sep 24 21:42:45 2019 +0800

    Fix auto refresh time range failure (#160)
    
    * fix auto refresh time range failure
    
    * fix auto refresh time range failure
    
    * fix auto refresh time range failure
    
    * fix auto refresh time range failure
    
    * fix auto refresh time range failure
---
 src/components/rk-footer.vue |  8 ++++----
 src/components/rk-header.vue | 10 ++++------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/components/rk-footer.vue b/src/components/rk-footer.vue
index 3ff4ab4..f497e54 100644
--- a/src/components/rk-footer.vue
+++ b/src/components/rk-footer.vue
@@ -36,9 +36,9 @@
 </template>
 
 <script lang="ts">
+import { Duration } from '@/types/global';
 import { Vue, Component, Watch } from 'vue-property-decorator';
 import { State, Action, Mutation } from 'vuex-class';
-import timeFormat from '@/utils/timeFormat';
 
 @Component
 export default class Footer extends Vue {
@@ -48,9 +48,9 @@ export default class Footer extends Vue {
   private lang: any = '';
   private time: Date[] = [new Date(), new Date()];
   private utc: any = window.localStorage.getItem('utc') || -(new Date().getTimezoneOffset() / 60);
-  @Watch('time')
-  private onTimeUpdate() {
-    this.SET_DURATION(timeFormat(this.time));
+  @Watch('rocketbotGlobal.durationRow')
+  private  durationRowWatch(newValue: Duration) {
+    this.time = [newValue.start, newValue.end];
   }
   @Watch('utc')
   private onUtcUpdate() {
diff --git a/src/components/rk-header.vue b/src/components/rk-header.vue
index 0aaf68a..2559f1b 100644
--- a/src/components/rk-header.vue
+++ b/src/components/rk-header.vue
@@ -56,7 +56,7 @@
           <use xlink:href="#retry"></use>
         </svg>
         <span class="vm">{{this.$t('reload')}}</span>
-      </a>   
+      </a>
   </div>
   </header>
 </template>
@@ -76,10 +76,8 @@ export default class Header extends Vue {
   private handleReload() {
     const gap = this.duration.end.getTime() - this.duration.start.getTime();
     const utcCopy: any = -(new Date().getTimezoneOffset() / 60);
-    this.$emit('reloadFooter', [
-      new Date(new Date().getTime() - gap),
-      new Date(),
-    ]);
+    const time: Date[] = [new Date(new Date().getTime() - gap), new Date()];
+    this.SET_DURATION(timeFormat(time));
   }
   private handleAuto() {
     this.auto = !this.auto;
@@ -165,7 +163,7 @@ export default class Header extends Vue {
   will-change: background-color;
   transition: background-color .3s;
   &:hover{
-    background-color:#dededf; 
+    background-color:#dededf;
   }
 }
 </style>