Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle missing arg types #1373

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 38 additions & 26 deletions engine/frontend/src/component/PackageCatalogForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,32 +165,36 @@ const renderArgs = (args, handleChange, formData, errorData) => {
return args.map((arg, index) => {

// no need to process plan arg as it's internal!
if (arg["name"] === "plan") {
if (getArgName(arg)) {
return
}

let dataType = "";
switch (arg["typeV2"]["topLevelType"]) {
case "INTEGER":
dataType = "INTEGER"
break;
case "STRING":
dataType = "STRING"
break
case "BOOL":
dataType = "BOOL"
break
case "FLOAT":
dataType = "FLOAT"
break
case "DICT":
dataType = "DICT"
break
case "LIST":
dataType = "LIST"
break
default:
dataType = "JSON"
let dataType = "STRING";
try {
switch (getType(arg)) {
case "INTEGER":
dataType = "INTEGER"
break;
case "STRING":
dataType = "STRING"
break
case "BOOL":
dataType = "BOOL"
break
case "FLOAT":
dataType = "FLOAT"
break
case "DICT":
dataType = "DICT"
break
case "LIST":
dataType = "LIST"
break
default:
dataType = "JSON"
}
} catch (e) {
console.log("no data type provided, falling back to string")
}

return (
Expand Down Expand Up @@ -465,7 +469,11 @@ const PackageCatalogForm = ({createEnclave}) => {

Object.keys(formData).filter(key => {
const arg = kurtosisPackage.args[key]
const type = getType(arg)
let type = ""
try {
type = getType(arg)
} catch {
}
const required = isRequired(arg)

// if it's optional and empty it's fine
Expand Down Expand Up @@ -527,7 +535,11 @@ const PackageCatalogForm = ({createEnclave}) => {
Object.keys(formData).map(key => {
const arg = kurtosisPackage.args[key]
const argName = getArgName(arg)
const type = getType(arg)
let type = ""
try {
adschwartz marked this conversation as resolved.
Show resolved Hide resolved
type = getType(arg)
} catch {
}
const value = formData[key]

let val;
Expand Down Expand Up @@ -561,7 +573,7 @@ const PackageCatalogForm = ({createEnclave}) => {
}

handleCreateEnclave(runKurtosisPackageArgs, enclaveName, productionMode)

} else {
const newErrorData = {
...errorData,
Expand Down