Skip to content

Commit

Permalink
fix: handle error and fix rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders Schwartz committed Oct 25, 2023
1 parent 0d10726 commit d40cfea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
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.

3 changes: 2 additions & 1 deletion engine/frontend/src/component/log/CreateEnclaveLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export const CreateEnclaveLog = ({packageId, enclave, args, appData}) => {
}

const readStreamData = (result) => {
// console.log(`${result.case} ${JSON.stringify(result.value)}`)
if (result.case === INSTRUCTION) {
setLogs(logs => [...logs, result.value.executableInstruction])
}
Expand Down Expand Up @@ -145,6 +144,8 @@ export const CreateEnclaveLog = ({packageId, enclave, args, appData}) => {
}
} catch (ex) {
console.error("Error occurred while reading data from the enclave: ", enclave.name)
setLogsExecutionStatusText("Script failed to run with an error")
setLogsCurrentExecutionStatus(logsStatus(SCRIPT_RUN_STATUS_ERROR, null))
} finally {
setLoading(false)
}
Expand Down
4 changes: 1 addition & 3 deletions engine/frontend/src/component/log/Log.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ export const Log = ({logs, fileName, currentExecutionStatus, executionStatusText
const virtuosoRef = useRef(null)
const {height: windowHeight} = useWindowDimensions();
const {onCopy, setValue: setCopyValue, hasCopied} = useClipboard("");
const [logsExecutionStatus, setLogsExecutionStatus] = useState(<></>)

useEffect(() => {
setDisplayLogs(logs);
const logsWithoutAnsi = logs.map((log) => {
return stripAnsi(log)
})
setCopyValue(logsWithoutAnsi.join(os.EOL))
setLogsExecutionStatus(currentExecutionStatus)
}, [logs]);

const handleDownload = () => {
Expand Down Expand Up @@ -82,7 +80,7 @@ export const Log = ({logs, fileName, currentExecutionStatus, executionStatusText
<Box p='2' m="4"
height={"40px"}
>
{logsExecutionStatus}
{currentExecutionStatus}
</Box>
<Tooltip label={`${hasCopied ? "Copied!" : "Copy to clipboard"}`}
placement='top-end'
Expand Down

0 comments on commit d40cfea

Please sign in to comment.