@@ -4,7 +4,10 @@ import {Button, Dialog, Flex, TextArea, TextInput, Tooltip} from '@gravity-ui/ui
44import { zodResolver } from '@hookform/resolvers/zod' ;
55import { Controller , useForm } from 'react-hook-form' ;
66
7- import { useTracingLevelOptionAvailable } from '../../../../store/reducers/capabilities/hooks' ;
7+ import {
8+ useSnapshotReadWriteAvailable ,
9+ useTracingLevelOptionAvailable ,
10+ } from '../../../../store/reducers/capabilities/hooks' ;
811import {
912 selectQueryAction ,
1013 setQueryAction ,
@@ -24,6 +27,7 @@ import type {ResourcePoolValue} from '../../../../utils/query';
2427import {
2528 RESOURCE_POOL_NO_OVERRIDE_VALUE ,
2629 STATISTICS_MODES_WITH_SVG ,
30+ TRANSACTION_MODES ,
2731 isStreamingSupportedForMode ,
2832 querySettingsValidationSchema ,
2933} from '../../../../utils/query' ;
@@ -93,6 +97,7 @@ function QuerySettingsForm({initialValues, onSubmit, onClose}: QuerySettingsForm
9397
9498 const [ useShowPlanToSvg ] = useSetting < boolean > ( SETTING_KEYS . USE_SHOW_PLAN_SVG ) ;
9599 const enableTracingLevel = useTracingLevelOptionAvailable ( ) ;
100+ const enableSnapshotReadWrite = useSnapshotReadWriteAvailable ( ) ;
96101 const [ isQueryStreamingEnabled ] = useQueryStreamingSetting ( ) ;
97102 const { database} = useCurrentSchema ( ) ;
98103 const { resourcePools, isLoading : isResourcePoolsLoading } = useResourcePools (
@@ -142,6 +147,15 @@ function QuerySettingsForm({initialValues, onSubmit, onClose}: QuerySettingsForm
142147 } ) ;
143148 } , [ useShowPlanToSvg ] ) ;
144149
150+ const transactionModeOptions = React . useMemo ( ( ) => {
151+ return QUERY_SETTINGS_FIELD_SETTINGS . transactionMode . options . filter ( ( option ) => {
152+ if ( option . value === TRANSACTION_MODES . snapshotrw ) {
153+ return enableSnapshotReadWrite ;
154+ }
155+ return true ;
156+ } ) ;
157+ } , [ enableSnapshotReadWrite ] ) ;
158+
145159 return (
146160 < form onSubmit = { handleSubmit ( onSubmit ) } >
147161 < Dialog . Body className = { b ( 'dialog-body' ) } >
@@ -208,9 +222,7 @@ function QuerySettingsForm({initialValues, onSubmit, onClose}: QuerySettingsForm
208222 id = "transactionMode"
209223 setting = { field . value }
210224 onUpdateSetting = { field . onChange }
211- settingOptions = {
212- QUERY_SETTINGS_FIELD_SETTINGS . transactionMode . options
213- }
225+ settingOptions = { transactionModeOptions }
214226 />
215227 ) }
216228 />
0 commit comments