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