From 776b6c94e430954b18d75a69e76149a8adfee25e Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 3 Jan 2025 13:46:53 +0100 Subject: [PATCH] cleanup --- client/src/dataset/Dataset.present.jsx | 5 +-- client/src/dataset/DatasetFunctions.js | 2 -- .../project/dataset/DatasetModify.tsx | 13 -------- .../project/dataset/ProjectDatasetImport.tsx | 4 --- .../project/dataset/ProjectDatasetNewEdit.tsx | 6 ---- .../project/dataset/ProjectDatasetShow.tsx | 8 ----- .../project/dataset/ProjectDatasetsView.tsx | 31 +------------------ 7 files changed, 2 insertions(+), 67 deletions(-) diff --git a/client/src/dataset/Dataset.present.jsx b/client/src/dataset/Dataset.present.jsx index 306bcb72e..b42f47a92 100644 --- a/client/src/dataset/Dataset.present.jsx +++ b/client/src/dataset/Dataset.present.jsx @@ -497,10 +497,7 @@ export default function DatasetView(props) { } > - + {props.insideProject ? null : ( {pageTitle} diff --git a/client/src/dataset/DatasetFunctions.js b/client/src/dataset/DatasetFunctions.js index 74b1bc864..122630989 100644 --- a/client/src/dataset/DatasetFunctions.js +++ b/client/src/dataset/DatasetFunctions.js @@ -70,7 +70,6 @@ export { mapDataset, getDatasetAuthors, getUpdatedDatasetImage }; * Prevents issues with the leading slash on the dataset modify link. * * @param {*} location - current location object - * @param {*} newState - any new state to set */ export function cleanModifyLocation(location) { return { @@ -78,6 +77,5 @@ export function cleanModifyLocation(location) { pathname: location.pathname.endsWith("/") ? location.pathname + "modify" : location.pathname + "/modify", - // state: newState, }; } diff --git a/client/src/features/project/dataset/DatasetModify.tsx b/client/src/features/project/dataset/DatasetModify.tsx index 659d3965f..e77fc20a2 100644 --- a/client/src/features/project/dataset/DatasetModify.tsx +++ b/client/src/features/project/dataset/DatasetModify.tsx @@ -20,7 +20,6 @@ import cx from "classnames"; import React from "react"; import type { FieldErrors } from "react-hook-form"; import { SubmitHandler, useForm } from "react-hook-form"; -// import { useHistory } from "react-router-dom"; import { type NavigateFunction, useLocation, @@ -75,7 +74,6 @@ export type PostSubmitProps = { datasetId: string; dispatch: AppDispatch; fetchDatasets: (forceRefetch: boolean, versionUrl: string) => Promise; - // history: DatasetModifyProps["history"]; navigate: NavigateFunction; projectPathWithNamespace: string; state?: unknown; @@ -85,7 +83,6 @@ async function redirectAfterSubmit({ datasetId, dispatch, fetchDatasets, - // history, navigate, projectPathWithNamespace, state, @@ -96,10 +93,6 @@ async function redirectAfterSubmit({ navigate(`/projects/${projectPathWithNamespace}/datasets/${datasetId}`, { state, }); - // history.push({ - // pathname: `/projects/${projectPathWithNamespace}/datasets/${datasetId}`, - // state, - // }); } type DatasetCreateSubmitGroupProps = { @@ -388,8 +381,6 @@ export default function DatasetModify(props: DatasetModifyProps) { defaultBranch, externalUrl, fetchDatasets, - // history, - // location, metadataVersion, overviewCommitsUrl, projectPathWithNamespace, @@ -498,7 +489,6 @@ export default function DatasetModify(props: DatasetModifyProps) { await redirectAfterSubmit({ datasetId: dataset?.slug ?? response.data.slug, fetchDatasets, - // history, navigate, projectPathWithNamespace, state: undefined, @@ -536,7 +526,6 @@ export default function DatasetModify(props: DatasetModifyProps) { await redirectAfterSubmit({ datasetId: response.data.slug, fetchDatasets, - // history, navigate, projectPathWithNamespace, state: { errorOnCreation: true }, @@ -554,7 +543,6 @@ export default function DatasetModify(props: DatasetModifyProps) { await redirectAfterSubmit({ datasetId: dataset?.slug ?? response.data.slug, fetchDatasets, - // history, navigate, projectPathWithNamespace, state: undefined, @@ -613,7 +601,6 @@ export default function DatasetModify(props: DatasetModifyProps) { edit, externalUrl, fetchDatasets, - // history, navigate, metadataVersion, slug, diff --git a/client/src/features/project/dataset/ProjectDatasetImport.tsx b/client/src/features/project/dataset/ProjectDatasetImport.tsx index d96696092..a56bc65af 100644 --- a/client/src/features/project/dataset/ProjectDatasetImport.tsx +++ b/client/src/features/project/dataset/ProjectDatasetImport.tsx @@ -6,8 +6,6 @@ import type { StateModelProject } from "../project.types"; type ProjectDatasetImportProps = { client: DatasetImportProps["client"]; fetchDatasets: DatasetImportProps["fetchDatasets"]; - // history: DatasetImportProps["history"]; - // location: DatasetImportProps["location"]; model: unknown; notifications: unknown; params: unknown; @@ -33,8 +31,6 @@ function ProjectDatasetImport(props: ProjectDatasetImportProps) { client={props.client} externalUrl={externalUrl} fetchDatasets={props.fetchDatasets} - // history={props.history} - // location={props.location} projectPathWithNamespace={projectPathWithNamespace} toggleNewDataset={props.toggleNewDataset} /> diff --git a/client/src/features/project/dataset/ProjectDatasetNewEdit.tsx b/client/src/features/project/dataset/ProjectDatasetNewEdit.tsx index b8de252b5..f5d3b1914 100644 --- a/client/src/features/project/dataset/ProjectDatasetNewEdit.tsx +++ b/client/src/features/project/dataset/ProjectDatasetNewEdit.tsx @@ -178,8 +178,6 @@ function ProjectDatasetNewEdit(props: ProjectDatasetNewEditProps) { externalUrl={projectMetadata.externalUrl} fetchDatasets={props.fetchDatasets} initialized={true} - // history={props.history} - // location={props.location} metadataVersion={props.metadataVersion} notifications={props.notifications} onCancel={onCancel} @@ -232,8 +230,6 @@ function ProjectDatasetNew( apiVersion={props.apiVersion} client={props.client} fetchDatasets={props.fetchDatasets} - // history={props.history} - // location={props.location} metadataVersion={props.metadataVersion} model={props.model} notifications={props.notifications} @@ -341,8 +337,6 @@ function ProjectDatasetEdit(props: ProjectDatasetEditProps) { datasetId={datasetId} fetchDatasets={props.fetchDatasets} files={props.files} - // history={props.history} - // location={props.location} metadataVersion={props.metadataVersion} model={props.model} notifications={props.notifications} diff --git a/client/src/features/project/dataset/ProjectDatasetShow.tsx b/client/src/features/project/dataset/ProjectDatasetShow.tsx index 86d8a9039..aa90d039b 100644 --- a/client/src/features/project/dataset/ProjectDatasetShow.tsx +++ b/client/src/features/project/dataset/ProjectDatasetShow.tsx @@ -50,8 +50,6 @@ type ProjectDatasetShowProps = { datasetCoordinator: unknown; datasetId: string; graphStatus: boolean; - // history: unknown; - // location: unknown; model: unknown; projectInsideKg: boolean; }; @@ -63,10 +61,8 @@ type ProjectDatasetViewProps = { externalUrl: string; fileContentUrl: string; graphStatus: boolean; - // history: unknown; httpProjectUrl: string; lineagesUrl: string; - // location: unknown; lockStatus: unknown; logged: unknown; maintainer: boolean; @@ -181,13 +177,11 @@ function ProjectDatasetView(props: ProjectDatasetViewProps) { fetchError={kgFetchError} fetchedKg={kgDataset != null} fileContentUrl={props.fileContentUrl} - // history={props.history} httpProjectUrl={props.httpProjectUrl} identifier={datasetId} insideProject={true} lineagesUrl={props.lineagesUrl} loadingDatasets={loadingDatasets} - // location={props.location} lockStatus={props.lockStatus} logged={props.logged} maintainer={props.maintainer} @@ -238,10 +232,8 @@ function ProjectDatasetShow(props: ProjectDatasetShowProps) { externalUrl={projectMetadata.externalUrl} fileContentUrl={fileContentUrl} graphStatus={props.graphStatus} - // history={props.history} httpProjectUrl={httpProjectUrl} lineagesUrl={lineagesUrl} - // location={props.location} lockStatus={lockStatus} logged={user.logged} maintainer={maintainer} diff --git a/client/src/features/project/dataset/ProjectDatasetsView.tsx b/client/src/features/project/dataset/ProjectDatasetsView.tsx index 71943e992..bf533342e 100644 --- a/client/src/features/project/dataset/ProjectDatasetsView.tsx +++ b/client/src/features/project/dataset/ProjectDatasetsView.tsx @@ -20,7 +20,6 @@ import { faInfoCircle, faUserClock } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { skipToken } from "@reduxjs/toolkit/query"; import React, { useEffect } from "react"; -// import { Link, Route, Switch, useHistory, useParams } from "react-router-dom"; import { Link, Route, @@ -40,24 +39,14 @@ import { DatasetCoordinator } from "../../../dataset/Dataset.state"; import { SpecialPropVal } from "../../../model/Model"; import useLegacySelector from "../../../utils/customHooks/useLegacySelector.hook"; import { Url } from "../../../utils/helpers/url"; -// import type { DatasetCore } from "../project.types"; import { StateModelProject } from "../project.types"; import { useGetProjectIndexingStatusQuery } from "../projectKg.api"; import { useCoreSupport } from "../useProjectCoreSupport"; import ProjectDatasetImport from "./ProjectDatasetImport"; -// import type { ProjectDatasetEditProps } from "./ProjectDatasetNewEdit"; import { ProjectDatasetEdit, ProjectDatasetNew } from "./ProjectDatasetNewEdit"; import ProjectDatasetShow from "./ProjectDatasetShow"; import ProjectDatasetListView from "./ProjectDatasetsListView"; -// type LocationState = { -// dataset: DatasetCore; -// files: ProjectDatasetEditProps["files"]; -// isFilesFetching: boolean; -// filesFetchError: ProjectDatasetEditProps["filesFetchError"]; -// reload: boolean; -// }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any function ProjectDatasetLockAlert({ lockStatus }: any) { if (lockStatus == null) return null; @@ -134,8 +123,6 @@ function ProjectAddDataset(props: any) { apiVersion={props.apiVersion} client={props.client} fetchDatasets={props.fetchDatasets} - // history={props.history} - // location={props.location} metadataVersion={props.metadataVersion} model={props.model} notifications={props.notifications} @@ -147,8 +134,6 @@ function ProjectAddDataset(props: any) { (null); @@ -243,7 +223,6 @@ function ProjectDatasetsView(props: any) { (location.state && location.state.reload) ) { fetchDatasets(location.state && location.state.reload, versionUrl); - // history.replace({ state: { reload: false } }); navigate(location, { replace: true, state: { reload: false } }); } }, [ @@ -462,8 +441,6 @@ function EditDatasetRoute({ params, versionUrl, }: EditDatasetRouteProps) { - // const history = useHistory>(); - // const location = history.location; const location = useLocation(); const { datasetId } = useParams<{ datasetId: string }>(); @@ -484,9 +461,7 @@ function EditDatasetRoute({ fetchDatasets={fetchDatasets} files={location.state.files ?? { hasPart: [] }} filesFetchError={location.state.filesFetchError} - // history={history} isFilesFetching={location.state.isFilesFetching ?? false} - // location={location} metadataVersion={metadataVersion} model={model} notifications={notifications} @@ -512,8 +487,6 @@ function ShowDatasetRoute({ pathWithNamespace, projectIndexingStatus, }: ShowDatasetRouteProps) { - // const history = useHistory(); - // const location = history.location; const { datasetId } = useParams<{ datasetId: string }>(); return ( @@ -529,8 +502,6 @@ function ShowDatasetRoute({ datasetCoordinator={datasetCoordinator} datasetId={decodeURIComponent(datasetId ?? "")} graphStatus={projectIndexingStatus.data?.activated ?? false} - // history={history} - // location={location} model={model} projectInsideKg={projectIndexingStatus.data?.activated ?? false} />