From 8be8666ba008025640d8fd45e0c7178ccd72fc41 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 28 Mar 2023 16:37:59 -0300 Subject: [PATCH] template function for code check --- .../src/components/chatComponent/index.tsx | 2 +- .../controllers/{NodesServices => API}/index.ts | 4 ++++ src/frontend/src/modals/codeAreaModal/index.tsx | 15 +++++++++++++-- .../components/extraSidebarComponent/index.tsx | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) rename src/frontend/src/controllers/{NodesServices => API}/index.ts (83%) diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 037c9cdaf..11f2444f8 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -6,7 +6,7 @@ import { XMarkIcon, } from "@heroicons/react/24/outline"; import { MouseEventHandler, useContext, useEffect, useRef, useState } from "react"; -import { sendAll } from "../../controllers/NodesServices"; +import { sendAll } from "../../controllers/API"; import { alertContext } from "../../contexts/alertContext"; import { classNames, nodeColors } from "../../utils"; import { TabsContext } from "../../contexts/tabsContext"; diff --git a/src/frontend/src/controllers/NodesServices/index.ts b/src/frontend/src/controllers/API/index.ts similarity index 83% rename from src/frontend/src/controllers/NodesServices/index.ts rename to src/frontend/src/controllers/API/index.ts index f0257ea00..c4f0ced50 100644 --- a/src/frontend/src/controllers/NodesServices/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -7,4 +7,8 @@ export async function getAll():Promise> { export async function sendAll(data:sendAllProps) { return await axios.post(`/predict`, data); +} + +export async function checkCode(code:string){ + return [] } \ No newline at end of file diff --git a/src/frontend/src/modals/codeAreaModal/index.tsx b/src/frontend/src/modals/codeAreaModal/index.tsx index 8f091d353..668fddf86 100644 --- a/src/frontend/src/modals/codeAreaModal/index.tsx +++ b/src/frontend/src/modals/codeAreaModal/index.tsx @@ -9,6 +9,7 @@ import "ace-builds/src-noconflict/theme-twilight"; import "ace-builds/src-noconflict/ext-language_tools" import "ace-builds/webpack-resolver" import {darkContext} from "../../contexts/darkContext" +import { checkCode } from "../../controllers/API"; export default function CodeAreaModal({ value, setValue, @@ -104,7 +105,7 @@ export default function CodeAreaModal({ enableLiveAutocompletion theme={dark?"twilight":"github"} name="CodeEditor" - onChange={(value)=>{setCode(value);setValue(value)}} + onChange={(value)=>{setCode(value)}} className="h-full w-full rounded-lg" /> @@ -115,10 +116,20 @@ export default function CodeAreaModal({ type="button" className="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm" onClick={() => { + setValue(code) setModalOpen(false); }} > - Finish editing + Save code + + diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx index e489432de..2e9d2f23d 100644 --- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx @@ -6,7 +6,7 @@ import { nodeNames, } from "../../../../utils"; import { useContext, useEffect, useState } from "react"; -import { getAll } from "../../../../controllers/NodesServices"; +import { getAll } from "../../../../controllers/API"; import { typesContext } from "../../../../contexts/typesContext"; import { APIClassType, APIKindType, APIObjectType } from "../../../../types/api";