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/02/25 06:43:54 UTC

[skywalking-rocketbot-ui] branch master updated: fix: search traceid in logs (#431)

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 3739608  fix: search traceid in logs (#431)
3739608 is described below

commit 37396087a3d66534f4e3313e92f7a87bfdfc3e08
Author: Qiuxia Fan <fi...@outlook.com>
AuthorDate: Thu Feb 25 14:43:45 2021 +0800

    fix: search traceid in logs (#431)
---
 src/store/modules/log/index.ts              | 6 +++++-
 src/views/components/log/log-conditions.vue | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/store/modules/log/index.ts b/src/store/modules/log/index.ts
index 5c9ad41..07c437f 100644
--- a/src/store/modules/log/index.ts
+++ b/src/store/modules/log/index.ts
@@ -58,6 +58,7 @@ const logState: State = {
   category: { label: 'All', key: 'ALL' },
   loading: false,
   conditions: {
+    traceId: localStorage.getItem('logTraceId') || '',
     keywordsOfContent: localStorage.getItem('logKeywordsOfContent')
       ? JSON.parse(localStorage.getItem('logKeywordsOfContent') || '')
       : [],
@@ -95,10 +96,13 @@ const mutations: MutationTree<State> = {
     state.supportQueryLogsByKeywords = isSupport;
   },
   [types.CLEAR_LOG_CONDITIONS](state: State) {
-    state.conditions = {};
+    state.conditions = {
+      date: state.conditions.date,
+    };
     localStorage.removeItem('logKeywordsOfContent');
     localStorage.removeItem('logExcludingKeywordsOfContent');
     localStorage.removeItem('logTags');
+    localStorage.removeItem('logTraceId');
   },
 };
 
diff --git a/src/views/components/log/log-conditions.vue b/src/views/components/log/log-conditions.vue
index 31af058..314dbdd 100644
--- a/src/views/components/log/log-conditions.vue
+++ b/src/views/components/log/log-conditions.vue
@@ -19,6 +19,7 @@ limitations under the License. -->
         <input
           type="text"
           class="rk-trace-search-input dib"
+          v-model="traceId"
           @change="changeConditions($event, LogConditionsOpt.TraceID)"
         />
       </div>
@@ -132,6 +133,7 @@ limitations under the License. -->
     private tagsList: string[] = [];
     private tags: string = '';
     private searchTime: Date[] = [];
+    private traceId: string = '';
     private LogConditionsOpt = {
       TraceID: 'traceId',
       Tags: 'tags',
@@ -144,6 +146,7 @@ limitations under the License. -->
       this.searchTime = [this.rocketbotGlobal.durationRow.start, this.rocketbotGlobal.durationRow.end];
       (this.tagsList = localStorage.getItem('logTags') ? JSON.parse(localStorage.getItem('logTags') || '') : []),
         this.updateTags();
+      this.traceId = localStorage.getItem('logTraceId') || '';
     }
     private changeConditions(item: any, type: string) {
       item = {
@@ -151,6 +154,7 @@ limitations under the License. -->
         key: item.target.value,
       };
       this.SET_LOG_CONDITIONS(item);
+      localStorage.setItem('logTraceId', this.traceId);
     }
     private addLabels(event: KeyboardEvent, type: string) {
       if (event.keyCode !== 13) {
@@ -257,11 +261,14 @@ limitations under the License. -->
         step,
       };
     }
-    @Watch('rocketLog.conditions.tags')
+    @Watch('rocketLog.conditions')
     private clearTags() {
       if (!this.rocketLog.conditions.tags) {
         this.tagsList = [];
       }
+      if (!this.rocketLog.conditions.traceId) {
+        this.traceId = '';
+      }
     }
     @Watch('searchTime')
     private updateDate() {