Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 0 additions & 31 deletions client/src/features/groupsV2/LazyGroupContainer.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,82 +16,29 @@
* limitations under the License.
*/

import { skipToken } from "@reduxjs/toolkit/query";
import cx from "classnames";
import { useEffect } from "react";
import { generatePath, Outlet, useNavigate, useParams } from "react-router";
import { ReactNode } from "react";
import { generatePath } from "react-router";
import { Col, Row } from "reactstrap";

import { NamespaceContextType } from "~/features/searchV2/hooks/useNamespaceContext.hook";
import ProjectV2New from "~/features/projectsV2/new/ProjectV2New";
import ContainerWrap from "../../../components/container/ContainerWrap";
import { EntityWatermark } from "../../../components/entityWatermark/EntityWatermark";
import { Loader } from "../../../components/Loader";
import PageNav, { PageNavOptions } from "../../../components/PageNav";
import LazyNotFound from "../../../not-found/LazyNotFound";
import { ABSOLUTE_ROUTES } from "../../../routing/routes.constants";
import { GroupResponse } from "../../projectsV2/api/namespace.api";
import {
useGetGroupsByGroupSlugQuery,
useGetNamespacesByNamespaceSlugQuery,
} from "../../projectsV2/api/projectV2.enhanced-api";
import GroupNotFound from "../../projectsV2/notFound/GroupNotFound";
import type { GroupResponse } from "../../projectsV2/api/namespace.api";
import UserAvatar, { AvatarTypeWrap } from "../../usersV2/show/UserAvatar";
import GroupNew from "../new/GroupNew";

export default function GroupPageContainer() {
const { slug } = useParams<{ slug: string }>();

const navigate = useNavigate();

const {
currentData: namespace,
isLoading: isLoadingNamespace,
error: namespaceError,
} = useGetNamespacesByNamespaceSlugQuery(
slug ? { namespaceSlug: slug } : skipToken
);
const {
data: group,
isLoading: isLoadingGroup,
error: groupError,
} = useGetGroupsByGroupSlugQuery(slug ? { groupSlug: slug } : skipToken);

const isLoading = isLoadingNamespace || isLoadingGroup;
const error = namespaceError ?? groupError;

useEffect(() => {
if (slug && namespace?.namespace_kind === "user") {
navigate(
generatePath(ABSOLUTE_ROUTES.v2.users.show.root, { username: slug }),
{
replace: true,
}
);
} else if (
slug &&
namespace?.namespace_kind === "group" &&
namespace.slug !== slug
) {
navigate(
generatePath(ABSOLUTE_ROUTES.v2.groups.show.root, {
slug: namespace.slug,
}),
{ replace: true }
);
}
}, [namespace?.namespace_kind, namespace?.slug, navigate, slug]);

if (!slug) {
return <LazyNotFound />;
}

if (isLoading) {
return <Loader className="align-self-center" />;
}

if (error || !namespace || !group) {
return <GroupNotFound error={error} />;
}
interface GroupPageLayoutProps {
group: GroupResponse;
children?: ReactNode;
}

export default function GroupPageLayout({
group,
children,
}: GroupPageLayoutProps) {
const options: PageNavOptions = {
overviewUrl: generatePath(ABSOLUTE_ROUTES.v2.groups.show.root, {
slug: group.slug,
Expand All @@ -105,28 +52,21 @@ export default function GroupPageContainer() {
};
return (
<ContainerWrap className="py-0">
<ProjectV2New />
<GroupNew />

<EntityWatermark type="group" />
<Row className="py-3">
<Col xs={12}>
<GroupHeader group={group} slug={slug} />
<GroupHeader group={group} slug={group.slug} />
</Col>
<Col xs={12} className="mb-0">
<div className="my-3">
<PageNav options={options} />
</div>
</Col>
<Col xs={12}>
<main>
<Outlet
context={
{
kind: "group",
namespace: group.slug,
group: group,
} satisfies NamespaceContextType
}
/>
</main>
<main>{children}</main>
</Col>
</Row>
</ContainerWrap>
Expand Down
69 changes: 0 additions & 69 deletions client/src/features/rootV2/RootV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import {
useNavigate,
} from "react-router";

import LazyUserContainer from "~/features/usersV2/LazyUserContainer";
import LazyUserV2Search from "~/features/usersV2/LazyUserV2Search";
import ContainerWrap from "../../components/container/ContainerWrap";
import LazyNotFound from "../../not-found/LazyNotFound";
import {
Expand All @@ -40,10 +38,6 @@ 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 LazyGroupContainer from "../groupsV2/LazyGroupContainer";
import LazyGroupV2Overview from "../groupsV2/LazyGroupV2Overview";
import LazyGroupV2Search from "../groupsV2/LazyGroupV2Search";
import LazyGroupV2Settings from "../groupsV2/LazyGroupV2Settings";
import GroupNew from "../groupsV2/new/GroupNew";
import LazyProjectV2ShowByProjectId from "../projectsV2/LazyProjectV2ShowByProjectId";
import ProjectV2New from "../projectsV2/new/ProjectV2New";
Expand All @@ -52,7 +46,6 @@ import LazySecretsV2 from "../secretsV2/LazySecretsV2";
import LazySessionStartPage from "../sessionsV2/LazySessionStartPage";
import LazyShowSessionPage from "../sessionsV2/LazyShowSessionPage";
import LazyUserRedirect from "../usersV2/LazyUserRedirect";
import LazyUserShow from "../usersV2/LazyUserShow";

function BetaV2Redirect() {
const navigate = useNavigate();
Expand Down Expand Up @@ -134,14 +127,6 @@ export default function RootV2() {
path={RELATIVE_ROUTES.v2.user}
element={<LazyUserRedirect />}
/>
<Route
path={RELATIVE_ROUTES.v2.users.root}
element={<UserV2Routes />}
/>
<Route
path={RELATIVE_ROUTES.v2.groups.root}
element={<GroupsV2Routes />}
/>
<Route
path={RELATIVE_ROUTES.v2.projects.root}
element={<ProjectsV2Routes />}
Expand Down Expand Up @@ -184,35 +169,6 @@ export default function RootV2() {
);
}

function GroupsV2Routes() {
return (
<Routes>
<Route index element={<RedirectToSearch entityType="group" />} />
<Route path={RELATIVE_ROUTES.v2.groups.show.root}>
<Route element={<LazyGroupContainer />}>
<Route index element={<LazyGroupV2Overview />} />
<Route
path={RELATIVE_ROUTES.v2.groups.show.search}
element={<LazyGroupV2Search />}
/>
<Route
path={RELATIVE_ROUTES.v2.groups.show.settings}
element={<LazyGroupV2Settings />}
/>
</Route>
</Route>
<Route
path="*"
element={
<ContainerWrap fullSize>
<LazyNotFound />
</ContainerWrap>
}
/>
</Routes>
);
}

function RedirectToSearch({ entityType }: { entityType: string }) {
const navigate = useNavigate();
useEffect(() => {
Expand Down Expand Up @@ -284,28 +240,3 @@ function ProjectSessionsRoutes() {
</Routes>
);
}

function UserV2Routes() {
return (
<Routes>
<Route index element={<RedirectToSearch entityType="user" />} />
<Route path={RELATIVE_ROUTES.v2.users.show.root}>
<Route element={<LazyUserContainer />}>
<Route index element={<LazyUserShow />} />
<Route
path={RELATIVE_ROUTES.v2.users.show.search}
element={<LazyUserV2Search />}
/>
</Route>
</Route>
<Route
path="*"
element={
<ContainerWrap fullSize>
<LazyNotFound />
</ContainerWrap>
}
/>
</Routes>
);
}
31 changes: 0 additions & 31 deletions client/src/features/usersV2/LazyUserContainer.tsx

This file was deleted.

Loading
Loading