From 3ec1855d00efa2d9145f3fdb380d0443a5565e9a Mon Sep 17 00:00:00 2001 From: Samir Kamal <1954121+skamril@users.noreply.github.com> Date: Wed, 10 Jan 2024 09:40:11 +0100 Subject: [PATCH] save --- .../dialogs/ScenarioPlaylistDialog/index.tsx | 1 - .../explore/Modelization/Debug/Data/Json.tsx | 33 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx index b90ba5771a..fb522c6633 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx @@ -2,7 +2,6 @@ import { Box, Button, Divider } from "@mui/material"; import { useRef } from "react"; import { useTranslation } from "react-i18next"; import * as R from "ramda"; -import { Pred } from "ramda"; import HotTable from "@handsontable/react"; import Handsontable from "handsontable"; import { StudyMetadata } from "../../../../../../../../common/types"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Debug/Data/Json.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Debug/Data/Json.tsx index f85be9342a..5d151ea945 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Debug/Data/Json.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Debug/Data/Json.tsx @@ -11,7 +11,9 @@ import { } from "../../../../../../../services/api/study"; import { Header, Root } from "./style"; import SimpleLoader from "../../../../../../common/loaders/SimpleLoader"; -import JSONEditor from "../../../../../../common/JSONEditor"; +import JSONEditor, { + JSONEditorProps, +} from "../../../../../../common/JSONEditor"; import usePromiseWithSnackbarError from "../../../../../../../hooks/usePromiseWithSnackbarError"; import UsePromiseCond from "../../../../../../common/utils/UsePromiseCond"; import SimpleContent from "../../../../../../common/page/SimpleContent"; @@ -29,7 +31,7 @@ function JsonView({ path, studyId }: Props) { const [jsonData, setJsonData] = useState(null); const [isSaveAllowed, setSaveAllowed] = useState(false); - const json = usePromiseWithSnackbarError( + const res = usePromiseWithSnackbarError( () => getStudyData(studyId, path, -1), { errorMessage: t("studies.error.retrieveData"), @@ -60,8 +62,15 @@ function JsonView({ path, studyId }: Props) { } }; - const handleJsonChange = (newJson: string) => { - setJsonData(newJson); + const handleJsonChange: JSONEditorProps["onChange"] = ( + content, + previousContent, + status, + ) => { + console.log({ + status, + }); + // setJsonData(newJson); setSaveAllowed(true); }; @@ -83,9 +92,9 @@ function JsonView({ path, studyId }: Props) { } - ifResolved={() => ( + ifResolved={(json) => ( )}