Skip to content

Commit 5b56781

Browse files
committed
fix: design fixes
1 parent b4785d5 commit 5b56781

File tree

8 files changed

+58
-5
lines changed

8 files changed

+58
-5
lines changed

src/components/QueryExecutionStatus/QueryExecutionStatus.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const QueryExecutionStatus = ({className, error, loading}: QueryExecution
2727
let textColor: TextProps['color'];
2828

2929
const elapsedTime = useElapsedTime(loading);
30+
const isCancelled = isQueryCancelledError(error);
3031

3132
if (loading) {
3233
theme = 'info';
@@ -38,9 +39,9 @@ export const QueryExecutionStatus = ({className, error, loading}: QueryExecution
3839
textColor = 'danger-heavy';
3940
icon = <Icon data={CircleQuestionFill} />;
4041
label = 'Connection aborted';
41-
} else if (isQueryCancelledError(error)) {
42-
theme = 'danger';
43-
textColor = 'danger-heavy';
42+
} else if (isCancelled) {
43+
theme = 'warning';
44+
textColor = 'warning-heavy';
4445
icon = <Icon data={CircleStop} className={b('result-status-icon', {error: true})} />;
4546
label = 'Stopped';
4647
} else {

src/components/QuerySettingsDescription/QuerySettingsDescription.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
display: flex;
44
flex-wrap: wrap;
55

6-
font-size: var(--g-text-body-1-font-size);
76
white-space: pre;
87
}
98
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {getStringifiedData} from '../../../../utils/dataFormatters/dataFormatter
2020
import {useSetting, useTypedDispatch} from '../../../../utils/hooks';
2121
import {PaneVisibilityToggleButtons} from '../../utils/paneVisibilityToggleHelpers';
2222
import {QuerySettingsBanner} from '../QuerySettingsBanner/QuerySettingsBanner';
23+
import {QueryStoppedBanner} from '../QueryStoppedBanner/QueryStoppedBanner';
2324
import {getPreparedResult} from '../utils/getPreparedResult';
2425
import {isQueryCancelledError} from '../utils/isQueryCancelledError';
2526

@@ -323,13 +324,16 @@ export function QueryResultViewer({
323324
);
324325
};
325326

327+
const isCancelled = isQueryCancelledError(error);
328+
326329
return (
327330
<React.Fragment>
328331
<div className={b('controls')}>
329332
{renderLeftControls()}
330333
{renderRightControls()}
331334
</div>
332-
{isLoading || isQueryCancelledError(error) ? null : <QuerySettingsBanner />}
335+
{isLoading || isCancelled ? null : <QuerySettingsBanner />}
336+
{isCancelled ? <QueryStoppedBanner /> : null}
333337
<LoaderWrapper loading={isLoading && (!data.resultSets || activeSection !== 'result')}>
334338
<Fullscreen className={b('result')}>{renderResultSection()}</Fullscreen>
335339
</LoaderWrapper>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.ydb-query-stopped-banner {
2+
margin-top: var(--g-spacing-4);
3+
margin-right: var(--g-spacing-4);
4+
margin-left: var(--g-spacing-4);
5+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
3+
import {Alert} from '@gravity-ui/uikit';
4+
5+
import {cn} from '../../../../utils/cn';
6+
import {QUERY_STOPPED_BANNER_CLOSED_KEY} from '../../../../utils/constants';
7+
import {useSetting} from '../../../../utils/hooks';
8+
import i18n from '../i18n';
9+
const b = cn('ydb-query-stopped-banner');
10+
11+
import './QueryStoppedBanner.scss';
12+
13+
export function QueryStoppedBanner() {
14+
const [isQueryStoppedBannerClosed, setIsQueryStoppedBannerClosed] = useSetting<boolean>(
15+
QUERY_STOPPED_BANNER_CLOSED_KEY,
16+
);
17+
18+
const closeBanner = React.useCallback(() => {
19+
setIsQueryStoppedBannerClosed(true);
20+
}, [setIsQueryStoppedBannerClosed]);
21+
22+
return isQueryStoppedBannerClosed ? null : (
23+
<Alert
24+
className={b()}
25+
theme="normal"
26+
align="center"
27+
style={{paddingTop: 11, paddingBottom: 11}}
28+
message={<div className={b('message')}>{i18n('banner.query-stopped.message')}</div>}
29+
layout="horizontal"
30+
actions={
31+
<Alert.Actions>
32+
<Alert.Action view="normal" onClick={closeBanner}>
33+
{i18n('banner.query-stopped.never-show')}
34+
</Alert.Action>
35+
</Alert.Actions>
36+
}
37+
/>
38+
);
39+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656

5757
"gear.tooltip": "Query execution settings have been changed for ",
5858
"banner.query-settings.message": "Query was executed with modified settings: ",
59+
"banner.query-stopped.message": "Data is not up to date because the request was not completed.",
60+
"banner.query-stopped.never-show": "Never show again",
5961

6062
"toaster.stop-error": "Something went wrong. Unable to stop request processing. Please wait.",
6163

src/services/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
PARTITIONS_HIDDEN_COLUMNS_KEY,
1818
QUERY_EXECUTION_SETTINGS_KEY,
1919
QUERY_SETTINGS_BANNER_LAST_CLOSED_KEY,
20+
QUERY_STOPPED_BANNER_CLOSED_KEY,
2021
SAVED_QUERIES_KEY,
2122
SHOW_DOMAIN_DATABASE_KEY,
2223
TENANT_INITIAL_PAGE_KEY,
@@ -51,6 +52,7 @@ export const DEFAULT_USER_SETTINGS = {
5152
[AUTO_REFRESH_INTERVAL]: 0,
5253
[CASE_SENSITIVE_JSON_SEARCH]: false,
5354
[SHOW_DOMAIN_DATABASE_KEY]: false,
55+
[QUERY_STOPPED_BANNER_CLOSED_KEY]: false,
5456
[LAST_QUERY_EXECUTION_SETTINGS_KEY]: undefined,
5557
[QUERY_SETTINGS_BANNER_LAST_CLOSED_KEY]: undefined,
5658
[QUERY_EXECUTION_SETTINGS_KEY]: DEFAULT_QUERY_SETTINGS,

src/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const TENANT_OVERVIEW_TABLES_SETTINGS = {
9898
export const QUERY_EXECUTION_SETTINGS_KEY = 'queryExecutionSettings';
9999
export const LAST_QUERY_EXECUTION_SETTINGS_KEY = 'last_query_execution_settings';
100100
export const QUERY_SETTINGS_BANNER_LAST_CLOSED_KEY = 'querySettingsBannerLastClosed';
101+
export const QUERY_STOPPED_BANNER_CLOSED_KEY = 'queryStoppedBannerClosed';
101102

102103
export const LAST_USED_QUERY_ACTION_KEY = 'last_used_query_action';
103104

0 commit comments

Comments
 (0)