From ec33a14bd96382d945cb04524e4a6ad47aa0c1f1 Mon Sep 17 00:00:00 2001 From: Dylan Decrulle <81740200+ddecrulle@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:09:09 +0100 Subject: [PATCH] wip vizu --- drama-queen/package.json | 4 +- drama-queen/src/bootstrap.tsx | 4 +- drama-queen/src/hooks/useTranslate.ts | 12 ++++ drama-queen/src/ui/auth.tsx | 17 ------ drama-queen/src/ui/components/appVersion.tsx | 30 +++++++++ .../components/orchestrator/Orchestrator.tsx | 3 + .../src/ui/pages/env/DisplayEnvValues.tsx | 3 +- .../src/ui/pages/visualize/Visualize.tsx | 34 ++++++++--- .../src/ui/pages/visualize/VisualizeForm.tsx | 40 ++++++++++++ drama-queen/src/ui/routing/Layout.tsx | 11 ++++ drama-queen/src/ui/routing/routes.tsx | 61 +++++++++++++++---- .../ui/tools/makeSearchParamsObjectSchema.ts | 30 +++++++++ yarn.lock | 16 ++--- 13 files changed, 212 insertions(+), 53 deletions(-) delete mode 100644 drama-queen/src/ui/auth.tsx create mode 100644 drama-queen/src/ui/components/appVersion.tsx create mode 100644 drama-queen/src/ui/components/orchestrator/Orchestrator.tsx create mode 100644 drama-queen/src/ui/pages/visualize/VisualizeForm.tsx create mode 100644 drama-queen/src/ui/routing/Layout.tsx create mode 100644 drama-queen/src/ui/tools/makeSearchParamsObjectSchema.ts diff --git a/drama-queen/package.json b/drama-queen/package.json index b217a425..5646d283 100644 --- a/drama-queen/package.json +++ b/drama-queen/package.json @@ -23,11 +23,11 @@ "jwt-decode": "^3.1.2", "keycloak-js": "^21.1.2", "memoizee": "^0.4.15", - "oidc-spa": "^2.0.3", + "oidc-spa": "^3.0.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.14.1", - "redux-clean-architecture": "^4.1.1", + "redux-clean-architecture": "^4.3.1", "tsafe": "^1.6.4", "tss-react": "^4.9.0", "zod": "^3.21.4" diff --git a/drama-queen/src/bootstrap.tsx b/drama-queen/src/bootstrap.tsx index 3c14c52d..ea3ce74f 100644 --- a/drama-queen/src/bootstrap.tsx +++ b/drama-queen/src/bootstrap.tsx @@ -5,7 +5,7 @@ import CircularProgress from "@mui/material/CircularProgress" import { createCoreProvider } from "core"; import { RouterProvider } from "react-router-dom"; -const { CoreProvider } = createCoreProvider({ +const { CoreProvider, prCore } = createCoreProvider({ "apiUrl": import.meta.env.VITE_QUEEN_API_URL, "publicUrl": import.meta.env.BASE_URL, "oidcParams": { @@ -39,4 +39,4 @@ const mount = ({ -export { mount }; \ No newline at end of file +export { mount, prCore }; \ No newline at end of file diff --git a/drama-queen/src/hooks/useTranslate.ts b/drama-queen/src/hooks/useTranslate.ts index 1aa7063e..b0a70741 100644 --- a/drama-queen/src/hooks/useTranslate.ts +++ b/drama-queen/src/hooks/useTranslate.ts @@ -6,6 +6,18 @@ const texts = { "sync.download.questionnaires": "Questionnaires", "sync.upload": "Envoi des données", vizu: "Page de visualisation de questionnaire", + "vizu.input.survey.label": "Questionnaire", + "vizu.input.survey.helper": + "L'url d'un json de questionnaire au format Lunatic-model", + "vizu.input.data.label": "Données", + "vizu.input.data.helper": "L'url d'un json de données (de réponse)", + "vizu.input.nomenclatures.label": "Dictionnaire de nomenclatures", + "vizu.input.nomenclatures.helper": + "Dictionnaire avec en clé le nom de la nomenclature et en valeur l'url", + "vizu.button.label": "Visualiser", + "vizu.queen.label": "Version de Queen", + "vizu.examples.label": "Ou choisir un exemple :", + "vizu.examples.select.label": "Exemples", } as const; const getTranslation = (s: keyof typeof texts) => texts[s] ?? s; diff --git a/drama-queen/src/ui/auth.tsx b/drama-queen/src/ui/auth.tsx deleted file mode 100644 index 9dc5b640..00000000 --- a/drama-queen/src/ui/auth.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { ReactNode } from "react"; -import { useCore } from "core"; - - -export function RequiresAuthentication(props: - { children: ReactNode }) { - - const { children } = props - const { userAuthentication } = useCore().functions; - - if (!userAuthentication.getIsUserLoggedIn()) { - userAuthentication.login(); - return null; - } - - return <>{children}> -} \ No newline at end of file diff --git a/drama-queen/src/ui/components/appVersion.tsx b/drama-queen/src/ui/components/appVersion.tsx new file mode 100644 index 00000000..30651ad8 --- /dev/null +++ b/drama-queen/src/ui/components/appVersion.tsx @@ -0,0 +1,30 @@ +import Typography from "@mui/material/Typography" +import { tss } from "tss-react/mui" + +export const AppVersion = () => { + const { classes } = useStyles() + return ( +
Les variables d'environnements
{Object.entries(import.meta.env).filter(([k,]) => k.startsWith("VITE")).map(([k, v]) => (