From c83dbf288ce3920c360d2ffcb4033492219f3ec8 Mon Sep 17 00:00:00 2001 From: Marina Fedyantceva Date: Mon, 9 Dec 2024 12:31:29 +0300 Subject: [PATCH] [SPT-767] fixed set dataset after improvment --- .../DataPreset/DashboardModal/ButtonGroup.js | 11 +++-------- .../ServiceDetails/DataPreset/DashboardModal/index.js | 4 ++-- .../DataPreset/DatasetUploader/index.js | 9 +++++++-- src/components/ServiceDetails/DataPreset/index.js | 2 -- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/components/ServiceDetails/DataPreset/DashboardModal/ButtonGroup.js b/src/components/ServiceDetails/DataPreset/DashboardModal/ButtonGroup.js index 6325da27..ccd1cdec 100644 --- a/src/components/ServiceDetails/DataPreset/DashboardModal/ButtonGroup.js +++ b/src/components/ServiceDetails/DataPreset/DashboardModal/ButtonGroup.js @@ -3,18 +3,13 @@ import { useStyles } from "./styles"; import StyledButton from "../../../common/StyledButton"; import TableIcon from "@mui/icons-material/TableChartOutlined"; import { useDispatch } from "react-redux"; -import { - addRecentDataset, - improveDataset, - setMainDataset, - setMergeDataset, -} from "../../../../Redux/actionCreators/DatasetActions"; +import { addRecentDataset, improveDataset } from "../../../../Redux/actionCreators/DatasetActions"; import { startAppLoader, stopAppLoader } from "../../../../Redux/actionCreators/LoaderActions"; import { LoaderContent } from "../../../../utility/constants/LoaderContent"; import { DatafactoryInstanceS3 } from "../../../../config/DatasetS3Client"; import { getDatasetSizeFromS3 } from "../../../../Redux/actionCreators/ServiceTrainingActions"; -const ButtonsGroup = ({ classes, selectedParameters, isTableView, toggleTableView, dataset, index }) => { +const ButtonsGroup = ({ classes, selectedParameters, isTableView, toggleTableView, dataset, setDataset }) => { const dispatch = useDispatch(); const tableButtonText = isTableView ? "close tablet" : "view tablet"; @@ -37,7 +32,7 @@ const ButtonsGroup = ({ classes, selectedParameters, isTableView, toggleTableVie tag: dataset.tag, }; await dispatch(addRecentDataset(improvedDataset)); - !index ? await dispatch(setMainDataset(improvedDataset)) : await dispatch(setMergeDataset(improvedDataset)); + setDataset(improvedDataset); } catch (error) { console.error("getImprovedDataset error", error); } finally { diff --git a/src/components/ServiceDetails/DataPreset/DashboardModal/index.js b/src/components/ServiceDetails/DataPreset/DashboardModal/index.js index 118e6ece..f078037d 100644 --- a/src/components/ServiceDetails/DataPreset/DashboardModal/index.js +++ b/src/components/ServiceDetails/DataPreset/DashboardModal/index.js @@ -7,7 +7,7 @@ import TableSamples from "./Table"; import { useState } from "react"; import ButtonGroup from "./ButtonGroup"; -const DashboardModal = ({ classes, onClose, isShow, dataset, index }) => { +const DashboardModal = ({ classes, onClose, isShow, dataset, setDatasetInfo }) => { const [selectedParameters, setSelectedParameters] = useState(); const [isTableView, setIsTableView] = useState(true); @@ -27,7 +27,7 @@ const DashboardModal = ({ classes, onClose, isShow, dataset, index }) => { selectedParameters={selectedParameters} isTableView={isTableView} toggleTableView={toggleTableView} - index={index} + setDataset={setDatasetInfo} /> {isTableView && dataset?.additionalInfo?.dataset_sample && ( diff --git a/src/components/ServiceDetails/DataPreset/DatasetUploader/index.js b/src/components/ServiceDetails/DataPreset/DatasetUploader/index.js index 7939ae64..f1429659 100644 --- a/src/components/ServiceDetails/DataPreset/DatasetUploader/index.js +++ b/src/components/ServiceDetails/DataPreset/DatasetUploader/index.js @@ -16,7 +16,7 @@ import { loaderActions } from "../../../../Redux/actionCreators"; const acceptedFileTypes = { "application/zip": [".zip"], "application/x-zip-compressed": [".zip"] }; -const DatasetUploader = ({ classes, setDatasetInfo, datasetInfo, cleanDatasetInfo, index }) => { +const DatasetUploader = ({ classes, setDatasetInfo, datasetInfo, cleanDatasetInfo, isMainDataset }) => { const dispatch = useDispatch(); const [trainingDataFileName, setTrainingDataFileName] = useState(datasetInfo?.name); @@ -121,7 +121,12 @@ const DatasetUploader = ({ classes, setDatasetInfo, datasetInfo, cleanDatasetInf )} {isDashbordOpen && ( - + )} ); diff --git a/src/components/ServiceDetails/DataPreset/index.js b/src/components/ServiceDetails/DataPreset/index.js index c2c2f8dd..d5bf35fa 100644 --- a/src/components/ServiceDetails/DataPreset/index.js +++ b/src/components/ServiceDetails/DataPreset/index.js @@ -121,7 +121,6 @@ const DataPreset = ({ classes }) => { datasetInfo={mainDataset} setDatasetInfo={setMainDatasetFunction} cleanDatasetInfo={cleanMainDataset} - index={0} /> {mergeDataset && ( @@ -143,7 +142,6 @@ const DataPreset = ({ classes }) => { datasetInfo={mergeDataset} setDatasetInfo={setMergeDatasetFunction} cleanDatasetInfo={cleanMergeDataset} - index={0} /> ) : (