Skip to content

Commit 62e2a2a

Browse files
committed
fix: update basicViewSchema & dont remove existing keys
1 parent a23f9bf commit 62e2a2a

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

src/Common/RJSF/utils.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,26 @@ export const updateFormDataFromFormState = ({
227227
return
228228
}
229229

230+
const formDataValue = JSONPath({
231+
json: formData,
232+
path: convertJSONPointerToJSONPath(path),
233+
resultType: 'value',
234+
wrap: false,
235+
})
236+
237+
if (formDataValue === undefined) {
238+
updatedFormData = recursivelyRemoveElement(updatedFormData, path)
239+
} else {
240+
updatedFormData = joinObjects([buildObjectFromPath(path, formDataValue), updatedFormData])
241+
}
242+
230243
const value = JSONPath({
231244
json: formState,
232245
path: convertJSONPointerToJSONPath(path),
233246
resultType: 'value',
234247
wrap: false,
235248
})
236249

237-
updatedFormData = recursivelyRemoveElement(updatedFormData, path)
238-
239250
if (value === undefined) {
240251
return
241252
}

src/Pages/GlobalConfigurations/DeploymentCharts/basicViewSchema.json

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,36 @@
1515
},
1616
"title": "Container Port"
1717
},
18-
"resources": {
18+
"Limits": {
1919
"type": "object",
20-
"title": "Resources (CPU & RAM)",
21-
"description": "Minimum and maximum RAM and CPU available to the application",
20+
"description": "Maximum RAM and CPU available to the application",
21+
"required": ["CPU", "Memory"],
2222
"properties": {
23-
"limits": {
24-
"type": "object",
25-
"description": "Maximum RAM and CPU available to the application",
26-
"required": ["cpu", "memory"],
27-
"properties": {
28-
"cpu": {
29-
"type": "string",
30-
"description": "Maximum allowed CPU limit"
31-
},
32-
"memory": {
33-
"type": "string",
34-
"description": "Maximum allowed memory limit"
35-
}
36-
}
23+
"CPU": {
24+
"type": "string",
25+
"description": "Maximum allowed CPU limit",
26+
"updatePath": "/resources/limits/cpu"
3727
},
38-
"requests": {
39-
"type": "object",
40-
"description": "Minimum RAM and CPU available to the application",
41-
"properties": {
42-
"cpu": {
43-
"type": "string",
44-
"description": "Minimum CPU value"
45-
},
46-
"memory": {
47-
"type": "string",
48-
"description": "Minimum memory value"
49-
}
50-
}
28+
"Memory": {
29+
"type": "string",
30+
"description": "Maximum allowed memory limit",
31+
"updatePath": "/resources/limits/memory"
32+
}
33+
}
34+
},
35+
"Requests": {
36+
"type": "object",
37+
"description": "Minimum RAM and CPU available to the application",
38+
"properties": {
39+
"CPU": {
40+
"type": "string",
41+
"description": "Minimum CPU value",
42+
"updatePath": "/resources/requests/cpu"
43+
},
44+
"Memory": {
45+
"type": "string",
46+
"description": "Minimum memory value",
47+
"updatePath": "/resources/requests/memory"
5148
}
5249
}
5350
},

0 commit comments

Comments
 (0)