瀏覽代碼

Explore: Adds logs highlighting in Explore on keypress (#16596)

Fixes: #16277
Hugo Häggmark 6 年之前
父節點
當前提交
7b63913dc1
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      public/app/features/explore/QueryField.tsx

+ 10 - 0
public/app/features/explore/QueryField.tsx

@@ -151,6 +151,9 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
         if (textChanged && invokeParentOnValueChanged) {
           this.executeOnQueryChangeAndExecuteQueries();
         }
+        if (textChanged && !invokeParentOnValueChanged) {
+          this.updateLogsHighlights();
+        }
       }
     });
 
@@ -163,6 +166,13 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
     }
   };
 
+  updateLogsHighlights = () => {
+    const { onQueryChange } = this.props;
+    if (onQueryChange) {
+      onQueryChange(Plain.serialize(this.state.value));
+    }
+  };
+
   executeOnQueryChangeAndExecuteQueries = () => {
     // Send text change to parent
     const { onQueryChange, onExecuteQuery } = this.props;