Skip to content

Commit 6f07af4

Browse files
Merge pull request #1291 from devtron-labs/redirect_schema_json
fix: Schema.json redirect wrong path in deployment template
2 parents 9eca242 + f26d65d commit 6f07af4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/CodeEditor/CodeEditor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ interface CodeEditorInterface {
6666
validatorSchema?: any;
6767
isKubernetes?: boolean;
6868
cleanData?: boolean;
69+
chartVersion?: any;
6970
}
7071

7172
interface CodeEditorHeaderInterface {
@@ -115,7 +116,7 @@ interface CodeEditorState {
115116
code: string;
116117
noParsing: boolean;
117118
}
118-
const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.memo(function Editor({ value, mode = "json", noParsing = false, defaultValue = "", children, tabSize = 2, lineDecorationsWidth = 0, height = 450, inline = false, shebang = "", minHeight, maxHeight, onChange, readOnly, diffView, theme="", loading, customLoader, focus, validatorSchema ,isKubernetes = true, cleanData = false, onBlur, onFocus}) {
119+
const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.memo(function Editor({ value, mode = "json", noParsing = false, defaultValue = "", children, tabSize = 2, lineDecorationsWidth = 0, height = 450, inline = false, shebang = "", minHeight, maxHeight, onChange, readOnly, diffView, theme="", loading, customLoader, focus, validatorSchema, chartVersion ,isKubernetes = true, cleanData = false, onBlur, onFocus}) {
119120
if (cleanData) {
120121
value = cleanKubeManifest(value);
121122
defaultValue = cleanKubeManifest(defaultValue);
@@ -220,14 +221,13 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
220221
format: true,
221222
schemas:[
222223
{
223-
uri: 'https://devtron.ai/schema.json', // id of the first schema
224+
uri: `https://github.com/devtron-labs/devtron/tree/main/scripts/devtron-reference-helm-charts/reference-chart_${chartVersion}/schema.json`, // id of the first schema
224225
fileMatch: ['*'], // associate with our model
225226
schema: validatorSchema,
226227
}]
227228
});
228229
// eslint-disable-next-line react-hooks/exhaustive-deps
229-
}, [validatorSchema]);
230-
230+
}, [validatorSchema, chartVersion]);
231231
useEffect(() => {
232232
if (!editorRef.current) return
233233
editorRef.current.updateOptions({ readOnly })

src/components/deploymentConfig/DeploymentTemplateView/DeploymentTemplateEditorView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export default function DeploymentTemplateEditorView({
184184
: state.fetchedValues[state.selectedCompareOption?.id]) || ''
185185
}
186186
value={value}
187+
chartVersion={state.selectedChart?.version.replace(/\./g, '-')}
187188
onChange={editorOnChange}
188189
mode={MODES.YAML}
189190
validatorSchema={state.schema}
@@ -217,6 +218,7 @@ export default function DeploymentTemplateEditorView({
217218
)}
218219
{state.openComparison && (
219220
<CodeEditor.Header className="w-100 p-0-imp" hideDefaultSplitHeader={true}>
221+
220222
<div className="flex column">
221223
<div className="code-editor__header flex left w-100 p-0-imp">
222224
<div className="flex left fs-12 fw-6 cn-9 dc__border-right h-32 pl-12 pr-12">

0 commit comments

Comments
 (0)