mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-27 16:17:34 +00:00
don't set empty key into to Appfile
This commit is contained in:
@@ -71,12 +71,31 @@ export default (): React.ReactNode => {
|
||||
if (valid.length > 0) {
|
||||
alert(`invalid:${valid.toString()}`);
|
||||
}
|
||||
|
||||
const servicesDict = {}
|
||||
servicesDict[serviceName] = {
|
||||
type: workloadType,
|
||||
formData,
|
||||
}
|
||||
|
||||
Object.entries(formData).forEach((([key, value]) => {
|
||||
// eslint-disable-next-line default-case
|
||||
switch (typeof value) {
|
||||
case "number":
|
||||
servicesDict[serviceName][key] = value
|
||||
break
|
||||
case "string":
|
||||
if ((value === null) || (value === "")){
|
||||
break
|
||||
}
|
||||
servicesDict[serviceName][key] = value
|
||||
break
|
||||
case "object":
|
||||
if ((Array.isArray(value) && value.length)) {
|
||||
servicesDict[serviceName][key] = value
|
||||
break
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
const appFile = {
|
||||
name: applicationName,
|
||||
services: servicesDict,
|
||||
|
||||
Reference in New Issue
Block a user