diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index d126f5fa9..96cf5817a 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -15,11 +15,12 @@ import { FETCH_ERROR_MESSAGE, } from "./constants/constants"; import { AuthContext } from "./contexts/authContext"; -import { getHealth } from "./controllers/API"; +import { getGlobalVariables, getHealth } from "./controllers/API"; import Router from "./routes"; import useAlertStore from "./stores/alertStore"; import { useDarkStore } from "./stores/darkStore"; import useFlowsManagerStore from "./stores/flowsManagerStore"; +import { useGlobalVariablesStore } from "./stores/globalVariables"; import { useTypesStore } from "./stores/typesStore"; export default function App() { @@ -124,6 +125,9 @@ export default function App() { const getTypes = useTypesStore((state) => state.getTypes); const refreshVersion = useDarkStore((state) => state.refreshVersion); const refreshStars = useDarkStore((state) => state.refreshStars); + const setGlobalVariables = useGlobalVariablesStore( + (state) => state.setGlobalVariables + ); useEffect(() => { refreshStars(); @@ -135,6 +139,9 @@ export default function App() { getTypes().then(() => { refreshFlows(); }); + getGlobalVariables().then((res) => { + setGlobalVariables(res); + }); } }, [isAuthenticated]); diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 88bf23222..970500efe 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -851,7 +851,7 @@ export async function requestLogout() { } } -export async function getGlobalVariables() { +export async function getGlobalVariables(): Promise<{ [key: string]: string }> { // mocked for now but will eventually be a real API call const globalVariables = window.sessionStorage.getItem("globalVariables"); return globalVariables ? JSON.parse(globalVariables) : {}; diff --git a/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx b/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx new file mode 100644 index 000000000..59e86fe3e --- /dev/null +++ b/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx @@ -0,0 +1,38 @@ +import { Button } from "../../../components/ui/button"; +import { Input } from "../../../components/ui/input"; +import { Label } from "../../../components/ui/label"; +import { Textarea } from "../../../components/ui/textarea"; +import BaseModal from "../../../modals/baseModal"; + +//TODO IMPLEMENT FORM LOGIC + +export default function AddNewVariableButton(): JSX.Element { + function handleSaveVariable() {} + return ( + + + Create a new Variable + + + + + +
+
+ + +
+
+ +