/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsTimeout.tsx
65 строк
2 KB
Hellen
feat!: update zod and add configuration (#4062)
29 июн 2026, 13:42
Не верифицирован
29 июн 2026, 13:42
5103c45
Код
Авторство
О чём код?
import React from 'react'; import {TextInput} from '@gravity-ui/uikit'; import {cn} from '../../../../utils/cn'; import {TimeoutLabel} from './TimeoutLabel'; import i18n from './i18n'; import './QuerySettingsTimeout.scss'; const b = cn('ydb-query-settings-timeout'); interface QuerySettingsTimeoutProps { id?: string; value: string | number | null | undefined; onChange: (value: string) => void; onToggle: (enabled: boolean) => void; validationState?: 'invalid'; errorMessage?: string; isDisabled?: boolean; } export function QuerySettingsTimeout({ id, value, onChange, onToggle, validationState, errorMessage, isDisabled, }: QuerySettingsTimeoutProps) { const handleValueChange = React.useCallback( (event: React.ChangeEvent<HTMLInputElement>) => { onChange(event.target.value); }, [onChange], ); const isChecked = value !== null; return ( <React.Fragment> <TimeoutLabel isDisabled={isDisabled} isChecked={isChecked} onToggle={onToggle} /> {isChecked && ( <div className={b('control-wrapper')}> <TextInput id={id} type="number" value={value?.toString() || ''} onChange={handleValueChange} className={b('input')} placeholder="60" validationState={validationState} errorMessage={errorMessage} errorPlacement="inside" endContent={ <span className={b('postfix')}>{i18n('form.timeout.seconds')}</span> } /> </div> )} </React.Fragment> ); }