From e0b8b1b7afb427772cc752f9054953f7705ab42c Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Fri, 5 Oct 2018 18:27:33 +0200 Subject: [PATCH] Explore: trigger a query field render to fix highlighting - some syntax rules are loaded asynchronously - when they have been received, the query field needs to re-render - trigger re-render via bogus edit (tried other methods but could not find any) --- public/app/features/explore/PromQueryField.tsx | 13 ++++++++----- public/app/features/explore/QueryField.tsx | 14 ++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/public/app/features/explore/PromQueryField.tsx b/public/app/features/explore/PromQueryField.tsx index 20c36ee87f3..5b8b438fbc4 100644 --- a/public/app/features/explore/PromQueryField.tsx +++ b/public/app/features/explore/PromQueryField.tsx @@ -158,6 +158,7 @@ interface PromQueryFieldState { metrics: string[]; metricsOptions: any[]; metricsByPrefix: CascaderOption[]; + syntaxLoaded: boolean; } interface PromTypeaheadInput { @@ -191,6 +192,7 @@ class PromQueryField extends React.PureComponent ({ label: hm, value: hm })); @@ -275,7 +277,7 @@ class PromQueryField extends React.PureComponent { @@ -558,8 +560,8 @@ class PromQueryField extends React.PureComponent @@ -579,12 +581,13 @@ class PromQueryField extends React.PureComponent {error ?
{error}
: null} diff --git a/public/app/features/explore/QueryField.tsx b/public/app/features/explore/QueryField.tsx index ea23ea81b93..237ad6a82e8 100644 --- a/public/app/features/explore/QueryField.tsx +++ b/public/app/features/explore/QueryField.tsx @@ -106,6 +106,7 @@ interface TypeaheadFieldProps { placeholder?: string; portalPrefix?: string; syntax?: string; + syntaxLoaded?: boolean; } export interface TypeaheadFieldState { @@ -171,10 +172,15 @@ class QueryField extends React.PureComponent