1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

fix: output for Studio

This commit is contained in:
Saad Jutt
2021-12-16 12:44:57 +05:00
parent 27129a8921
commit e5be0e6789

View File

@@ -28,7 +28,12 @@ const Studio = () => {
axios axios
.post(`/SASjsApi/stp/run`, { code }) .post(`/SASjsApi/stp/run`, { code })
.then((res: any) => { .then((res: any) => {
setLog(res.data) const data =
typeof res.data === 'string'
? res.data
: `<pre><code>${JSON.stringify(res.data, null, 4)}</code></pre>`
setLog(data)
document?.getElementById('sas_log')?.scrollIntoView() document?.getElementById('sas_log')?.scrollIntoView()
}) })
.catch((err) => console.log(err)) .catch((err) => console.log(err))
@@ -78,7 +83,14 @@ const Studio = () => {
Run Selected SAS Code Run Selected SAS Code
</Button> </Button>
</Stack> </Stack>
{log && <div id="sas_log" dangerouslySetInnerHTML={{ __html: log }} />} {log && (
<>
<br />
<h2 id="sas_log">Output</h2>
<br />
<div dangerouslySetInnerHTML={{ __html: log }} />
</>
)}
</Box> </Box>
) )
} }