mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: routing in admin pages
This commit is contained in:
@@ -22,7 +22,7 @@ export default function TeamInviteStep(): JSX.Element {
|
||||
|
||||
// Redirect user to the getting started page
|
||||
const redirectToHome = async () => {
|
||||
navigate({ to: "/organization/projects" as const });
|
||||
navigate({ to: "/" as const });
|
||||
};
|
||||
|
||||
const inviteUsers = async ({ emails: inviteEmails }: { emails: string }) => {
|
||||
|
||||
@@ -57,7 +57,8 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
|
||||
});
|
||||
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId: organization.id }
|
||||
});
|
||||
|
||||
localStorage.setItem("orgData.id", organization.id);
|
||||
|
||||
@@ -14,6 +14,7 @@ import { Link, useMatchRoute } from "@tanstack/react-router";
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
import { Tab, TabList, Tabs, Tooltip } from "@app/components/v2";
|
||||
import { useOrganization } from "@app/context";
|
||||
|
||||
const generalTabs = [
|
||||
{
|
||||
@@ -60,6 +61,7 @@ const generalTabs = [
|
||||
|
||||
export const AdminNavBar = () => {
|
||||
const matchRoute = useMatchRoute();
|
||||
const { currentOrg } = useOrganization();
|
||||
|
||||
return (
|
||||
<div className="border-b border-mineshaft-600 bg-mineshaft-900">
|
||||
@@ -74,7 +76,7 @@ export const AdminNavBar = () => {
|
||||
<Tabs value="selected">
|
||||
<TabList className="border-b-0">
|
||||
<Tooltip position="bottom" content="Back to organization">
|
||||
<Link to="/organization/projects">
|
||||
<Link to="/organizations/$orgId/projects" params={{ orgId: currentOrg.id }}>
|
||||
<Tab value="back">
|
||||
<FontAwesomeIcon icon={faArrowLeft} />
|
||||
</Tab>
|
||||
|
||||
@@ -47,8 +47,8 @@ export const NewSubOrganizationForm = ({ onClose }: ContentProps) => {
|
||||
onClose();
|
||||
|
||||
navigate({
|
||||
to: "/organization/projects",
|
||||
search: (prev) => ({ ...prev, subOrganization: organization.name })
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId: organization.id }
|
||||
});
|
||||
await router.invalidate({ sync: true }).catch(() => null);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,8 @@ export const Route = createFileRoute("/_authenticate/_inject-org-details/admin/_
|
||||
beforeLoad: ({ context }) => {
|
||||
if (!context.user.superAdmin) {
|
||||
throw redirect({
|
||||
to: "/organization/projects"
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId: context.organizationId }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,8 @@ export const SignupInvitePage = () => {
|
||||
localStorage.setItem("orgData.id", orgId);
|
||||
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId }
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ export const SignUpPage = () => {
|
||||
|
||||
if (!serverDetails?.emailConfigured && step === 4) {
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/"
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -129,7 +129,8 @@ export const UserInfoSSOStep = ({
|
||||
|
||||
localStorage.setItem("orgData.id", orgId);
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId }
|
||||
});
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
|
||||
@@ -101,7 +101,8 @@ export const AllProjectView = ({
|
||||
const handleAccessProject = async (
|
||||
type: ProjectType,
|
||||
projectId: string,
|
||||
environments: ProjectEnv[]
|
||||
environments: ProjectEnv[],
|
||||
orgId: string
|
||||
) => {
|
||||
await orgAdminAccessProject.mutateAsync({
|
||||
projectId
|
||||
@@ -109,6 +110,7 @@ export const AllProjectView = ({
|
||||
await navigate({
|
||||
to: getProjectHomePage(type, environments),
|
||||
params: {
|
||||
orgId,
|
||||
projectId
|
||||
}
|
||||
});
|
||||
@@ -320,7 +322,12 @@ export const AllProjectView = ({
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleAccessProject(workspace.type, workspace.id, workspace.environments);
|
||||
handleAccessProject(
|
||||
workspace.type,
|
||||
workspace.id,
|
||||
workspace.environments,
|
||||
workspace.orgId
|
||||
);
|
||||
}}
|
||||
disabled={
|
||||
orgAdminAccessProject.variables?.projectId === workspace.id &&
|
||||
|
||||
@@ -65,7 +65,8 @@ export const DeleteProjectSection = () => {
|
||||
});
|
||||
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId: currentOrg.id }
|
||||
});
|
||||
handlePopUpClose("deleteWorkspace");
|
||||
} finally {
|
||||
@@ -110,7 +111,8 @@ export const DeleteProjectSection = () => {
|
||||
});
|
||||
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/organizations/$orgId/projects",
|
||||
params: { orgId: currentOrg.id }
|
||||
});
|
||||
} finally {
|
||||
setIsLeaving.off();
|
||||
|
||||
@@ -41,7 +41,7 @@ export const ErrorPage = ({ error }: ErrorComponentProps) => {
|
||||
</a>{" "}
|
||||
if the issue persists.
|
||||
</p>
|
||||
<Link to="/organization/projects">
|
||||
<Link to="/">
|
||||
<Button className="mt-4" size="xs">
|
||||
<FontAwesomeIcon icon={faHome} className="mr-2" />
|
||||
Back To Home
|
||||
|
||||
@@ -49,7 +49,7 @@ export const ProjectAccessError = () => {
|
||||
<>
|
||||
You are not currently a member of this project. Request access to join project.
|
||||
<div className="mt-4 flex w-full justify-center gap-2">
|
||||
<Link to="/organization/projects">
|
||||
<Link to="/">
|
||||
<Button variant="outline_bg">
|
||||
<FontAwesomeIcon icon={faHome} className="mr-2" />
|
||||
Back To Home
|
||||
@@ -89,7 +89,7 @@ export const ProjectAccessError = () => {
|
||||
project={project}
|
||||
onComplete={() => {
|
||||
navigate({
|
||||
to: "/organization/projects"
|
||||
to: "/"
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -16,7 +16,7 @@ export const NotFoundPage = () => {
|
||||
</a>{" "}
|
||||
and we`ll fix it!{" "}
|
||||
</p>
|
||||
<Link to="/organization/projects">
|
||||
<Link to="/">
|
||||
<div className="diration-200 mt-8 cursor-default rounded-md bg-mineshaft-500 px-4 py-2 font-medium hover:bg-primary hover:text-black">
|
||||
Go to Dashboard
|
||||
</div>
|
||||
|
||||
@@ -20,10 +20,7 @@ export const PersonalSettingsPage = () => {
|
||||
</Helmet>
|
||||
<div className="flex w-full justify-center px-6 text-white">
|
||||
<div className="w-full max-w-8xl">
|
||||
<Link
|
||||
to="/organization/projects"
|
||||
className="mb-4 flex items-center gap-x-2 text-sm text-mineshaft-400"
|
||||
>
|
||||
<Link to="/" className="mb-4 flex items-center gap-x-2 text-sm text-mineshaft-400">
|
||||
<FontAwesomeIcon icon={faChevronLeft} />
|
||||
Back to Organization
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user