Explore: adds QueryRowErrors component, moves error display to QueryRow (#22438)

* Explore: adds QueryRowErrors component

* Explore: updates QueryRow to use QueryRowErrors component

* Explore: updates PromQueryField to remove error render

* Explore: updates Elastic query field  to remove error render

* Explore: updates LokiQueryFieldForm to remove error render

* Explore: updates QueryRow component - brings back passing errors down

* Explore: removes QueryRowErrors component

* Explore: updates ErrorContainer component - moves out data filtering

* Explore: updates QueryRow component - changes QueryRowErrors to ErrorContainer

* Explore: updates Explore component - adds error filtering for ErrorContainer

* Explore: updates ErrorContainer and adds a basic test for it

* Explore: updates Explore component props name and adds a basic render test

* Explore: adds snapshots for Explore and ErrorContainer

* Explore: adds a test for error render

* Explore: adds a comment to Explore component explaining the way we filter non-query-row-specific errors

* Explore: adds getFirstNonQueryRowSpecificError method to explore utilities

* Explore: extracts getFirstNonQueryRowSpecificError method and slightly refactors Explore component

* Explore: updates Explore component tests to cover non-query-row-specific errors
This commit is contained in:
Lukas Siatka
2020-03-11 10:01:58 +01:00
committed by GitHub
parent bbed213115
commit 688283a5cc
11 changed files with 439 additions and 61 deletions

View File

@@ -292,12 +292,11 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
};
render() {
const { data, query, ExtraFieldElement } = this.props;
const { query, ExtraFieldElement } = this.props;
const { metricsOptions, syntaxLoaded, hint } = this.state;
const cleanText = this.languageProvider ? this.languageProvider.cleanText : undefined;
const chooserText = getChooserText(syntaxLoaded, metricsOptions);
const buttonDisabled = !(syntaxLoaded && metricsOptions && metricsOptions.length > 0);
const showError = data && data.error && data.error.refId === query.refId;
return (
<>
@@ -324,11 +323,6 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
</div>
{ExtraFieldElement}
</div>
{showError ? (
<div className="query-row-break">
<div className="prom-query-field-info text-error">{data.error.message}</div>
</div>
) : null}
{hint ? (
<div className="query-row-break">
<div className="prom-query-field-info text-warning">