Skip to content

Commit 8f64bdf

Browse files
committed
fix: error state
1 parent 8921243 commit 8f64bdf

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
lines changed

src/containers/Tenant/Query/QueryResult/QueryResultViewer.tsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import React from 'react';
22

33
import type {Settings} from '@gravity-ui/react-data-table';
44
import type {ControlGroupOption} from '@gravity-ui/uikit';
5-
import {ClipboardButton, RadioButton} from '@gravity-ui/uikit';
5+
import {ClipboardButton, Flex, RadioButton, Text} from '@gravity-ui/uikit';
66

7+
import {EmptyState} from '../../../../components/EmptyState';
78
import EnableFullscreenButton from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
89
import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
10+
import {Illustration} from '../../../../components/Illustration';
911
import {LoaderWrapper} from '../../../../components/LoaderWrapper/LoaderWrapper';
1012
import {QueryExecutionStatus} from '../../../../components/QueryExecutionStatus';
1113
import {disableFullscreen} from '../../../../store/reducers/fullscreen';
@@ -25,7 +27,6 @@ import {Ast} from './components/Ast/Ast';
2527
import {Graph} from './components/Graph/Graph';
2628
import {QueryInfoDropdown} from './components/QueryInfoDropdown/QueryInfoDropdown';
2729
import {QueryJSONViewer} from './components/QueryJSONViewer/QueryJSONViewer';
28-
import {QueryResultError} from './components/QueryResultError/QueryResultError';
2930
import {ResultSetsViewer} from './components/ResultSetsViewer/ResultSetsViewer';
3031
import {SimplifiedPlan} from './components/SimplifiedPlan/SimplifiedPlan';
3132
import {StubMessage} from './components/Stub/Stub';
@@ -229,7 +230,16 @@ export function QueryResultViewer({
229230
}
230231

231232
if (error) {
232-
return <QueryResultError error={error} />;
233+
return (
234+
<Flex justifyContent="center" alignItems="center" width="100%">
235+
<EmptyState
236+
size="s"
237+
image={<Illustration name="error" />}
238+
title={i18n('error.title')}
239+
description={<Text color="complementary">{i18n('error.description')}</Text>}
240+
/>
241+
</Flex>
242+
);
233243
}
234244

235245
if (activeSection === RESULT_OPTIONS_IDS.schema) {
@@ -269,17 +279,15 @@ export function QueryResultViewer({
269279
const renderLeftControls = () => {
270280
return (
271281
<div className={b('controls-left')}>
272-
{!error && (
273-
<React.Fragment>
274-
{radioButtonOptions.length && activeSection ? (
275-
<RadioButton
276-
options={radioButtonOptions}
277-
value={activeSection}
278-
onUpdate={onSelectSection}
279-
/>
280-
) : null}
281-
</React.Fragment>
282-
)}
282+
<React.Fragment>
283+
{radioButtonOptions.length && activeSection ? (
284+
<RadioButton
285+
options={radioButtonOptions}
286+
value={activeSection}
287+
onUpdate={onSelectSection}
288+
/>
289+
) : null}
290+
</React.Fragment>
283291
<QueryExecutionStatus error={error} loading={isLoading} />
284292
{data?.traceId && isExecute ? <TraceButton traceId={data.traceId} /> : null}
285293
</div>

src/containers/Tenant/Query/QueryResult/components/ResultSetsViewer/ResultSetsViewer.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
width: 100%;
2424
}
2525

26+
&__error-container {
27+
padding-top: var(--g-spacing-4);
28+
padding-left: var(--g-spacing-4);
29+
}
30+
2631
&__result {
2732
display: flex;
2833
overflow: auto;

src/containers/Tenant/Query/QueryResult/components/ResultSetsViewer/ResultSetsViewer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ export function ResultSetsViewer(props: ResultSetsViewerProps) {
6464

6565
return (
6666
<div className={b('result-wrapper')}>
67+
{props.error ? (
68+
<div className={b('error-container')}>
69+
<QueryResultError error={error} />{' '}
70+
</div>
71+
) : null}
6772
{renderTabs()}
68-
{props.error ? <QueryResultError error={error} /> : null}
6973
{currentResult ? (
7074
<div className={b('result')}>
7175
<QueryResultTable

src/containers/Tenant/Query/QueryResult/i18n/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@
1818
"text_download_description": "SVG",
1919
"text_diagnostics": "Download Diagnostics",
2020
"text_diagnostics_description": "JSON",
21-
"text_error-plan-svg": "Error: {{error}}"
21+
"text_error-plan-svg": "Error: {{error}}",
22+
23+
"error.title": "Query Failed",
24+
"error.description": "An error occurred, please see the Result tab for details"
2225
}

0 commit comments

Comments
 (0)