Skip to content

Commit 3438f11

Browse files
committed
fix: move to experiments
1 parent cfeb98f commit 3438f11

File tree

11 files changed

+20
-32
lines changed

11 files changed

+20
-32
lines changed

src/containers/Tenant/Query/ExecuteResult/ExecuteResult.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import type {ValueOf} from '../../../../types/common';
1818
import type {ExecuteQueryResult} from '../../../../types/store/executeQuery';
1919
import {getArray} from '../../../../utils';
2020
import {cn} from '../../../../utils/cn';
21+
import {USE_SHOW_PLAN_SVG_KEY} from '../../../../utils/constants';
2122
import {getStringifiedData} from '../../../../utils/dataFormatters/dataFormatters';
22-
import {useQueryExecutionSettings, useTypedDispatch} from '../../../../utils/hooks';
23+
import {useSetting, useTypedDispatch} from '../../../../utils/hooks';
2324
import {parseQueryError} from '../../../../utils/query';
2425
import {PaneVisibilityToggleButtons} from '../../utils/paneVisibilityToggleHelpers';
2526
import {CancelQueryButton} from '../CancelQueryButton/CancelQueryButton';
@@ -68,7 +69,7 @@ export function ExecuteResult({
6869
const [selectedResultSet, setSelectedResultSet] = React.useState(0);
6970
const [activeSection, setActiveSection] = React.useState<SectionID>(resultOptionsIds.result);
7071
const dispatch = useTypedDispatch();
71-
const [{showPlanToSvg}] = useQueryExecutionSettings();
72+
const [useShowPlanToSvg] = useSetting<boolean>(USE_SHOW_PLAN_SVG_KEY);
7273

7374
const {error, isLoading, queryId, data} = result;
7475

@@ -275,7 +276,7 @@ export function ExecuteResult({
275276
{data?.traceId ? (
276277
<TraceButton traceId={data.traceId} isTraceReady={result.isTraceReady} />
277278
) : null}
278-
{data?.plan && showPlanToSvg ? (
279+
{data?.plan && useShowPlanToSvg ? (
279280
<PlanToSvgButton plan={data?.plan} database={tenantName} />
280281
) : null}
281282
</div>

src/containers/Tenant/Query/ExecuteResult/PlanToSvgButton.scss

Whitespace-only changes.

src/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.tsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import {Checkbox, Dialog, Link as ExternalLink, Flex, TextInput} from '@gravity-ui/uikit';
3+
import {Dialog, Link as ExternalLink, Flex, TextInput} from '@gravity-ui/uikit';
44
import {zodResolver} from '@hookform/resolvers/zod';
55
import {Controller, useForm} from 'react-hook-form';
66

@@ -219,25 +219,6 @@ function QuerySettingsForm({initialValues, onSubmit, onClose}: QuerySettingsForm
219219
/>
220220
</div>
221221
</Flex>
222-
<Flex direction="row" alignItems="flex-start" className={b('dialog-row')}>
223-
<label htmlFor="showPlanToSvg" className={b('field-title')}>
224-
{QUERY_SETTINGS_FIELD_SETTINGS.showPlanToSvg.title}
225-
</label>
226-
<div className={b('control-wrapper')}>
227-
<Controller
228-
name="showPlanToSvg"
229-
control={control}
230-
render={({field: {value, onChange, ...field}}) => (
231-
<Checkbox
232-
id="showPlanToSvg"
233-
checked={Boolean(value)}
234-
onUpdate={onChange}
235-
{...field}
236-
/>
237-
)}
238-
/>
239-
</div>
240-
</Flex>
241222
</Dialog.Body>
242223
<Dialog.Footer
243224
textButtonApply={i18n('button-done')}

src/containers/Tenant/Query/QuerySettingsDialog/constants.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,4 @@ export const QUERY_SETTINGS_FIELD_SETTINGS = {
151151
limitRows: {
152152
title: formI18n('form.limit-rows'),
153153
},
154-
showPlanToSvg: {
155-
title: formI18n('form.show-plan-to-svg'),
156-
},
157154
} as const;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"form.statistics-mode": "Statistics collection mode",
77
"form.tracing-level": "Tracing level",
88
"form.limit-rows": "Limit rows",
9-
"form.show-plan-to-svg": "Plan to svg",
109
"button-done": "Save",
1110
"button-cancel": "Cancel",
1211
"form.timeout.seconds": "sec",

src/containers/Tenant/Query/QuerySettingsDialog/i18n/ru.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"form.statistics-mode": "Режим сбора статистики",
77
"form.tracing-level": "Tracing level",
88
"form.limit-rows": "Лимит строк",
9-
"form.show-plan-to-svg": "План в svg",
109
"button-done": "Готово",
1110
"button-cancel": "Отменить",
1211
"form.timeout.seconds": "сек",

src/containers/UserSettings/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
"settings.usePaginatedTables.title": "Use paginated tables",
3434
"settings.usePaginatedTables.description": " Use table with data load on scroll for Nodes and Storage tabs. It will increase performance, but could work unstable",
3535

36+
"settings.useShowPlanToSvg.title": "Use show plan to svg",
37+
"settings.useShowPlanToSvg.description": " Show \"Plan to svg\" button in query result widow (if query was executed with full stats option).",
38+
3639
"settings.showDomainDatabase.title": "Show domain database",
3740

3841
"settings.useClusterBalancerAsBackend.title": "Use cluster balancer as backend",

src/containers/UserSettings/settings.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
THEME_KEY,
1313
USE_CLUSTER_BALANCER_AS_BACKEND_KEY,
1414
USE_PAGINATED_TABLES_KEY,
15+
USE_SHOW_PLAN_SVG_KEY,
1516
} from '../../utils/constants';
1617
import {Lang, defaultLang} from '../../utils/i18n';
1718

@@ -96,6 +97,12 @@ export const usePaginatedTables: SettingProps = {
9697
description: i18n('settings.usePaginatedTables.description'),
9798
};
9899

100+
export const useShowPlanToSvgTables: SettingProps = {
101+
settingKey: USE_SHOW_PLAN_SVG_KEY,
102+
title: i18n('settings.useShowPlanToSvg.title'),
103+
description: i18n('settings.useShowPlanToSvg.description'),
104+
};
105+
99106
export const showDomainDatabase: SettingProps = {
100107
settingKey: SHOW_DOMAIN_DATABASE_KEY,
101108
title: i18n('settings.showDomainDatabase.title'),
@@ -138,7 +145,7 @@ export const appearanceSection: SettingsSection = {
138145
export const experimentsSection: SettingsSection = {
139146
id: 'experimentsSection',
140147
title: i18n('section.experiments'),
141-
settings: [usePaginatedTables],
148+
settings: [usePaginatedTables, useShowPlanToSvgTables],
142149
};
143150
export const devSettingsSection: SettingsSection = {
144151
id: 'devSettingsSection',

src/services/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
THEME_KEY,
2020
USE_CLUSTER_BALANCER_AS_BACKEND_KEY,
2121
USE_PAGINATED_TABLES_KEY,
22+
USE_SHOW_PLAN_SVG_KEY,
2223
} from '../utils/constants';
2324
import {DEFAULT_QUERY_SETTINGS, QUERY_ACTIONS} from '../utils/query';
2425
import {parseJson} from '../utils/utils';
@@ -37,6 +38,7 @@ export const DEFAULT_USER_SETTINGS = {
3738
[ASIDE_HEADER_COMPACT_KEY]: true,
3839
[PARTITIONS_HIDDEN_COLUMNS_KEY]: [],
3940
[USE_PAGINATED_TABLES_KEY]: true,
41+
[USE_SHOW_PLAN_SVG_KEY]: false,
4042
[USE_CLUSTER_BALANCER_AS_BACKEND_KEY]: true,
4143
[ENABLE_AUTOCOMPLETE]: true,
4244
[AUTOCOMPLETE_ON_ENTER]: true,

src/utils/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export const TENANT_INITIAL_PAGE_KEY = 'saved_tenant_initial_tab';
134134
// Old key value for backward compatibility
135135
export const USE_PAGINATED_TABLES_KEY = 'useBackendParamsForTables';
136136

137+
export const USE_SHOW_PLAN_SVG_KEY = 'useShowPlanToSvg';
138+
137139
// Setting to hide domain in database list
138140
export const SHOW_DOMAIN_DATABASE_KEY = 'showDomainDatabase';
139141

0 commit comments

Comments
 (0)