From 93a5686fbd4bd9f9a710f1c18e58c510e20cf19d Mon Sep 17 00:00:00 2001 From: knight1001d Date: Tue, 1 Oct 2024 17:15:57 +0530 Subject: [PATCH] new features --- .../__pycache__/app.cpython-310.pyc | Bin 3592 -> 4199 bytes .../actions/__pycache__/index.cpython-310.pyc | Bin 1623 -> 1708 bytes fastapi-rest-apis/actions/index.py | 1 + .../__pycache__/askChatGPT.cpython-310.pyc | Bin 0 -> 894 bytes .../createWordpressPost.cpython-310.pyc | Bin 0 -> 998 bytes fastapi-rest-apis/app.py | 19 ++++- frontend-app/src/app/app/[appId]/page.tsx | 8 +++ frontend-app/src/app/connections/page.tsx | 37 ++++++---- .../src/app/connections/token-form.tsx | 10 ++- .../src/app/create-run/ConfigForm.tsx | 68 ++++++++++++++++-- 10 files changed, 119 insertions(+), 24 deletions(-) create mode 100644 fastapi-rest-apis/actions/scripts/__pycache__/askChatGPT.cpython-310.pyc create mode 100644 fastapi-rest-apis/actions/scripts/__pycache__/createWordpressPost.cpython-310.pyc create mode 100644 frontend-app/src/app/app/[appId]/page.tsx diff --git a/fastapi-rest-apis/__pycache__/app.cpython-310.pyc b/fastapi-rest-apis/__pycache__/app.cpython-310.pyc index 8ab79f93e9a681e17ac7ab1c4c10f17e9fb11d50..a9fa2046e3ade567567ce99ba23f7cab02b7b18b 100644 GIT binary patch delta 1066 zcmYjP%}*0i5Z~Eu+okOmVibZYvJq_A^3n1gJ`@tb;Dv)26Pgfgcw4EqU3|OMq$vV{ z81V% z`|sRg{nKa+zQ67K0BO5rH^F-MfVJ9nIhFOX{%vgwGCjzfYykN|HngoElVUKhSi|pr z!mtW85!XIJO#IMZfGM8%=b%G;^*^3!!5jEFf>wk~&?$SXWzV&Iyq(A}K^ual)xz0j zFYlC=O4*{#FVI1pAR%4_#vv&V0^B&xhVhnI3AV*#7D}-1lQ9|nmWw&K?PB1|-~e=q zFTpaT#8rLqtV#LKBUoxpBR{TFB=EHOtf!z~9O?^3FF8e|6Y@)S<1i?8>Z*wWq-y?r z37>CiN3WNzhU5!QmXWHomW|?=hg|dxgqM{|b%tS>^Sl9SPd;vNn|RKl)PX33N)=#^Q7EaG&aFQfm=XAcVQ0&-;`pf zmBrI*Y87_Xs!GBUeG)Z^{$`ZCqwS&eJ4TfTIyhHpcI^U|*i4!^?iBx5%&Fx3Xbfl2 zJfO1U?CPt9te10mQOc|7Wvmy~1`o2Xd(YtvYe40e&`vr94yzk z-b1UBQXqqi>MKMs61ss-d<-o>98K+f#u0P8ozOuEx?d^pSIU7~%VQ*3gdPD`ty@1;f`p&#G%M*PxT!xiPBk<8*TYe7$6VgKPGZU8U!m?J}FUagGC7`uUp zOj$k=G>r1)+DSE;Jx{?I$yg_iqIYJdVGQ5Q zqxh(hs-Z$jY~-rH3rQ=J`ktT7(V__~gl8dzci}>mCipmk9-ng+E(dH;;I|RMd8->H zaM$u+2(PR(OyY;N+CY2$S@mCQGp^J*Y>FBQ-YPDh#A|y8hS97qLKP3{W9cZ#aRU7u tA0&(jWYm2>D07eMF+z$kL6{^^DlQojJ6-g1mA(8l2q9QQwP9Upf*(<@aPI&B diff --git a/fastapi-rest-apis/actions/__pycache__/index.cpython-310.pyc b/fastapi-rest-apis/actions/__pycache__/index.cpython-310.pyc index f7cefdae6a1a76cfcdf21b222aff46710109c0d7..ae0b94000f60f4ae52dc588d7a47ec36c2ee7d04 100644 GIT binary patch delta 414 zcmZ9IF-yZh6vyw~wJ{03G}>Ahp^HlvQ4#Cn;NWTpQE?LWq69RN%LPPIMDhvBjZ)B2 zaOtNJ@&Vl3-Sl2tLh&B_dGGP=_kVYvjStQf&Rt^8?!nLXaLfzfr5nZfnL3Xz?!r=! zpbuPs!!tB>LcgHYC#<(-n;UY$NI*+VhG}-IWCMG=5>JoW2DCJDpg?jsB}W7%aYls6gPPu~>0{}m8Iu(Gizv9lJCzRRODJ>J zrYxPCQ0-r-D2Y3!Og$qMe6YasQ!*rpz~` sU8LjNr}P{;sRp4A2C5BCR8wEzGB delta 352 zcmZ3(d!2_jpO=@50SJV7yweIc@-{Q_Msa246_l35=OyN*Mopf}=+DSK`7L83Bk$yV zre};%lf#(JRoH+!idcb!CetmpqSWHjoRT7tF-6>Pf@ktZW&=3^AU~NANWcISkO9)| z48)%&JFuEewq==^xss^}BvHf%B!Fyo5St%FAejf`-r`J8EpbdP$;{6a19Cs}00|~W z0Y(l+HZUv_1q$G_u1Ju9VRAm}Gz%f1sv==1z4;a^$;42WVmkRp(MlLOc! bRCqx=khj2=6^Vmb2ou08p2|UMRoh{o(lPEz9 ztX-Hpz{t+ZKjM{%e}SR!oJ49Z`90h3z3;v6J{4h32bu@ z1Vap$C|zls;^m#B1T-mwDojI+Sir(BC~Yx(hz6}c5QX*!*hOy?ub;lkv42>v5VX&} z2itrFG25|d4mq{~?*cFI9FOpbi~^6zS}eLGtPS=U>~Jm!>s*ipvEjEC>#_~jo0Cz* z`rByK9>oH)%}XNicl;h5q7d26^d&}%0HfK~I^xzmxb}(A5%5|BpMt}+KF8;1u(j`6 zR*rcM9NJWg<1wGk`h~K?`@0W@w$UfjMP_O&uV(p?Y!a$@LK7vq6?sC95ysNm?j&X` z%9680)Cr%cl8Rc?MUu-(m3)#YEelPnYV}s3oV~m?Z@Du>{M~xhKp-) zt)(7xwV!wz=4aHV8>{lHkTt+8E8)7o^kz+^3>0xDMGiUI>uf8m&hv?90AYhL?fA6E zR2Lqi6i{;7y~cHz|3LaSVE#SXdzifgE+#wB)Sl7mH7yF7J>zCz8|26vjjsO4v literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..edfc62179a476df486c3527531d0c7ecde93c6d8 GIT binary patch literal 998 zcmY*YON$gS5Khw1d9AuGJ`O&P4md7|h^!*&>Ol`8EFv}yW44psZFiW;0Kpc z2qNf+BnzYoZETjX2ED`+OnC1};tRS(`u=x}AdfTZU^%*oF5f18@CC)}VU3(;$($lG zL{`%SBD|U%kdNNntGy#4{7-c58+ycQrv-IzA%=)CVuaW-{>z|_kSG4g zL`$^m5ZPEx>$q--j_4kGqW8g@w@r8yi4}2792X}JasLy2Mz)AgOgxp8%sZ6KjxT*y z#p++5kUYm8%sX#8TT7hK3F)7FY~u=~F8Em5SaEZ-k%gJ9txwe8C6oo?`s=IfZWCL~Wk-n={uQUXr8Y{4^2X8W|T*>`z z(#{LaJ9I^8_irV>f{93az{hGNhZvd{yUEG_%;EObNJzSi^h>L^v=$LML@pgU5xdk_ z52&&LX{r27^f_GnvA?;IKE>;S^oizXkB=Ym-CdsEm#}Y2m6l2t1JGH@D^m`}T<=Sh z?r`j&$_Gei2B<*FGj|e5A=9}skY-wPBcJ`b*e7`UD{5-nyV497O?IWhB@~RtI9FJk zx`{fA=^39 -

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 && ( + <> + + + + )} ))}