Skip to content

Commit 35628f0

Browse files
committed
showing yml syntax
1 parent 7742b58 commit 35628f0

12 files changed

+682
-87
lines changed

client/build/static/js/main.91ed6cb6.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
object-assign
3+
(c) Sindre Sorhus
4+
@license MIT
5+
*/
6+
7+
/** @license React v0.20.2
8+
* scheduler.production.min.js
9+
*
10+
* Copyright (c) Facebook, Inc. and its affiliates.
11+
*
12+
* This source code is licensed under the MIT license found in the
13+
* LICENSE file in the root directory of this source tree.
14+
*/
15+
16+
/** @license React v17.0.2
17+
* react-dom.production.min.js
18+
*
19+
* Copyright (c) Facebook, Inc. and its affiliates.
20+
*
21+
* This source code is licensed under the MIT license found in the
22+
* LICENSE file in the root directory of this source tree.
23+
*/
24+
25+
/** @license React v17.0.2
26+
* react-jsx-runtime.production.min.js
27+
*
28+
* Copyright (c) Facebook, Inc. and its affiliates.
29+
*
30+
* This source code is licensed under the MIT license found in the
31+
* LICENSE file in the root directory of this source tree.
32+
*/
33+
34+
/** @license React v17.0.2
35+
* react.production.min.js
36+
*
37+
* Copyright (c) Facebook, Inc. and its affiliates.
38+
*
39+
* This source code is licensed under the MIT license found in the
40+
* LICENSE file in the root directory of this source tree.
41+
*/

client/build/static/js/main.91ed6cb6.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading

client/src/ClientServer.ts

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
import requestWrapper from './utils/requestWrapper';
2-
const baseUrl = 'http://localhost:8080/api';
1+
import requestWrapper from "./utils/requestWrapper";
2+
const baseUrl = "http://localhost:8080/api";
33

44
export async function getProfile(data: { authId: string }) {
5-
const requestOptions = {
6-
url: `${baseUrl}/profile`,
7-
method: 'POST',
8-
data,
9-
};
10-
return await requestWrapper(requestOptions);
5+
const requestOptions = {
6+
url: `${baseUrl}/profile`,
7+
method: "POST",
8+
data,
9+
};
10+
return await requestWrapper(requestOptions);
1111
}
1212

1313
export async function createProfile(data: {
14-
authId: string;
15-
username: string;
14+
authId: string;
15+
username: string;
1616
}) {
17-
const requestOptions = {
18-
url: `${baseUrl}/create-profile`,
19-
method: 'POST',
20-
data,
21-
};
22-
return await requestWrapper(requestOptions);
17+
const requestOptions = {
18+
url: `${baseUrl}/create-profile`,
19+
method: "POST",
20+
data,
21+
};
22+
return await requestWrapper(requestOptions);
2323
}
2424

2525
export async function generateWorkflow(data: { authId: string }) {
26-
const requestOptions = {
27-
url: `${baseUrl}/workflows/generate`,
28-
method: 'POST',
29-
data,
30-
};
31-
return await requestWrapper(requestOptions);
26+
const requestOptions = {
27+
url: `${baseUrl}/workflows/generate`,
28+
method: "POST",
29+
data,
30+
};
31+
const response = await requestWrapper(requestOptions);
32+
return response.data;
3233
}
+15-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
import { Profile } from '../../utils/constants';
2-
import { useAuth0 } from '@auth0/auth0-react';
3-
import Button from '@mui/material/Button';
4-
import { generateWorkflow } from '../../ClientServer';
1+
import { Profile } from "../../utils/constants";
2+
import { useAuth0 } from "@auth0/auth0-react";
3+
import WorkflowGenerator from "./WorkflowGenerator";
54

65
type Props = {
7-
profile: Profile;
6+
profile: Profile;
87
};
98

109
export default function Dashboard({ profile }: Props) {
11-
const { user } = useAuth0();
10+
const { user } = useAuth0();
11+
const authId = user?.sub;
1212

13-
const handleGenerate = () => {
14-
generateWorkflow({ authId: user?.sub ?? '' }).then(({ data }) => {
15-
console.log(data);
16-
});
17-
};
13+
if (!authId) {
14+
return <h1>Error pulling auth id from Auth0</h1>;
15+
}
1816

19-
return (
20-
<div className="d-flex flex-column ai-center jc-center">
21-
<h2>Hey, {profile.username}!</h2>
22-
<Button variant="contained" onClick={() => handleGenerate()}>
23-
Generate
24-
</Button>
25-
</div>
26-
);
17+
return (
18+
<div className="d-flex flex-column ai-center jc-center">
19+
<h2>Hey, {profile.username}!</h2>
20+
<WorkflowGenerator authId={authId} />
21+
</div>
22+
);
2723
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import Button from "@mui/material/Button";
2+
import { useState } from "react";
3+
import { generateWorkflow } from "../../ClientServer";
4+
import LoadingScreen from "../../Common/LoadingScreen";
5+
import SyntaxHighlighter from "react-syntax-highlighter";
6+
import { a11yDark } from "react-syntax-highlighter/dist/esm/styles/hljs";
7+
8+
type Props = {
9+
authId: string;
10+
};
11+
12+
export default function Dashboard({ authId }: Props) {
13+
const [isLoading, setIsLoading] = useState(false);
14+
const [workflow, setWorkflow] = useState<string | undefined>(undefined);
15+
16+
const handleGenerate = async () => {
17+
setIsLoading(true);
18+
const { data } = await generateWorkflow({ authId });
19+
setWorkflow(data.workflow);
20+
setIsLoading(false);
21+
};
22+
23+
if (isLoading) {
24+
return <LoadingScreen />;
25+
}
26+
27+
return (
28+
<div className="d-flex flex-column ai-center jc-center">
29+
<Button variant="contained" onClick={() => handleGenerate()}>
30+
Generate
31+
</Button>
32+
{workflow && (
33+
<SyntaxHighlighter
34+
customStyle={{ textAlign: "left" }}
35+
language="yaml"
36+
style={a11yDark}
37+
showLineNumbers
38+
>
39+
{workflow}
40+
</SyntaxHighlighter>
41+
)}
42+
</div>
43+
);
44+
}

client/tsconfig.json

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
8-
],
4+
"lib": ["dom", "dom.iterable", "esnext"],
95
"allowJs": true,
106
"skipLibCheck": true,
117
"esModuleInterop": true,
128
"allowSyntheticDefaultImports": true,
139
"strict": true,
1410
"forceConsistentCasingInFileNames": true,
1511
"noFallthroughCasesInSwitch": true,
12+
"noImplicitAny": false,
1613
"module": "esnext",
1714
"moduleResolution": "node",
1815
"resolveJsonModule": true,
1916
"isolatedModules": true,
2017
"noEmit": true,
2118
"jsx": "react-jsx"
2219
},
23-
"include": [
24-
"src"
25-
]
20+
"include": ["src"]
2621
}

client/yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -4899,6 +4899,11 @@
48994899
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
49004900
"version" "1.0.0"
49014901

4902+
"fsevents@^2.3.2", "fsevents@~2.3.2":
4903+
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
4904+
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
4905+
"version" "2.3.2"
4906+
49024907
"function-bind@^1.1.1":
49034908
"integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
49044909
"resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"

0 commit comments

Comments
 (0)