Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
leafty committed Jan 3, 2025
1 parent 9f06c78 commit 72b351f
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 68 deletions.
5 changes: 1 addition & 4 deletions client/src/dataset/Dataset.present.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,7 @@ export default function DatasetView(props) {
}
>
<Col>
<ErrorAfterCreation
// location={props.location}
dataset={dataset}
/>
<ErrorAfterCreation dataset={dataset} />
{props.insideProject ? null : (
<Helmet>
<title>{pageTitle}</title>
Expand Down
2 changes: 0 additions & 2 deletions client/src/dataset/DatasetFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ 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 {
...location,
pathname: location.pathname.endsWith("/")
? location.pathname + "modify"
: location.pathname + "/modify",
// state: newState,
};
}
13 changes: 0 additions & 13 deletions client/src/features/project/dataset/DatasetModify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -75,7 +74,6 @@ export type PostSubmitProps = {
datasetId: string;
dispatch: AppDispatch;
fetchDatasets: (forceRefetch: boolean, versionUrl: string) => Promise<void>;
// history: DatasetModifyProps["history"];
navigate: NavigateFunction;
projectPathWithNamespace: string;
state?: unknown;
Expand All @@ -85,7 +83,6 @@ async function redirectAfterSubmit({
datasetId,
dispatch,
fetchDatasets,
// history,
navigate,
projectPathWithNamespace,
state,
Expand All @@ -96,10 +93,6 @@ async function redirectAfterSubmit({
navigate(`/projects/${projectPathWithNamespace}/datasets/${datasetId}`, {
state,
});
// history.push({
// pathname: `/projects/${projectPathWithNamespace}/datasets/${datasetId}`,
// state,
// });
}

type DatasetCreateSubmitGroupProps = {
Expand Down Expand Up @@ -388,8 +381,6 @@ export default function DatasetModify(props: DatasetModifyProps) {
defaultBranch,
externalUrl,
fetchDatasets,
// history,
// location,
metadataVersion,
overviewCommitsUrl,
projectPathWithNamespace,
Expand Down Expand Up @@ -498,7 +489,6 @@ export default function DatasetModify(props: DatasetModifyProps) {
await redirectAfterSubmit({
datasetId: dataset?.slug ?? response.data.slug,
fetchDatasets,
// history,
navigate,
projectPathWithNamespace,
state: undefined,
Expand Down Expand Up @@ -536,7 +526,6 @@ export default function DatasetModify(props: DatasetModifyProps) {
await redirectAfterSubmit({
datasetId: response.data.slug,
fetchDatasets,
// history,
navigate,
projectPathWithNamespace,
state: { errorOnCreation: true },
Expand All @@ -554,7 +543,6 @@ export default function DatasetModify(props: DatasetModifyProps) {
await redirectAfterSubmit({
datasetId: dataset?.slug ?? response.data.slug,
fetchDatasets,
// history,
navigate,
projectPathWithNamespace,
state: undefined,
Expand Down Expand Up @@ -613,7 +601,6 @@ export default function DatasetModify(props: DatasetModifyProps) {
edit,
externalUrl,
fetchDatasets,
// history,
navigate,
metadataVersion,
slug,
Expand Down
4 changes: 0 additions & 4 deletions client/src/features/project/dataset/ProjectDatasetImport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}
/>
Expand Down
7 changes: 0 additions & 7 deletions client/src/features/project/dataset/ProjectDatasetNewEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -198,7 +196,6 @@ function ProjectDatasetNew(
props: Omit<ChangeDatasetProps, "submitting" | "setSubmitting"> &
ProjectDatasetNewOnlyProps
) {
// const location = props.location;
const location = useLocation();

const project = useLegacySelector<StateModelProject>(
Expand Down Expand Up @@ -232,8 +229,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}
Expand Down Expand Up @@ -341,8 +336,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}
Expand Down
8 changes: 0 additions & 8 deletions client/src/features/project/dataset/ProjectDatasetShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ type ProjectDatasetShowProps = {
datasetCoordinator: unknown;
datasetId: string;
graphStatus: boolean;
// history: unknown;
// location: unknown;
model: unknown;
projectInsideKg: boolean;
};
Expand All @@ -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;
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
31 changes: 1 addition & 30 deletions client/src/features/project/dataset/ProjectDatasetsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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}
Expand All @@ -147,8 +134,6 @@ function ProjectAddDataset(props: any) {
<ProjectDatasetImport
client={props.client}
fetchDatasets={props.fetchDatasets}
// history={props.history}
// location={props.location}
model={props.model}
notifications={props.notifications}
params={props.params}
Expand Down Expand Up @@ -184,14 +169,9 @@ function EmptyDatasets({ locked, membership, newDatasetUrl }: any) {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function ProjectDatasetsView(props: any) {
const {
datasets,
fetchDatasets,
// location
} = props;
const { datasets, fetchDatasets } = props;
const location = useLocation();
const navigate = useNavigate();
// const history = useHistory();

const [datasetCoordinator, setDatasetCoordinator] =
React.useState<unknown>(null);
Expand Down Expand Up @@ -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 } });
}
}, [
Expand Down Expand Up @@ -462,8 +441,6 @@ function EditDatasetRoute({
params,
versionUrl,
}: EditDatasetRouteProps) {
// const history = useHistory<Partial<LocationState>>();
// const location = history.location;
const location = useLocation();

const { datasetId } = useParams<{ datasetId: string }>();
Expand All @@ -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}
Expand All @@ -512,8 +487,6 @@ function ShowDatasetRoute({
pathWithNamespace,
projectIndexingStatus,
}: ShowDatasetRouteProps) {
// const history = useHistory();
// const location = history.location;
const { datasetId } = useParams<{ datasetId: string }>();

return (
Expand All @@ -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}
/>
Expand Down

0 comments on commit 72b351f

Please sign in to comment.