Skip to content

Commit df301a7

Browse files
committed
feat(submission): use stdout/stderr
1 parent 7d0d431 commit df301a7

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

src/components/Dashboard/Dashboard.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ export default function Example() {
2727
result = 'Processing...';
2828
}
2929
if (jobData) {
30-
result = <Result status={jobData.status} output={jobData.output}></Result>;
30+
result = (
31+
<Result
32+
status={jobData.status}
33+
stdout={jobData.stdout}
34+
stderr={jobData.stderr}
35+
></Result>
36+
);
3137
}
3238

3339
return (
@@ -46,7 +52,8 @@ export default function Example() {
4652
</div>
4753
</div>
4854
<button
49-
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
55+
type="button"
56+
className="inline-flex items-center px-4 py-2 border border-transparent text-base leading-6 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded transition ease-in-out duration-150"
5057
onClick={() => {
5158
mutate(editorRef.current.getValue());
5259
}}

src/components/Dashboard/Result.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ import React from 'react';
22

33
interface LayoutProps {
44
status: string;
5-
output?: string;
5+
stdout?: string;
6+
stderr?: string;
67
}
78

8-
const Result: React.FC<LayoutProps> = ({ status, output }) => {
9+
const Result: React.FC<LayoutProps> = ({ status, stdout, stderr }) => {
910
return (
1011
<div>
11-
<h2>{status}</h2>
12-
<pre>{output}</pre>
12+
<b>Status: </b>
13+
{status}
14+
<br />
15+
<b>Stdout: </b>
16+
<pre>{stdout}</pre>
17+
<b>Stderr: </b>
18+
<pre>{stderr}</pre>
1319
</div>
1420
);
1521
};

src/hooks/submissions.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,18 @@ function useProcessInterval({
5252
const { isLoading, data } = useQuery(
5353
['processProgress', token, processId],
5454
async () => {
55-
const res: AxiosResponse<{ status: string; output: string }> =
56-
await axios.get(
57-
`${process.env.REACT_APP_API_ENDPOINT}/submissions/${processId}`,
58-
{
59-
headers: {
60-
Authorization: `Bearer ${token}`,
61-
},
55+
const res: AxiosResponse<{
56+
status: string;
57+
stdout: string;
58+
stderr: string;
59+
}> = await axios.get(
60+
`${process.env.REACT_APP_API_ENDPOINT}/submissions/${processId}`,
61+
{
62+
headers: {
63+
Authorization: `Bearer ${token}`,
6264
},
63-
);
65+
},
66+
);
6467
return res.data;
6568
},
6669
{

0 commit comments

Comments
 (0)