Skip to content

Commit

Permalink
refactor: change project url to start with /v2/p
Browse files Browse the repository at this point in the history
  • Loading branch information
ciyer committed Jan 23, 2025
1 parent aaf1815 commit 00f8d5b
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 125 deletions.
11 changes: 9 additions & 2 deletions client/src/features/projectsV2/list/ProjectV2ListDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import PermissionsGuard from "../../permissionsV2/PermissionsGuard";
import { useGetUserQuery } from "../../usersV2/api/users.api";
import { NamespaceKind } from "../api/namespace.api";
import { useGetProjectsQuery } from "../api/projectV2.enhanced-api";
import { PROJECT_CREATION_HASH } from "../new/createProjectV2.constants";
import ProjectShortHandDisplay from "../show/ProjectShortHandDisplay";

const DEFAULT_PER_PAGE = 5;
Expand Down Expand Up @@ -221,7 +222,10 @@ function AddButtonForGroupNamespace({ namespace }: { namespace: string }) {
"ms-auto",
"my-auto"
)}
to="/v2/projects/new"
to={{
pathname: "/v2",
hash: PROJECT_CREATION_HASH,
}}
>
<PlusLg className="bi" id="createPlus" />
</Link>
Expand All @@ -245,7 +249,10 @@ function AddButtonForUserNamespace({ namespace }: { namespace: string }) {
"ms-auto",
"my-auto"
)}
to="/v2/projects/new"
to={{
pathname: "/v2",
hash: PROJECT_CREATION_HASH,
}}
>
<PlusLg className="bi" id="createPlus" />
</Link>
Expand Down
2 changes: 1 addition & 1 deletion client/src/features/projectsV2/new/ProjectV2New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function ProjectV2CreationDetails() {
});
}, [setValue, currentName]);

const url = `renkulab.io/v2/projects/${currentNamespace ?? "<Owner>"}/`;
const url = `renkulab.io/v2/p/${currentNamespace ?? "<Owner>"}/`;

return (
<>
Expand Down
26 changes: 2 additions & 24 deletions client/src/features/rootV2/RootV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,11 @@

import cx from "classnames";
import { useEffect, useState } from "react";
import {
Navigate,
Route,
Routes,
useNavigate,
} from "react-router-dom-v5-compat";
import { Route, Routes, useNavigate } from "react-router-dom-v5-compat";

import ContainerWrap from "../../components/container/ContainerWrap";
import LazyNotFound from "../../not-found/LazyNotFound";
import {
ABSOLUTE_ROUTES,
RELATIVE_ROUTES,
} from "../../routing/routes.constants";
import { RELATIVE_ROUTES } from "../../routing/routes.constants";
import useAppDispatch from "../../utils/customHooks/useAppDispatch.hook";
import useAppSelector from "../../utils/customHooks/useAppSelector.hook";
import { setFlag } from "../../utils/feature-flags/featureFlags.slice";
Expand All @@ -40,13 +32,11 @@ import LazyHelpV2 from "../dashboardV2/LazyHelpV2";
import LazyGroupContainer from "../groupsV2/LazyGroupContainer";
import LazyGroupV2Overview from "../groupsV2/LazyGroupV2Overview";
import LazyGroupV2Settings from "../groupsV2/LazyGroupV2Settings";
import { GROUP_CREATION_HASH } from "../groupsV2/new/createGroup.constants";
import GroupNew from "../groupsV2/new/GroupNew";
import LazyProjectPageV2Show from "../ProjectPageV2/LazyProjectPageV2Show";
import LazyProjectPageOverview from "../ProjectPageV2/ProjectPageContent/LazyProjectPageOverview";
import LazyProjectPageSettings from "../ProjectPageV2/ProjectPageContent/LazyProjectPageSettings";
import LazyProjectV2ShowByProjectId from "../projectsV2/LazyProjectV2ShowByProjectId";
import { PROJECT_CREATION_HASH } from "../projectsV2/new/createProjectV2.constants";
import ProjectV2New from "../projectsV2/new/ProjectV2New";
import LazySearchV2 from "../searchV2/LazySearchV2";
import LazySecretsV2 from "../secretsV2/LazySecretsV2";
Expand Down Expand Up @@ -191,18 +181,6 @@ function HelpV2Routes() {
function ProjectsV2Routes() {
return (
<Routes>
<Route
path={RELATIVE_ROUTES.v2.projects.new}
element={
<Navigate
to={{
pathname: ABSOLUTE_ROUTES.v2.root,
hash: PROJECT_CREATION_HASH,
}}
replace
/>
}
/>
<Route path={RELATIVE_ROUTES.v2.projects.show.root}>
<Route element={<LazyProjectPageV2Show />}>
<Route index element={<LazyProjectPageOverview />} />
Expand Down
2 changes: 1 addition & 1 deletion client/src/landing/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function FooterNavbarInner({ location, params }) {
return (
<Switch key="footerNav">
<Route path={sessionShowUrl} />
<Route path="/v2/projects/:namespace/:slug/sessions/show/:server" />
<Route path="/v2/p/:namespace/:slug/sessions/show/:server" />
<Route>{footer}</Route>
</Switch>
);
Expand Down
15 changes: 7 additions & 8 deletions client/src/routing/routes.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ export const ABSOLUTE_ROUTES = {
},
},
projects: {
new: "/v2/projects/new",
show: {
root: "/v2/projects/:namespace/:slug",
settings: "/v2/projects/:namespace/:slug/settings",
root: "/v2/p/:namespace/:slug",
settings: "/v2/p/:namespace/:slug/settings",
sessions: {
root: "/v2/projects/:namespace/:slug/sessions",
show: "/v2/projects/:namespace/:slug/sessions/show/:session",
start: "/v2/projects/:namespace/:slug/sessions/:launcherId/start",
root: "/v2/p/:namespace/:slug/sessions",
show: "/v2/p/:namespace/:slug/sessions/show/:session",
start: "/v2/p/:namespace/:slug/sessions/:launcherId/start",
},
},
showById: "/v2/projects/:id",
showById: "/v2/p/:id",
},
help: {
root: "/v2/help",
Expand Down Expand Up @@ -74,7 +73,7 @@ export const RELATIVE_ROUTES = {
},
},
projects: {
root: "projects/*",
root: "p/*",
new: "new",
show: {
root: ":namespace/:slug/*",
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/e2e/dashboardV2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("View v2 landing page", () => {
.click();
cy.location("pathname").should(
"contain",
"/v2/projects/user1-uuid/test-2-v2-project/sessions/show/renku-2-86688c93091df68dffdc594bfd022ce3"
"/v2/p/user1-uuid/test-2-v2-project/sessions/show/renku-2-86688c93091df68dffdc594bfd022ce3"
);
});

Expand All @@ -64,7 +64,7 @@ describe("View v2 landing page", () => {
cy.getDataCy("dashboard-project-list").children().first().click();
cy.location("pathname").should(
"contain",
"/v2/projects/user1-uuid/test-0-v2-project"
"/v2/p/user1-uuid/test-0-v2-project"
);
});

Expand Down
Loading

0 comments on commit 00f8d5b

Please sign in to comment.