Skip to content

Commit b3d4e10

Browse files
committed
refactor: remove monaco-editor, codeMirror env flag, update codeEditor instances
1 parent e20fc7e commit b3d4e10

File tree

16 files changed

+31
-241
lines changed

16 files changed

+31
-241
lines changed

.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,5 @@ FEATURE_CLUSTER_MAP_ENABLE=true
6161
FEATURE_DEFAULT_LANDING_RB_ENABLE=false
6262
FEATURE_ACTION_AUDIOS_ENABLE=true
6363
FEATURE_APPLICATION_TEMPLATES_ENABLE=true
64-
FEATURE_CODE_MIRROR_ENABLE=false
6564
FEATURE_DEFAULT_AUTHENTICATED_VIEW_ENABLE=false
6665
GATEKEEPER_URL=https://license.devtron.ai/dashboard

package.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.11.0-pre-8",
7+
"@devtron-labs/devtron-fe-common-lib": "1.11.0-beta-9",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",
@@ -23,8 +23,6 @@
2323
"flexsearch": "^0.6.32",
2424
"jsonpath-plus": "^10.3.0",
2525
"moment": "^2.29.4",
26-
"monaco-editor": "0.44.0",
27-
"monaco-yaml": "5.1.1",
2826
"query-string": "^7.1.1",
2927
"react": "^17.0.2",
3028
"react-csv": "^2.2.2",
@@ -33,7 +31,6 @@
3331
"react-ga4": "^1.4.1",
3432
"react-gtm-module": "^2.0.11",
3533
"react-mde": "^11.5.0",
36-
"react-monaco-editor": "^0.55.0",
3734
"react-router-dom": "^5.3.4",
3835
"react-select": "5.8.0",
3936
"react-virtualized": "^9.22.5",
@@ -147,11 +144,7 @@
147144
],
148145
"setupFilesAfterEnv": [
149146
"jest-extended"
150-
],
151-
"moduleNameMapper": {
152-
"monaco-editor": "<rootDir>/node_modules/react-monaco-editor",
153-
"monaco-yaml": "<rootDir>/node_modules/react-monaco-editor"
154-
}
147+
]
155148
},
156149
"resolutions": {
157150
"nanoid": "^3.3.8",

src/Pages/GlobalConfigurations/Authorization/SSOLoginServices/SSOLogin.component.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
ErrorScreenManager,
4141
FeatureTitleWithInfo,
4242
InfoColourBar,
43-
isCodeMirrorEnabled,
4443
MODES,
4544
noop,
4645
Progressing,
@@ -667,9 +666,7 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
667666
this.state.configMap === SwitchItemValues.Configuration ? ssoConfig : YAMLStringify(sample[this.state.sso])
668667

669668
let presetConfig = (
670-
<div
671-
className={`w-100 code-editor__text ${!isCodeMirrorEnabled() ? 'code-editor__text--monaco-editor' : ''}`}
672-
>
669+
<div className="w-100 code-editor__text">
673670
<p className="m-0">config:</p>
674671
<p className="m-0">&nbsp;&nbsp;&nbsp;&nbsp;type: {this.state.ssoConfig.config.type}</p>
675672
<p className="m-0">&nbsp;&nbsp;&nbsp;&nbsp;name: {this.state.ssoConfig.config.name}</p>
@@ -680,9 +677,7 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
680677

681678
if (this.state.configMap === SwitchItemValues.Configuration && this.state.sso === OIDCType) {
682679
presetConfig = (
683-
<div
684-
className={`w-100 code-editor__text ${!isCodeMirrorEnabled() ? 'code-editor__text--monaco-editor' : ''}`}
685-
>
680+
<div className="w-100 code-editor__text">
686681
<p className="m-0">config:</p>
687682
<p className="m-0">&nbsp;&nbsp;&nbsp;&nbsp;type: {this.state.ssoConfig.config.type}</p>
688683
</div>
@@ -717,7 +712,6 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
717712
>
718713
<CodeEditor.Header>
719714
<div className="flex dc__content-space dc__gap-6">
720-
<CodeEditor.ValidationError />
721715
<div className="dc__no-shrink ml-auto">
722716
<Switch
723717
value={this.state.configMap}

src/Pages/GlobalConfigurations/Authorization/SSOLoginServices/ssoLogin.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,5 @@
2323
color: var(--R500);
2424
font-size: 14px;
2525
font-family: Consolas, "Courier New", monospace;
26-
27-
&--monaco-editor {
28-
padding: 0 35px;
29-
}
3026
}
3127
}

src/Pages/Shared/ConfigMapSecret/ConfigMapSecretData.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
configMapSecretMountDataMap,
2828
convertKeyValuePairToYAML,
2929
convertYAMLToKeyValuePair,
30-
isCodeMirrorEnabled,
3130
KeyValueConfig,
3231
KeyValueTable,
3332
MODES,
@@ -41,7 +40,6 @@ import {
4140
YAMLStringify,
4241
} from '@devtron-labs/devtron-fe-common-lib'
4342

44-
import { ReactComponent as ICErrorExclamation } from '@Icons/ic-error-exclamation.svg'
4543
import { ReactComponent as ICPencil } from '@Icons/ic-pencil.svg'
4644
import { ReactComponent as HideIcon } from '@Icons/ic-visibility-off.svg'
4745
import { importComponentFromFELibrary } from '@Components/common'
@@ -443,14 +441,6 @@ export const ConfigMapSecretData = ({
443441
</div>
444442
</div>
445443
</CodeEditor.Header>
446-
{!isCodeMirrorEnabled() &&
447-
codeEditorRadio === CODE_EDITOR_RADIO_STATE.DATA &&
448-
errors[codeEditorFormKey] && (
449-
<div className="flex left px-16 py-8 dc__gap-8 bcr-1 cr-5 fs-12 lh-20">
450-
<ICErrorExclamation className="icon-dim-16 dc__no-shrink" />
451-
<p className="m-0">{errors[codeEditorFormKey]}</p>
452-
</div>
453-
)}
454444
</CodeEditor>
455445
{!data.external && data.yamlMode && renderYamlInfoText()}
456446
</CodeEditor.Container>

src/components/ClusterNodes/ClusterManifest.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
import React, { useState, useEffect } from 'react'
1818
import YAML from 'yaml'
19-
import {
20-
VisibleModal2,
21-
YAMLStringify,
22-
CodeEditor,
23-
CodeEditorThemesKeys,
24-
AppThemeType,
25-
} from '@devtron-labs/devtron-fe-common-lib'
19+
import { VisibleModal2, YAMLStringify, CodeEditor, AppThemeType } from '@devtron-labs/devtron-fe-common-lib'
2620
import MessageUI, { MsgUIType } from '../v2/common/message.ui'
2721
import { getClusterManifest } from './clusterNodes.service'
2822
import { ManifestMessaging, MESSAGING_UI, MODES } from '../../config'
@@ -148,7 +142,7 @@ export default function ClusterManifest({
148142
diffView={manifestMode === EditModeType.REVIEW}
149143
codeEditorProps={{
150144
defaultValue: defaultManifest,
151-
theme: CodeEditorThemesKeys.vsDarkDT,
145+
theme: 'vs-dark--dt',
152146
height: '0',
153147
value: manifestValue,
154148
onChange: setManifest,
@@ -158,16 +152,16 @@ export default function ClusterManifest({
158152
height: '100%',
159153
...(manifestMode === EditModeType.REVIEW
160154
? {
161-
diffView: true,
162-
originalValue: defaultManifest,
163-
modifiedValue: manifestValue,
164-
onModifiedValueChange: setManifest,
165-
}
155+
diffView: true,
156+
originalValue: defaultManifest,
157+
modifiedValue: manifestValue,
158+
onModifiedValueChange: setManifest,
159+
}
166160
: {
167-
diffView: false,
168-
value: manifestValue,
169-
onChange: setManifest,
170-
}),
161+
diffView: false,
162+
value: manifestValue,
163+
onChange: setManifest,
164+
}),
171165
}}
172166
>
173167
{manifestMode === EditModeType.REVIEW && (

src/components/ClusterNodes/NodeDetails.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
ToastManager,
3535
ToastVariantType,
3636
ResourceDetail,
37-
CodeEditorThemesKeys,
3837
noop,
3938
AppThemeType,
4039
} from '@devtron-labs/devtron-fe-common-lib'
@@ -543,7 +542,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
543542

544543
return (
545544
<div>
546-
<div className='dc__border-bottom dc__position-sticky dc__top-0 dc__zi-1 bg__primary'>
545+
<div className="dc__border-bottom dc__position-sticky dc__top-0 dc__zi-1 bg__primary">
547546
<div className="en-2 bw-1 dc__top-radius-4 bg__primary dc__no-bottom-border resource-row dc__border-bottom fw-6 fs-13 pt-8 pb-8 pr-20 pl-20 cn-7">
548547
<div />
549548
<div>Resource</div>
@@ -554,7 +553,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
554553
<div>Capacity</div>
555554
</div>
556555
</div>
557-
<div className='en-2 bw-1 br-4 dc__no-top-radius dc__no-top-border bg__primary mb-20'>
556+
<div className="en-2 bw-1 br-4 dc__no-top-radius dc__no-top-border bg__primary mb-20">
558557
{cpuData && (
559558
<div className="resource-row dc__border-bottom-n1 fw-4 fs-13 pt-8 pb-8 pr-20 pl-20 cn-9">
560559
<Cpu className="mt-2 mb-2 icon-dim-18" />
@@ -833,7 +832,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
833832
{renderProbableIssuesOverviewCard()}
834833
{renderNodeOverviewCard()}
835834
</div>
836-
<div className='dc__overflow-auto pr-20'>
835+
<div className="dc__overflow-auto pr-20">
837836
{renderResourceList()}
838837
{renderLabelAnnotationTaint()}
839838
{renderPodList()}
@@ -926,7 +925,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
926925
mode={MODES.YAML}
927926
noParsing
928927
codeEditorProps={{
929-
theme: CodeEditorThemesKeys.vsDarkDT,
928+
theme: 'vs-dark--dt',
930929
value: modifiedManifest,
931930
defaultValue: (nodeDetail?.manifest && YAMLStringify(nodeDetail.manifest)) || '',
932931
height: '0',
@@ -1055,9 +1054,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
10551054
return (
10561055
<ErrorScreenManager
10571056
code={errorResponseCode}
1058-
subtitle={
1059-
errorResponseCode == 403 ? unauthorizedInfoText(SIDEBAR_KEYS.nodeGVK.Kind.toLowerCase()) : ''
1060-
}
1057+
subtitle={errorResponseCode == 403 ? unauthorizedInfoText(SIDEBAR_KEYS.nodeGVK.Kind.toLowerCase()) : ''}
10611058
/>
10621059
)
10631060
}

src/components/ResourceBrowser/ResourceList/CreateResource.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import React, { useEffect, useState } from 'react'
1818

1919
import {
2020
CodeEditor,
21-
CodeEditorThemesKeys,
2221
createNewResource,
2322
CreateResourceDTO,
2423
Drawer,
@@ -155,7 +154,7 @@ export const CreateResource: React.FC<CreateResourceType> = ({ closePopup, clust
155154
noParsing
156155
loading={loader}
157156
codeEditorProps={{
158-
theme: CodeEditorThemesKeys.vsDarkDT,
157+
theme: 'vs-dark--dt',
159158
value: resourceYAML,
160159
height: '0',
161160
onChange: handleEditorValueChange,

src/components/charts/AdvancedConfig.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
CodeEditor,
2525
MarkDown,
2626
MODES,
27-
isCodeMirrorEnabled,
2827
} from '@devtron-labs/devtron-fe-common-lib'
2928
import { useHistory } from 'react-router-dom'
3029
import { Select, mapByKey, useKeyDown, Info, Pencil } from '../common'
@@ -650,16 +649,7 @@ const ValuesDiffViewer = ({
650649
<Pencil style={{ marginLeft: 'auto' }} />
651650
</h5>
652651
</div>
653-
<div
654-
{...(isCodeMirrorEnabled()
655-
? {
656-
className: 'mw-none mh-0',
657-
}
658-
: {
659-
className: 'readme-config--body',
660-
style: { gridTemplateColumns: '1fr' },
661-
})}
662-
>
652+
<div className="mw-none mh-0">
663653
<CodeEditor
664654
mode={MODES.YAML}
665655
noParsing

src/components/common/navigation/NavigationRoutes.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,13 @@ import { LOGIN_COUNT, MAX_LOGIN_COUNT } from '../../onboardingGuide/onboarding.u
7272
import { HelmAppListResponse } from '../../app/list-new/AppListType'
7373
import { ExternalFluxAppDetailsRoute } from '../../../Pages/App/Details/ExternalFlux'
7474

75-
// Monaco Editor worker dependency
76-
import 'monaco-editor'
77-
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
78-
import YamlWorker from '../../../yaml.worker.js?worker'
7975
import { TAB_DATA_LOCAL_STORAGE_KEY } from '../DynamicTabs/constants'
8076
import { ENVIRONMENT_DATA_FALLBACK, INITIAL_ENV_DATA_STATE } from './constants'
8177
import { ParsedTabsData } from '../DynamicTabs/types'
8278
import { SwitchThemeDialog } from '@Pages/Shared'
8379
import { SwitchThemeDialogProps } from '@Pages/Shared/SwitchThemeDialog/types'
8480
import { EnvironmentDataStateType } from './types'
8581

86-
// Monaco Editor worker initialization
87-
self.MonacoEnvironment = {
88-
getWorker(_, label) {
89-
if (label === MODES.YAML) {
90-
return new YamlWorker()
91-
}
92-
return new editorWorker()
93-
},
94-
}
95-
9682
const Charts = lazy(() => import('../../charts/Charts'))
9783
const ExternalApps = lazy(() => import('../../external-apps/ExternalApps'))
9884
const ExternalArgoApps = lazy(() => import('../../externalArgoApps/ExternalArgoApp'))

0 commit comments

Comments
 (0)