1
+ import { useThemeValue } from '@gravity-ui/uikit' ;
2
+ import MonacoEditor from 'react-monaco-editor' ;
3
+
1
4
import { ResponseError } from '../../../../components/Errors/ResponseError' ;
2
5
import { LoaderWrapper } from '../../../../components/LoaderWrapper/LoaderWrapper' ;
3
- import { YDBSyntaxHighlighterLazy } from '../../../../components/SyntaxHighlighter/lazy' ;
4
6
import { configsApi } from '../../../../store/reducers/configs' ;
5
7
import { useAutoRefreshInterval } from '../../../../utils/hooks/useAutoRefreshInterval' ;
6
8
7
9
interface StartupProps {
8
10
database ?: string ;
9
11
className ?: string ;
10
12
}
13
+
14
+ const EDITOR_OPTIONS = {
15
+ automaticLayout : true ,
16
+ selectOnLineNumbers : true ,
17
+ readOnly : true ,
18
+ minimap : {
19
+ enabled : false ,
20
+ } ,
21
+ wrappingIndent : 'indent' as const ,
22
+ } ;
23
+
11
24
export function Startup ( { database, className} : StartupProps ) {
12
25
const [ autoRefreshInterval ] = useAutoRefreshInterval ( ) ;
26
+ const theme = useThemeValue ( ) ;
13
27
const { currentData, isLoading, error} = configsApi . useGetConfigQuery (
14
28
{ database} ,
15
29
{ pollingInterval : autoRefreshInterval } ,
@@ -21,13 +35,14 @@ export function Startup({database, className}: StartupProps) {
21
35
< LoaderWrapper loading = { isLoading } >
22
36
{ error ? < ResponseError error = { error } /> : null }
23
37
{ startup ? (
24
- < YDBSyntaxHighlighterLazy
25
- className = { className }
26
- language = "yaml"
27
- text = { startup }
28
- transparentBackground = { false }
29
- withClipboardButton = { { alwaysVisible : true , withLabel : false , size : 'm' } }
30
- />
38
+ < div className = { className } >
39
+ < MonacoEditor
40
+ language = { 'yaml' }
41
+ value = { startup }
42
+ options = { EDITOR_OPTIONS }
43
+ theme = { `vs-${ theme } ` }
44
+ />
45
+ </ div >
31
46
) : null }
32
47
</ LoaderWrapper >
33
48
) ;
0 commit comments