From e4a04c0794aa31b094e39194c73b50d2c9d5c60c Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Wed, 18 Dec 2024 12:28:29 +0100 Subject: [PATCH 1/2] fix: make modals work on the search page (#3443) Fixes #3415. --- client/src/components/navbar/NavBarItems.tsx | 16 +-- .../groupsV2/new/CreateGroupButton.tsx | 4 +- client/src/features/groupsV2/new/GroupNew.tsx | 8 +- .../groupsV2/new/createGroup.constants.ts | 2 +- .../src/features/projectsV2/LazyGroupNew.tsx | 29 ----- .../features/projectsV2/LazyProjectV2New.tsx | 29 ----- .../projectsV2/new/CreateProjectV2Button.tsx | 4 +- .../features/projectsV2/new/ProjectV2New.tsx | 8 +- .../new/createProjectV2.constants.ts | 2 +- client/src/features/rootV2/NavbarV2.tsx | 121 ++++++------------ client/src/features/rootV2/RootV2.tsx | 20 +-- 11 files changed, 70 insertions(+), 173 deletions(-) delete mode 100644 client/src/features/projectsV2/LazyGroupNew.tsx delete mode 100644 client/src/features/projectsV2/LazyProjectV2New.tsx diff --git a/client/src/components/navbar/NavBarItems.tsx b/client/src/components/navbar/NavBarItems.tsx index 4e0bf67678..0323654b50 100644 --- a/client/src/components/navbar/NavBarItems.tsx +++ b/client/src/components/navbar/NavBarItems.tsx @@ -312,7 +312,7 @@ export function RenkuToolbarItemUser({ const userSecretsUrl = isV2 ? ABSOLUTE_ROUTES.v2.secrets : "/secrets"; return ( - + - - - + User Secrets diff --git a/client/src/features/groupsV2/new/CreateGroupButton.tsx b/client/src/features/groupsV2/new/CreateGroupButton.tsx index f1ea007bc1..232819fff3 100644 --- a/client/src/features/groupsV2/new/CreateGroupButton.tsx +++ b/client/src/features/groupsV2/new/CreateGroupButton.tsx @@ -20,7 +20,7 @@ import { useCallback } from "react"; import { Button } from "reactstrap"; import useLocationHash from "../../../utils/customHooks/useLocationHash.hook"; -import { groupCreationHash } from "./createGroup.constants"; +import { GROUP_CREATION_HASH } from "./createGroup.constants"; export interface CreateGroupButtonProps { children?: React.ReactNode; @@ -36,7 +36,7 @@ export default function CreateGroupButton({ }: CreateGroupButtonProps) { const [, setHash] = useLocationHash(); const openModal = useCallback(() => { - setHash(groupCreationHash); + setHash(GROUP_CREATION_HASH); }, [setHash]); return ( diff --git a/client/src/features/groupsV2/new/GroupNew.tsx b/client/src/features/groupsV2/new/GroupNew.tsx index 3ac52541b5..3519bbbc93 100644 --- a/client/src/features/groupsV2/new/GroupNew.tsx +++ b/client/src/features/groupsV2/new/GroupNew.tsx @@ -43,17 +43,17 @@ import DescriptionFormField from "../../projectsV2/fields/DescriptionFormField"; import NameFormField from "../../projectsV2/fields/NameFormField"; import SlugPreviewFormField from "../../projectsV2/fields/SlugPreviewFormField.tsx"; import { useGetUserQuery } from "../../usersV2/api/users.api"; -import { groupCreationHash } from "./createGroup.constants"; +import { GROUP_CREATION_HASH } from "./createGroup.constants"; export default function GroupNew() { const { data: userInfo, isLoading: userLoading } = useGetUserQuery(); const [hash, setHash] = useLocationHash(); - const showGroupCreationModal = hash === groupCreationHash; + const showGroupCreationModal = hash === GROUP_CREATION_HASH; const toggleModal = useCallback(() => { setHash((prev) => { - const isOpen = prev === groupCreationHash; - return isOpen ? "" : groupCreationHash; + const isOpen = prev === GROUP_CREATION_HASH; + return isOpen ? "" : GROUP_CREATION_HASH; }); }, [setHash]); diff --git a/client/src/features/groupsV2/new/createGroup.constants.ts b/client/src/features/groupsV2/new/createGroup.constants.ts index 7e2fdf4349..a9a7803f1b 100644 --- a/client/src/features/groupsV2/new/createGroup.constants.ts +++ b/client/src/features/groupsV2/new/createGroup.constants.ts @@ -16,4 +16,4 @@ * limitations under the License. */ -export const groupCreationHash = "create-group"; +export const GROUP_CREATION_HASH = "create-group"; diff --git a/client/src/features/projectsV2/LazyGroupNew.tsx b/client/src/features/projectsV2/LazyGroupNew.tsx deleted file mode 100644 index 22293456a8..0000000000 --- a/client/src/features/projectsV2/LazyGroupNew.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * Copyright 2024 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ -import { Suspense, lazy } from "react"; -import PageLoader from "../../components/PageLoader"; - -const NamespaceNew = lazy(() => import("../groupsV2/new/GroupNew")); - -export default function LazyGroupNew() { - return ( - }> - - - ); -} diff --git a/client/src/features/projectsV2/LazyProjectV2New.tsx b/client/src/features/projectsV2/LazyProjectV2New.tsx deleted file mode 100644 index 2e41c04bf6..0000000000 --- a/client/src/features/projectsV2/LazyProjectV2New.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * Copyright 2024 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ -import { Suspense, lazy } from "react"; -import PageLoader from "../../components/PageLoader"; - -const ProjectV2New = lazy(() => import("./new/ProjectV2New")); - -export default function LazyProjectV2New() { - return ( - }> - - - ); -} diff --git a/client/src/features/projectsV2/new/CreateProjectV2Button.tsx b/client/src/features/projectsV2/new/CreateProjectV2Button.tsx index bf66a8464f..11c8f87f43 100644 --- a/client/src/features/projectsV2/new/CreateProjectV2Button.tsx +++ b/client/src/features/projectsV2/new/CreateProjectV2Button.tsx @@ -20,7 +20,7 @@ import { useCallback } from "react"; import { Button } from "reactstrap"; import useLocationHash from "../../../utils/customHooks/useLocationHash.hook"; -import { projectCreationHash } from "./createProjectV2.constants"; +import { PROJECT_CREATION_HASH } from "./createProjectV2.constants"; export interface CreateProjectV2ButtonProps { children?: React.ReactNode; @@ -36,7 +36,7 @@ export default function CreateProjectV2Button({ }: CreateProjectV2ButtonProps) { const [, setHash] = useLocationHash(); const openModal = useCallback(() => { - setHash(projectCreationHash); + setHash(PROJECT_CREATION_HASH); }, [setHash]); return ( diff --git a/client/src/features/projectsV2/new/ProjectV2New.tsx b/client/src/features/projectsV2/new/ProjectV2New.tsx index 25b38d0fc5..3b487ebcc6 100644 --- a/client/src/features/projectsV2/new/ProjectV2New.tsx +++ b/client/src/features/projectsV2/new/ProjectV2New.tsx @@ -46,17 +46,17 @@ import ProjectNamespaceFormField from "../fields/ProjectNamespaceFormField"; import SlugPreviewFormField from "../fields/SlugPreviewFormField.tsx"; import ProjectVisibilityFormField from "../fields/ProjectVisibilityFormField"; import { NewProjectForm } from "./projectV2New.types"; -import { projectCreationHash } from "./createProjectV2.constants"; +import { PROJECT_CREATION_HASH } from "./createProjectV2.constants"; export default function ProjectV2New() { const { data: userInfo, isLoading: userLoading } = useGetUserQuery(); const [hash, setHash] = useLocationHash(); - const showProjectCreationModal = hash === projectCreationHash; + const showProjectCreationModal = hash === PROJECT_CREATION_HASH; const toggleModal = useCallback(() => { setHash((prev) => { - const isOpen = prev === projectCreationHash; - return isOpen ? "" : projectCreationHash; + const isOpen = prev === PROJECT_CREATION_HASH; + return isOpen ? "" : PROJECT_CREATION_HASH; }); }, [setHash]); diff --git a/client/src/features/projectsV2/new/createProjectV2.constants.ts b/client/src/features/projectsV2/new/createProjectV2.constants.ts index 753e533d10..8dd0bf81c0 100644 --- a/client/src/features/projectsV2/new/createProjectV2.constants.ts +++ b/client/src/features/projectsV2/new/createProjectV2.constants.ts @@ -16,4 +16,4 @@ * limitations under the License. */ -export const projectCreationHash = "create-project"; +export const PROJECT_CREATION_HASH = "create-project"; diff --git a/client/src/features/rootV2/NavbarV2.tsx b/client/src/features/rootV2/NavbarV2.tsx index bce535e2cf..6c2e56767b 100644 --- a/client/src/features/rootV2/NavbarV2.tsx +++ b/client/src/features/rootV2/NavbarV2.tsx @@ -24,7 +24,6 @@ import { QuestionCircle, Search, } from "react-bootstrap-icons"; -import { useLocation } from "react-router"; import { Link, useMatch } from "react-router-dom-v5-compat"; import { Collapse, @@ -43,9 +42,10 @@ import { RenkuToolbarItemUser } from "../../components/navbar/NavBarItems"; import { ABSOLUTE_ROUTES } from "../../routing/routes.constants"; import { Links } from "../../utils/constants/Docs"; import AppContext from "../../utils/context/appContext"; -import CreateGroupButton from "../groupsV2/new/CreateGroupButton"; +import useLocationHash from "../../utils/customHooks/useLocationHash.hook"; +import { GROUP_CREATION_HASH } from "../groupsV2/new/createGroup.constants"; import StatusBanner from "../platform/components/StatusBanner"; -import CreateProjectV2Button from "../projectsV2/new/CreateProjectV2Button"; +import { PROJECT_CREATION_HASH } from "../projectsV2/new/createProjectV2.constants"; import BackToV1Button from "../projectsV2/shared/BackToV1Button"; import WipBadge from "../projectsV2/shared/WipBadge"; @@ -55,58 +55,25 @@ function NavbarItemPlus() { const [isOpen, setIsOpen] = useState(false); const toggleOpen = useCallback(() => setIsOpen((isOpen) => !isOpen), []); - // ? Temporary workaround for the search page - const location = useLocation(); - const searchPage = location.pathname.startsWith(ABSOLUTE_ROUTES.v2.search); + const [, setHash] = useLocationHash(); + const toggleNewProject = useCallback(() => { + setHash(PROJECT_CREATION_HASH); + }, [setHash]); + const toggleNewGroup = useCallback(() => { + setHash(GROUP_CREATION_HASH); + }, [setHash]); return ( - - - {searchPage ? ( - - Project - - ) : ( - - Project - - )} + + + Project - - - {searchPage ? ( - - Group - - ) : ( - - Group - - )} + + Group @@ -127,42 +94,30 @@ function NavbarItemHelp() { - - - - Help - - + + + Help + - - - - - - - - - + + + ); diff --git a/client/src/features/rootV2/RootV2.tsx b/client/src/features/rootV2/RootV2.tsx index 24196537a0..ce9f6ea1a8 100644 --- a/client/src/features/rootV2/RootV2.tsx +++ b/client/src/features/rootV2/RootV2.tsx @@ -34,21 +34,20 @@ import { import useAppDispatch from "../../utils/customHooks/useAppDispatch.hook"; import useAppSelector from "../../utils/customHooks/useAppSelector.hook"; import { setFlag } from "../../utils/feature-flags/featureFlags.slice"; - import LazyConnectedServicesPage from "../connectedServices/LazyConnectedServicesPage"; import LazyDashboardV2 from "../dashboardV2/LazyDashboardV2"; import LazyHelpV2 from "../dashboardV2/LazyHelpV2"; import LazyGroupContainer from "../groupsV2/LazyGroupContainer"; import LazyGroupV2Overview from "../groupsV2/LazyGroupV2Overview"; import LazyGroupV2Settings from "../groupsV2/LazyGroupV2Settings"; -import { groupCreationHash } from "../groupsV2/new/createGroup.constants"; +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 LazyGroupV2New from "../projectsV2/LazyGroupNew"; -import LazyProjectV2New from "../projectsV2/LazyProjectV2New"; import LazyProjectV2ShowByProjectId from "../projectsV2/LazyProjectV2ShowByProjectId"; -import { projectCreationHash } from "../projectsV2/new/createProjectV2.constants"; +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"; import LazySessionStartPage from "../sessionsV2/LazySessionStartPage"; @@ -82,8 +81,8 @@ export default function RootV2() { return (
- - + +
@@ -164,7 +163,10 @@ function GroupsV2Routes() { path={RELATIVE_ROUTES.v2.groups.new} element={ } @@ -208,7 +210,7 @@ function ProjectsV2Routes() { From 99e05e26674f4b9db779337f80a29d06953dfa2b Mon Sep 17 00:00:00 2001 From: RenkuBot <53332360+RenkuBot@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:45:35 +0100 Subject: [PATCH 2/2] build: release 3.44.1 (#3450) --- client/package-lock.json | 4 ++-- client/package.json | 2 +- helm-chart/renku-ui/Chart.yaml | 2 +- helm-chart/renku-ui/values.yaml | 4 ++-- server/package-lock.json | 4 ++-- server/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 42be7b490d..fa75a6b692 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "renku-ui", - "version": "3.44.0", + "version": "3.44.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "renku-ui", - "version": "3.44.0", + "version": "3.44.1", "dependencies": { "@ckeditor/ckeditor5-react": "^5.1.0", "@fortawesome/fontawesome-svg-core": "^1.2.35", diff --git a/client/package.json b/client/package.json index d01c72a654..c440a3f2e8 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "renku-ui", - "version": "3.44.0", + "version": "3.44.1", "private": true, "scripts": { "start": "vite --port 3000", diff --git a/helm-chart/renku-ui/Chart.yaml b/helm-chart/renku-ui/Chart.yaml index 8c2182a7d8..1287e5835b 100644 --- a/helm-chart/renku-ui/Chart.yaml +++ b/helm-chart/renku-ui/Chart.yaml @@ -3,4 +3,4 @@ appVersion: "1.0" description: A Helm chart for the Renku UI name: renku-ui icon: https://github.com/SwissDataScienceCenter/renku-sphinx-theme/raw/master/renku_sphinx_theme/static/favicon.png -version: 3.44.0 +version: 3.44.1 diff --git a/helm-chart/renku-ui/values.yaml b/helm-chart/renku-ui/values.yaml index b66f8ef255..2431271024 100644 --- a/helm-chart/renku-ui/values.yaml +++ b/helm-chart/renku-ui/values.yaml @@ -2,9 +2,9 @@ ui: client: image: repository: renku/renku-ui - tag: "3.44.0" + tag: "3.44.1" server: image: repository: renku/renku-ui-server - tag: "3.44.0" + tag: "3.44.1" diff --git a/server/package-lock.json b/server/package-lock.json index 7424cd4fb5..bd77fbaaf3 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "renku-ui-server", - "version": "3.44.0", + "version": "3.44.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "renku-ui-server", - "version": "3.44.0", + "version": "3.44.1", "dependencies": { "@sentry/node": "^7.119.2", "cross-fetch": "^3.1.8", diff --git a/server/package.json b/server/package.json index 85d077e6ba..a793ccfb10 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "renku-ui-server", - "version": "3.44.0", + "version": "3.44.1", "description": "Server for renku API", "private": true, "main": "dist/index.js",