Skip to content

Commit 348dcd1

Browse files
committed
fixed monaco editor tooltip + removed unused code + version bump
1 parent 4ab7ea4 commit 348dcd1

File tree

6 files changed

+1015
-996
lines changed

6 files changed

+1015
-996
lines changed

config-overrides.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
"http-proxy-middleware": "^2.0.6",
2626
"marked": "4.3.0",
2727
"moment": "^2.29.4",
28-
"monaco-editor": "0.38.0",
29-
"monaco-editor-webpack-plugin": "^7.1.0",
30-
"monaco-yaml": "4.0.4",
28+
"monaco-editor": "0.45.0",
29+
"monaco-yaml": "5.1.1",
3130
"query-string": "^7.1.1",
3231
"react": "^17.0.2",
3332
"react-csv": "^2.2.2",
@@ -38,7 +37,7 @@
3837
"react-gtm-module": "^2.0.11",
3938
"react-keybind": "^0.9.4",
4039
"react-mde": "^11.5.0",
41-
"react-monaco-editor": "^0.54.0",
40+
"react-monaco-editor": "^0.55.0",
4241
"react-router-dom": "^5.3.4",
4342
"react-select": "^5.2.2",
4443
"react-toastify": "^8.2.0",

src/components/CodeEditor/CodeEditor.tsx

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
import React, { useEffect, useCallback, useReducer, useRef } from 'react'
22
import MonacoEditor, { MonacoDiffEditor } from 'react-monaco-editor'
3-
import { Progressing, copyToClipboard, useWindowSize } from '@devtron-labs/devtron-fe-common-lib'
3+
import { MODES, Progressing, copyToClipboard, useWindowSize } from '@devtron-labs/devtron-fe-common-lib'
44
import YAML from 'yaml'
55
import ReactGA from 'react-ga4'
66
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
7+
import { configureMonacoYaml } from 'monaco-yaml'
8+
79
import { useJsonYaml, Select, RadioGroup } from '../common'
810
import { ReactComponent as ClipboardIcon } from '../../assets/icons/ic-copy.svg'
911
import { ReactComponent as Info } from '../../assets/icons/ic-info-filled.svg'
1012
import { ReactComponent as ErrorIcon } from '../../assets/icons/ic-error-exclamation.svg'
1113
import { ReactComponent as WarningIcon } from '../../assets/icons/ic-warning.svg'
1214
import './codeEditor.scss'
1315
import 'monaco-editor'
16+
17+
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
18+
import YamlWorker from '../../yaml.worker.js?worker'
1419
import { cleanKubeManifest } from '../../util/Util'
1520

21+
self.MonacoEnvironment = {
22+
getWorker(_, label) {
23+
if (label === MODES.YAML) {
24+
return new YamlWorker()
25+
}
26+
return new editorWorker()
27+
},
28+
}
29+
1630
// @ts-ignore
1731
const { yaml } = monaco.languages || {}
1832

@@ -223,22 +237,17 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
223237
if (!validatorSchema) {
224238
return
225239
}
226-
yaml &&
227-
yaml.yamlDefaults.setDiagnosticsOptions({
228-
validate: true,
229-
enableSchemaRequest: true,
230-
hover: true,
231-
completion: true,
232-
isKubernetes,
233-
format: true,
234-
schemas: [
235-
{
236-
uri: `https://github.com/devtron-labs/devtron/tree/main/scripts/devtron-reference-helm-charts/reference-chart_${chartVersion}/schema.json`, // id of the first schema
237-
fileMatch: ['*'], // associate with our model
238-
schema: validatorSchema,
239-
},
240-
],
241-
})
240+
configureMonacoYaml(monaco, {
241+
enableSchemaRequest: true,
242+
isKubernetes,
243+
schemas: [
244+
{
245+
uri: `https://github.com/devtron-labs/devtron/tree/main/scripts/devtron-reference-helm-charts/reference-chart_${chartVersion}/schema.json`, // id of the first schema
246+
fileMatch: ['*'], // associate with our model
247+
schema: validatorSchema,
248+
},
249+
],
250+
})
242251
// eslint-disable-next-line react-hooks/exhaustive-deps
243252
}, [validatorSchema, chartVersion])
244253
useEffect(() => {

src/yaml.worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import 'monaco-yaml/yaml.worker'

vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ export default defineConfig(({ mode }) => {
8282
port: 3000,
8383
proxy: {
8484
'/orchestrator': {
85-
target: 'https://preview.devtron.ai/',
85+
target: 'https://kush.devtron.info/',
8686
changeOrigin: true,
8787
},
88-
'/grafana': 'https://preview.devtron.ai/',
88+
'/grafana': 'https://kush.devtron.info/',
8989
},
9090
},
9191
}

0 commit comments

Comments
 (0)