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: args were positioned incorrectly #1799

Merged
merged 8 commits into from Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
Expand Up @@ -51,15 +51,12 @@ export abstract class KurtosisClient {
this.client = client;
this.cloudUrl = parentUrl;
this.baseApplicationUrl = childUrl;
console.log("cloudUrl", this.cloudUrl);
console.log("baseApplicationUrl", this.baseApplicationUrl);
this.getParentRequestedRoute();
}

getParentRequestedRoute() {
const splits = this.cloudUrl.pathname.split("/enclave-manager");
if (splits[1]) {
console.log("splits ", splits[1]);
return splits[1];
}
return undefined;
Expand Down
1 change: 0 additions & 1 deletion enclave-manager/web/src/components/LocationBroadcaster.tsx
Expand Up @@ -6,7 +6,6 @@ export const LocationBroadcaster = () => {

useEffect(() => {
const message = { message: "em-ui-location-pathname", value: location.pathname };
console.log("Broadcasting message to parent", message);
// eslint-disable-next-line no-restricted-globals
parent.postMessage(message, "*");
}, [location.pathname]);
Expand Down
1 change: 0 additions & 1 deletion enclave-manager/web/src/components/LocationListener.tsx
Expand Up @@ -8,7 +8,6 @@ export const LocationListener = () => {

useEffect(() => {
if (client.getCloudUrl()) {
console.log(client.getParentRequestedRoute());
const route = client.getParentRequestedRoute();
if (route) navigate(route);
}
Expand Down
Expand Up @@ -10,7 +10,7 @@ import {
ModalHeader,
ModalOverlay,
Text,
Tooltip,
Tooltip, useToast,
} from "@chakra-ui/react";
import { EnclaveMode } from "enclave-manager-sdk/build/engine_service_pb";
import { useMemo, useRef, useState } from "react";
Expand Down Expand Up @@ -55,6 +55,7 @@ export const ConfigureEnclaveModal = ({
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string>();
const formRef = useRef<EnclaveConfigurationFormImperativeAttributes>(null);
const toast = useToast();

const initialValues = useMemo(() => {
if (isDefined(existingEnclave) && isDefined(existingEnclave.starlarkRun)) {
Expand Down Expand Up @@ -89,8 +90,10 @@ export const ConfigureEnclaveModal = ({
return isDefined(value)
? Object.entries(value).map(([k, v]) => ({ key: k, value: convertArgValue(innerType2, v) }), {})
: [];
case ArgumentValueType.JSON:
default:
return value;
// By default, a typeless parameter is JSON.
return isDefined(value) ? JSON.stringify(value) : "{}";
}
};

Expand Down Expand Up @@ -129,6 +132,7 @@ export const ConfigureEnclaveModal = ({
try {
parsedForm.args[arg.name] = JSON.stringify(JSON.parse(parsedForm.args[arg.name]), undefined, 4);
} catch (err: any) {
console.error("err", err);
// do nothing, the input was not valid json.
}
}
Expand All @@ -155,6 +159,20 @@ export const ConfigureEnclaveModal = ({
const handleLoadSubmit: SubmitHandler<ConfigureEnclaveForm> = async (formData) => {
setError(undefined);

try {
console.debug("formData", formData);
if (formData.args && formData.args.args) {
formData.args.args = JSON.parse(formData.args.args);
console.debug("successfully parsed args as proper JSON", formData.args.args);
}
} catch (err) {
toast({
title: `An error occurred while preparing data for running package. The package arguments were not proper JSON: ${stringifyError("asdas")}`,
adschwartz marked this conversation as resolved.
Show resolved Hide resolved
colorScheme: "red",
});
return;
}

let apicInfo = existingEnclave?.apiContainerInfo;
let enclaveUUID = existingEnclave?.shortenedUuid;
if (!isDefined(existingEnclave)) {
Expand All @@ -179,7 +197,23 @@ export const ConfigureEnclaveModal = ({
return;
}

const logsIterator = await runStarlarkPackage(apicInfo, kurtosisPackage.name, formData.args);
let submissionData = {};
if (formData.args.args) {
const { args, ...rest } = formData.args;
submissionData = {
...args,
...rest,
};
console.debug("formData has `args` field and is merged with other potential args", submissionData);
} else {
submissionData = {
...formData.args,
};
console.debug("formData does not have Args field", submissionData);
}
console.log("submissionData for runStarlarkPackage", submissionData);

const logsIterator = await runStarlarkPackage(apicInfo, kurtosisPackage.name, submissionData);
navigator(`/enclave/${enclaveUUID}/logs`, { state: { logs: logsIterator } });
onClose();
};
Expand Down
Expand Up @@ -91,8 +91,6 @@ export const EnclaveLogs = ({ enclave }: EnclaveLogsProps) => {
refreshFilesAndArtifacts(enclave),
]);
}

console.log(line.runResponseLine.value);
}
} catch (error: any) {
if (cancelled) {
Expand Down
6 changes: 3 additions & 3 deletions engine/server/webapp/asset-manifest.json
@@ -1,10 +1,10 @@
{
"files": {
"main.js": "./static/js/main.30986036.js",
"main.js": "./static/js/main.34f23502.js",
"index.html": "./index.html",
"main.30986036.js.map": "./static/js/main.30986036.js.map"
"main.34f23502.js.map": "./static/js/main.34f23502.js.map"
},
"entrypoints": [
"static/js/main.30986036.js"
"static/js/main.34f23502.js"
]
}
2 changes: 1 addition & 1 deletion engine/server/webapp/index.html
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.30986036.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.34f23502.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.