Skip to content

Commit 106af46

Browse files
committed
Merge branch 'develop' into feat/runtime-param
2 parents ab4c4ab + 937f5c1 commit 106af46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2346
-895
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.2.5-beta-2",
3+
"version": "0.2.13-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -23,12 +23,12 @@
2323
],
2424
"scripts": {
2525
"prepare": "node -e \"try { require('husky').install() } catch (e) {}\"",
26-
"lint": "tsc --noEmit && NODE_OPTIONS=--max_old_space_size=8192 eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
26+
"lint": "tsc --noEmit && NODE_OPTIONS=--max_old_space_size=3072 eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
2727
"lint-fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
2828
"test": "exit 0",
29-
"dev": "NODE_OPTIONS=--max_old_space_size=8192 vite",
30-
"build": "NODE_OPTIONS=--max_old_space_size=8192 vite build --sourcemap",
31-
"build-watch": "NODE_OPTIONS=--max_old_space_size=8192 vite build --sourcemap --watch",
29+
"dev": "NODE_OPTIONS=--max_old_space_size=3072 vite",
30+
"build": "NODE_OPTIONS=--max_old_space_size=3072 vite build --sourcemap",
31+
"build-watch": "NODE_OPTIONS=--max_old_space_size=3072 vite build --sourcemap --watch",
3232
"build-lib": "vite build",
3333
"preview": "vite preview",
3434
"lint-staged": "lint-staged"

src/Assets/Icon/ic-aborted.svg

Lines changed: 5 additions & 0 deletions
Loading

src/Assets/Icon/ic-filter-applied.svg

Lines changed: 3 additions & 3 deletions
Loading

src/Assets/Icon/ic-filter.svg

Lines changed: 2 additions & 2 deletions
Loading

src/Assets/Icon/ic-lines.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Assets/Icon/ic-pulsate-status.svg

Lines changed: 21 additions & 0 deletions
Loading

src/Common/AppStatus/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { TIMELINE_STATUS } from "../../Shared/constants"
17+
import { TIMELINE_STATUS } from '../../Shared/constants'
1818

1919
export const triggerStatus = (triggerDetailStatus: string): string => {
2020
const triggerStatus = triggerDetailStatus?.toUpperCase()

src/Common/CodeEditor/CodeEditor.tsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { useEffect, useReducer, useRef } from 'react'
17+
import React, { useEffect, useMemo, useReducer, useRef, useState } from 'react'
1818
import MonacoEditor, { MonacoDiffEditor } from 'react-monaco-editor'
1919
import YAML from 'yaml'
2020
import ReactGA from 'react-ga4'
@@ -55,12 +55,9 @@ function useCodeEditorContext() {
5555
}
5656

5757
/**
58-
* NOTE: once monaco editor mounts it doesn't update it's internal onChange state.
59-
* Since most of the time onChange methods are declared inside the render body of a component
60-
* we should use the latest references of onChange.
61-
* Please see: https://github.com/react-monaco-editor/react-monaco-editor/issues/704
62-
* Thus as a hack we are using this objects reference to call the latest onChange reference
63-
*/
58+
* TODO: can be removed with this new merge into react-monaco-editor :)
59+
* see: https://github.com/react-monaco-editor/react-monaco-editor/pull/955
60+
* */
6461
const _onChange = {
6562
onChange: null,
6663
}
@@ -90,6 +87,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
9087
cleanData = false,
9188
onBlur,
9289
onFocus,
90+
adjustEditorHeightToContent,
9391
}) => {
9492
if (cleanData) {
9593
value = cleanKubeManifest(value)
@@ -103,6 +101,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
103101
const [state, dispatch] = useReducer(memoisedReducer, initialState({ mode, theme, value, diffView, noParsing }))
104102
const [, json, yamlCode, error] = useJsonYaml(state.code, tabSize, state.mode, !state.noParsing)
105103
const [, originalJson, originlaYaml] = useJsonYaml(defaultValue, tabSize, state.mode, !state.noParsing)
104+
const [contentHeight, setContentHeight] = useState(height)
106105
monaco.editor.defineTheme(CodeEditorThemesKeys.vsDarkDT, {
107106
base: 'vs-dark',
108107
inherit: true,
@@ -167,10 +166,24 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
167166
}
168167
}
169168

169+
if (adjustEditorHeightToContent) {
170+
setContentHeight(editor.getContentHeight())
171+
editor.onDidContentSizeChange(() => {
172+
setContentHeight(editor.getContentHeight())
173+
})
174+
}
175+
170176
editorRef.current = editor
171177
monacoRef.current = monaco
172178
}
173179

180+
const editorHeight = useMemo(() => {
181+
if (!adjustEditorHeightToContent) {
182+
return height
183+
}
184+
return contentHeight
185+
}, [height, contentHeight, adjustEditorHeightToContent])
186+
174187
useEffect(() => {
175188
if (!validatorSchema) {
176189
return
@@ -283,7 +296,9 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
283296
}
284297

285298
return (
286-
<CodeEditorContext.Provider value={{ dispatch, state, handleLanguageChange, error, defaultValue, height }}>
299+
<CodeEditorContext.Provider
300+
value={{ dispatch, state, handleLanguageChange, error, defaultValue, height: editorHeight }}
301+
>
287302
{children}
288303
{loading ? (
289304
<CodeEditorPlaceholder customLoader={customLoader} />
@@ -301,7 +316,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
301316
options={diffViewOptions}
302317
theme={state.theme.toLowerCase().split(' ').join('-')}
303318
editorDidMount={editorDidMount}
304-
height={height}
319+
height={editorHeight}
305320
width="100%"
306321
/>
307322
) : (
@@ -312,7 +327,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
312327
options={options}
313328
onChange={handleOnChange}
314329
editorDidMount={editorDidMount}
315-
height={height}
330+
height={editorHeight}
316331
width="100%"
317332
/>
318333
)}

src/Common/CodeEditor/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface CodeEditorInterface {
4848
isKubernetes?: boolean
4949
cleanData?: boolean
5050
chartVersion?: any
51+
adjustEditorHeightToContent?: boolean
5152
}
5253

5354
export interface CodeEditorHeaderInterface {

0 commit comments

Comments
 (0)