diff --git a/fastapi-rest-apis/__pycache__/app.cpython-310.pyc b/fastapi-rest-apis/__pycache__/app.cpython-310.pyc
index 8ab79f9..a9fa204 100644
Binary files a/fastapi-rest-apis/__pycache__/app.cpython-310.pyc and b/fastapi-rest-apis/__pycache__/app.cpython-310.pyc differ
diff --git a/fastapi-rest-apis/actions/__pycache__/index.cpython-310.pyc b/fastapi-rest-apis/actions/__pycache__/index.cpython-310.pyc
index f7cefda..ae0b940 100644
Binary files a/fastapi-rest-apis/actions/__pycache__/index.cpython-310.pyc and b/fastapi-rest-apis/actions/__pycache__/index.cpython-310.pyc differ
diff --git a/fastapi-rest-apis/actions/index.py b/fastapi-rest-apis/actions/index.py
index 7f83da9..9a79a03 100644
--- a/fastapi-rest-apis/actions/index.py
+++ b/fastapi-rest-apis/actions/index.py
@@ -23,6 +23,7 @@ def getAction(name):
try:
result = runSQL(f"select distinct * from action_inputs INNER join actions_content on actions_content.name = action_inputs.action where actions_content.name = '{name}'")
result = result.fetchall()
+ print("RESULT", result)
return result
except:
pass
diff --git a/fastapi-rest-apis/actions/scripts/__pycache__/askChatGPT.cpython-310.pyc b/fastapi-rest-apis/actions/scripts/__pycache__/askChatGPT.cpython-310.pyc
new file mode 100644
index 0000000..d7e3e12
Binary files /dev/null and b/fastapi-rest-apis/actions/scripts/__pycache__/askChatGPT.cpython-310.pyc differ
diff --git a/fastapi-rest-apis/actions/scripts/__pycache__/createWordpressPost.cpython-310.pyc b/fastapi-rest-apis/actions/scripts/__pycache__/createWordpressPost.cpython-310.pyc
new file mode 100644
index 0000000..edfc621
Binary files /dev/null and b/fastapi-rest-apis/actions/scripts/__pycache__/createWordpressPost.cpython-310.pyc differ
diff --git a/fastapi-rest-apis/app.py b/fastapi-rest-apis/app.py
index f5195b0..9bdb997 100644
--- a/fastapi-rest-apis/app.py
+++ b/fastapi-rest-apis/app.py
@@ -124,4 +124,21 @@ async def getAllFlowsAPI():
async def runSQLAPI(request: Request):
request = await request.json()
runSQL(request['query'])
- return 1
\ No newline at end of file
+ return 1
+
+@app.post("/add-connection")
+async def addConnection(request: Request):
+ request = await request.json()
+ name = request['name']
+ token = request['token']
+ runSQL(f"insert into connections (name, token) values ('{name}', '{token}')")
+ return True
+
+@app.get("/connections")
+async def getConnections():
+ result = runSQL("select * from connections")
+ result = result.fetchall()
+ json_res = []
+ for val in result:
+ json_res.append({"platform":val[0], "token": val[1], "username":val[2], "password":val[3]})
+ return json_res
\ No newline at end of file
diff --git a/frontend-app/src/app/app/[appId]/page.tsx b/frontend-app/src/app/app/[appId]/page.tsx
new file mode 100644
index 0000000..eb741d6
--- /dev/null
+++ b/frontend-app/src/app/app/[appId]/page.tsx
@@ -0,0 +1,8 @@
+"use client";
+
+import { useEffect } from "react";
+
+export default function Page({ params }: any) {
+ const appId = params.appId;
+ return "You will be able to see the flow of your application here ";
+}
diff --git a/frontend-app/src/app/connections/page.tsx b/frontend-app/src/app/connections/page.tsx
index 3b0ac70..2161db0 100644
--- a/frontend-app/src/app/connections/page.tsx
+++ b/frontend-app/src/app/connections/page.tsx
@@ -3,6 +3,8 @@
import { useEffect, useState } from "react";
import { SERVER_URL } from "../../env";
import ConnectionsForm from "./token-form";
+import { Sidebar } from "flowbite-react";
+import SidebarWrapper from "../_components/sidebar";
export default function Connections() {
const [connections, setConnections] = useState([]);
@@ -14,20 +16,27 @@ export default function Connections() {
}, []);
return (
<>
-
Connections
-
- {/* connections list */}
- {/* {connections.map((conn: any) => {
- {conn.name};
- })} */}
- {/* Add connection Popup */}
- {showAddConnectionPopup && (
-
- )}
+
+
+
+
+
+
Connections
+
+ {/* connections list */}
+ {connections.map((conn: any) => {
+ return {conn.platform};
+ })}
+ {/* Add connection Popup */}
+ {showAddConnectionPopup && (
+
+ )}
+
+
>
);
}
diff --git a/frontend-app/src/app/connections/token-form.tsx b/frontend-app/src/app/connections/token-form.tsx
index 464d4fc..dec4b24 100644
--- a/frontend-app/src/app/connections/token-form.tsx
+++ b/frontend-app/src/app/connections/token-form.tsx
@@ -1,6 +1,7 @@
"use client";
import { useState } from "react";
+import { SERVER_URL } from "~/env";
export default function ConnectionsForm({ setShowAddConnectionPopup }: any) {
const [platform, setPlatform] = useState("");
@@ -8,8 +9,13 @@ export default function ConnectionsForm({ setShowAddConnectionPopup }: any) {
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
- console.log("Submitted:", { platform, token });
- // Here you would typically send the data to your backend
+ fetch(`${SERVER_URL}/add-connection`, {
+ body: JSON.stringify({
+ name: platform,
+ token: token,
+ }),
+ method: "POST",
+ }).then(() => alert("token added successfully"));
};
return (
diff --git a/frontend-app/src/app/create-run/ConfigForm.tsx b/frontend-app/src/app/create-run/ConfigForm.tsx
index 25694f4..e4c1a56 100644
--- a/frontend-app/src/app/create-run/ConfigForm.tsx
+++ b/frontend-app/src/app/create-run/ConfigForm.tsx
@@ -11,6 +11,14 @@ const ConfigForm: React.FC = () => {
let workflowContext: any = useContext(WorkflowContext);
let [prevNodeOutputs, setPrevNodeOutputs] = useState([]);
let [prevNodeIdx, setPrevNodeIdx] = useState(0);
+ let [showSelectConnection, setShowSelectConnection] = useState(false);
+ let [connections, setConnections] = useState([]);
+ let [selectedConnection, setSelectedConnection] = useState({
+ platform: "",
+ token: "",
+ username: "",
+ password: "",
+ });
let nodes = workflowContext.nodes;
let setNodes = workflowContext.setNodes;
const { selectedNode }: any = useContext(BuilderContext);
@@ -25,15 +33,12 @@ const ConfigForm: React.FC = () => {
// setActionItems(res);
let actions = res.map((item: any) => item.action_name);
let uniqueActions = [...new Set(actions)];
-
setActionItems(uniqueActions);
setFieldValues(res);
});
}, []);
useEffect(() => {
- // fetch("https://automarket.onrender.com/output/");
- console.log("moved here");
if (nodes.length > 3) {
let idx = 0;
for (let node of nodes) {
@@ -61,15 +66,50 @@ const ConfigForm: React.FC = () => {
}
}, [selectedNode]);
+ async function fetchConnectons() {
+ fetch(`${SERVER_URL}/connections`)
+ .then((res) => res.json())
+ .then((res) => {
+ console.log("RECIEVED CONNECTIONS", res);
+ setConnections(res);
+ });
+ }
+
+ function selectConnection(e: any) {
+ debugger;
+ console.log("SELECTED CONNECTION", e.target.value);
+ setSelectedConnection(e.target.value);
+ let connectionByName: any = connections.find(
+ (x: any) => x.platform == e.target.value,
+ );
+ setFieldValues({
+ ...fieldValues,
+ token: connectionByName.token,
+ });
+ }
async function handleSelectionChange(e: any) {
setName(e.target.value);
setFields(null);
setFieldValues(null);
- let inputs = await fetch(
- "https://automarket.onrender.com/action/" + e.target.value,
- );
+ let inputs = await fetch(`${SERVER_URL}/action/` + e.target.value);
inputs.json().then((res) => {
- setFields(res.inputs);
+ console.log("RES INPUTS", res.inputs);
+ let resIncludesToken = false;
+ res.inputs.map((item: any) => {
+ if (item.name == "token") {
+ resIncludesToken = true;
+ }
+ });
+ if (resIncludesToken) {
+ setShowSelectConnection(true);
+ fetchConnectons();
+ let fieldsWithoutToken = res.inputs.filter((item: any) => {
+ return item.name != "token";
+ });
+ setFields(fieldsWithoutToken);
+ } else {
+ setFields(res.inputs);
+ }
setFieldValues({});
});
}
@@ -127,6 +167,20 @@ const ConfigForm: React.FC = () => {
}
/>
)}
+ {showSelectConnection && (
+ <>
+
+
+ >
+ )}
>
))}