Skip to content

Commit

Permalink
Merge pull request #955 from singnet/data-preset-tab
Browse files Browse the repository at this point in the history
[SPT-767] fixed set dataset after improvement
  • Loading branch information
MarinaFedy authored Dec 9, 2024
2 parents cf5dca7 + c83dbf2 commit ef6ecbc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 && (
<TableSamples tableData={dataset?.additionalInfo?.dataset_sample} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -121,7 +121,12 @@ const DatasetUploader = ({ classes, setDatasetInfo, datasetInfo, cleanDatasetInf
</>
)}
{isDashbordOpen && (
<DashboardModal onClose={closeDashbordModal} isShow={isDashbordOpen} dataset={datasetInfo} index={index} />
<DashboardModal
onClose={closeDashbordModal}
isShow={isDashbordOpen}
dataset={datasetInfo}
setDatasetInfo={setDatasetInfo}
/>
)}
</div>
);
Expand Down
2 changes: 0 additions & 2 deletions src/components/ServiceDetails/DataPreset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ const DataPreset = ({ classes }) => {
datasetInfo={mainDataset}
setDatasetInfo={setMainDatasetFunction}
cleanDatasetInfo={cleanMainDataset}
index={0}
/>
</div>
{mergeDataset && (
Expand All @@ -143,7 +142,6 @@ const DataPreset = ({ classes }) => {
datasetInfo={mergeDataset}
setDatasetInfo={setMergeDatasetFunction}
cleanDatasetInfo={cleanMergeDataset}
index={0}
/>
) : (
<div className={classes.emptyFirstDataset}>
Expand Down

0 comments on commit ef6ecbc

Please sign in to comment.