fix: type-check issues

This commit is contained in:
Piyush Gupta
2025-11-19 20:42:44 +05:30
parent 13450ff150
commit c5940340aa
56 changed files with 259 additions and 109 deletions

View File

@@ -157,7 +157,7 @@ const NewProjectForm = ({ onOpenChange }: NewProjectFormProps) => {
onOpenChange(false);
navigate({
to: getProjectHomePage(project.type, project.environments),
params: { projectId: project.id }
params: { projectId: project.id, orgId: currentOrg.id }
});
};
const onSubmit = handleSubmit((data) => {

View File

@@ -97,7 +97,8 @@ export const ProjectSelect = () => {
<Link
to={getProjectHomePage(currentWorkspace.type, currentWorkspace.environments)}
params={{
projectId: currentWorkspace.id
projectId: currentWorkspace.id,
orgId: currentWorkspace.orgId
}}
className="group flex cursor-pointer items-center gap-x-1.5 overflow-hidden hover:text-white"
>
@@ -154,7 +155,8 @@ export const ProjectSelect = () => {
const url = linkOptions({
to: getProjectHomePage(workspace.type, workspace.environments),
params: {
projectId: workspace.id
projectId: workspace.id,
orgId: workspace.orgId
},
search: {
subOrganization: currentOrg?.subOrganization?.name

View File

@@ -20,7 +20,7 @@ import {
Tr
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import { useProject } from "@app/context";
import { useOrganization, useProject } from "@app/context";
import {
PkiSync,
useAddCertificatesToPkiSync,
@@ -49,6 +49,7 @@ export const CertificateManagePkiSyncsModal = ({ popUp, handlePopUpToggle }: Pro
const [currentPage, setCurrentPage] = useState(1);
const [searchTerm, setSearchTerm] = useState("");
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const navigate = useNavigate();
const { certificateId, commonName } = popUp.data || {};
@@ -92,6 +93,7 @@ export const CertificateManagePkiSyncsModal = ({ popUp, handlePopUpToggle }: Pro
navigate({
to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
params: {
orgId: currentOrg.id,
projectId: currentProject.id
},
search: {

View File

@@ -5,7 +5,7 @@ import { useNavigate, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSub, useOrganization, useProject } from "@app/context";
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
import { ProjectType } from "@app/hooks/api/projects/types";
import { IntegrationsListPageTabs } from "@app/types/integrations";
@@ -14,6 +14,7 @@ import { PkiSyncsTab } from "./components";
export const IntegrationsListPage = () => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const { t } = useTranslation();
@@ -30,7 +31,8 @@ export const IntegrationsListPage = () => {
selectedTab: tab as IntegrationsListPageTabs
},
params: {
projectId: currentProject?.id
projectId: currentProject?.id,
orgId: currentOrg.id
}
});
};

View File

@@ -39,7 +39,7 @@ import {
} from "@app/components/v2";
import { Badge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
import { useToggle } from "@app/hooks";
@@ -82,6 +82,7 @@ export const PkiSyncRow = ({
const { syncOption } = usePkiSyncOption(destination);
const { currentOrg } = useOrganization();
const [isIdCopied, setIsIdCopied] = useToggle(false);
const handleCopyId = useCallback(() => {
@@ -127,7 +128,8 @@ export const PkiSyncRow = ({
to: ROUTE_PATHS.CertManager.PkiSyncDetailsByIDPage.path,
params: {
syncId: id,
projectId
projectId,
orgId: currentOrg.id
}
});
}}

View File

@@ -8,7 +8,7 @@ import { CreatePkiSyncModal } from "@app/components/pki-syncs";
import { Button, Spinner } from "@app/components/v2";
import { DocumentationLinkBadge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSub, useOrganization, useProject } from "@app/context";
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";
@@ -26,18 +26,19 @@ export const PkiSyncsTab = () => {
const navigate = useNavigate();
const { currentProject } = useProject();
const { currentOrg } = useOrganization();
const memoizedSearch = useMemo(() => search, [search]);
const navigateToBase = useCallback(() => {
navigate({
to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
params: {
projectId: currentProject?.id
projectId: currentProject?.id,
orgId: currentOrg.id
},
search: memoizedSearch
});
}, [navigate, currentProject?.id, memoizedSearch]);
}, [navigate, currentProject?.id, currentOrg.id, memoizedSearch]);
useEffect(() => {
if (!addSync) return;
@@ -59,7 +60,7 @@ export const PkiSyncsTab = () => {
handlePopUpOpen("addSync", { destination: parsedData.destination, initialData });
navigate({
to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
params: { projectId: currentProject?.id },
params: { projectId: currentProject?.id, orgId: currentOrg.id },
search: { selectedTab: IntegrationsListPageTabs.PkiSyncs },
replace: true
});
@@ -79,7 +80,8 @@ export const PkiSyncsTab = () => {
connectionId,
connectionName,
navigate,
currentProject?.id
currentProject?.id,
currentOrg.id
]);
const { data: pkiSyncs = [], isPending: isPkiSyncsPending } = useListPkiSyncs(

View File

@@ -26,7 +26,7 @@ import {
const PageContent = () => {
const navigate = useNavigate();
const { syncId, projectId } = useParams({
const { syncId, projectId, orgId } = useParams({
from: ROUTE_PATHS.CertManager.PkiSyncDetailsByIDPage.id
});
@@ -77,7 +77,8 @@ const PageContent = () => {
navigate({
to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
params: {
projectId
projectId,
orgId
},
search: {
selectedTab: IntegrationsListPageTabs.PkiSyncs

View File

@@ -36,7 +36,7 @@ import {
} from "@app/components/v2";
import { Badge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
import { usePopUp, useToggle } from "@app/hooks";
@@ -69,6 +69,7 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
const updatePkiSyncMutation = useUpdatePkiSync();
const { syncOption } = usePkiSyncOption(destination);
const { currentOrg } = useOrganization();
const destinationName = PKI_SYNC_MAP[destination].name;
@@ -287,7 +288,8 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
navigate({
to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
params: {
projectId
projectId,
orgId: currentOrg.id
},
search: {
selectedTab: IntegrationsListPageTabs.PkiSyncs

View File

@@ -2,7 +2,7 @@ import { faFingerprint } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link } from "@tanstack/react-router";
import { useProject, useSubscription } from "@app/context";
import { useOrganization, useProject, useSubscription } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TPkiSync } from "@app/hooks/api/pkiSyncs";
import { LogsSection } from "@app/pages/organization/AuditLogsPage/components/LogsSection";
@@ -20,7 +20,7 @@ type Props = {
export const PkiSyncAuditLogsSection = ({ pkiSync }: Props) => {
const { subscription } = useSubscription();
const { currentProject } = useProject();
const { currentOrg } = useOrganization();
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
return (
@@ -53,7 +53,12 @@ export const PkiSyncAuditLogsSection = ({ pkiSync }: Props) => {
<p>
Please{" "}
{subscription && subscription.slug !== null ? (
<Link to="/organization/billing" target="_blank" rel="noopener noreferrer">
<Link
to="/organizations/$orgId/billing"
params={{ orgId: currentOrg.id }}
target="_blank"
rel="noopener noreferrer"
>
<span className="cursor-pointer underline transition-all hover:text-white">
upgrade your subscription
</span>

View File

@@ -235,8 +235,9 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
<Tr
onClick={() =>
navigate({
to: "/organization/groups/$groupId",
to: "/organizations/$orgId/groups/$groupId",
params: {
orgId,
groupId: id
}
})
@@ -334,8 +335,9 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
icon={<FontAwesomeIcon icon={faUserGroup} />}
onClick={() =>
navigate({
to: "/organization/groups/$groupId",
to: "/organizations/$orgId/groups/$groupId",
params: {
orgId,
groupId: id
}
})

View File

@@ -301,9 +301,10 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
key={`identity-${id}`}
onClick={() =>
navigate({
to: "/organization/identities/$identityId",
to: "/organizations/$orgId/identities/$identityId",
params: {
identityId: id
identityId: id,
orgId
}
})
}
@@ -397,9 +398,10 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
onClick={(e) => {
e.stopPropagation();
navigate({
to: "/organization/identities/$identityId",
to: "/organizations/$orgId/identities/$identityId",
params: {
identityId: id
identityId: id,
orgId
}
});
}}

View File

@@ -61,9 +61,10 @@ export const MachineAuthTemplateUsagesModal = ({
key={`usage-${usage.identityId}`}
onClick={() =>
navigate({
to: "/organization/identities/$identityId",
to: "/organizations/$orgId/identities/$identityId",
params: {
identityId: usage.identityId
identityId: usage.identityId,
orgId: organizationId
}
})
}

View File

@@ -64,9 +64,10 @@ export const OrgIdentityLinkForm = ({ onClose }: Props) => {
type: "success"
});
navigate({
to: "/organization/identities/$identityId",
to: "/organizations/$orgId/identities/$identityId",
params: {
identityId: identity.id
identityId: identity.id,
orgId: currentOrg.id
}
});
};

View File

@@ -155,9 +155,10 @@ export const OrgIdentityModal = ({ popUp, handlePopUpToggle }: Props) => {
handlePopUpToggle("identity", false);
navigate({
to: "/organization/identities/$identityId",
to: "/organizations/$orgId/identities/$identityId",
params: {
identityId: createdId
identityId: createdId,
orgId
}
});
}

View File

@@ -481,9 +481,10 @@ export const OrgMembersTable = ({
className="h-10 w-full cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
onClick={() =>
navigate({
to: "/organization/members/$membershipId" as const,
to: "/organizations/$orgId/members/$membershipId" as const,
params: {
membershipId: orgMembershipId
membershipId: orgMembershipId,
orgId
}
})
}
@@ -619,9 +620,10 @@ export const OrgMembersTable = ({
onClick={(e) => {
e.stopPropagation();
navigate({
to: "/organization/members/$membershipId" as const,
to: "/organizations/$orgId/members/$membershipId" as const,
params: {
membershipId: orgMembershipId
membershipId: orgMembershipId,
orgId
}
});
}}

View File

@@ -280,9 +280,10 @@ export const OrgRoleTable = () => {
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
onClick={() =>
navigate({
to: "/organization/roles/$roleId",
to: "/organizations/$orgId/roles/$roleId",
params: {
roleId: id
roleId: id,
orgId
}
})
}
@@ -339,9 +340,10 @@ export const OrgRoleTable = () => {
onClick={(e) => {
e.stopPropagation();
navigate({
to: "/organization/roles/$roleId",
to: "/organizations/$orgId/roles/$roleId",
params: {
roleId: id
roleId: id,
orgId
}
});
}}

View File

@@ -44,7 +44,7 @@ const Page = () => {
const { data, isPending } = useGetGroupById(groupId);
const { isSubOrganization } = useOrganization();
const { isSubOrganization, currentOrg } = useOrganization();
const { mutateAsync: deleteMutateAsync } = useDeleteGroup();
@@ -62,7 +62,8 @@ const Page = () => {
type: "success"
});
navigate({
to: "/organization/access-management" as const,
to: "/organizations/$orgId/access-management" as const,
params: { orgId: currentOrg.id },
search: {
selectedTab: TabSections.Groups
}
@@ -78,7 +79,8 @@ const Page = () => {
{data && (
<div className="mx-auto w-full max-w-8xl">
<Link
to="/organization/access-management"
to="/organizations/$orgId/access-management"
params={{ orgId: currentOrg.id }}
search={{
selectedTab: TabSections.Groups
}}

View File

@@ -6,11 +6,14 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/groups/$groupId"
)({
component: GroupDetailsByIDPage,
context: () => ({
context: ({ params }) => ({
breadcrumbs: [
{
label: "Access Control",
link: linkOptions({ to: "/organization/access-management" })
link: linkOptions({
to: "/organizations/$orgId/access-management" as const,
params
})
},
{
label: "groups"

View File

@@ -61,7 +61,8 @@ const Page = () => {
handlePopUpClose("deleteIdentity");
navigate({
to: "/organization/access-management",
to: "/organizations/$orgId/access-management" as const,
params: { orgId },
search: {
selectedTab: OrgAccessControlTabSections.Identities
}
@@ -73,7 +74,8 @@ const Page = () => {
{data && (
<div className="mx-auto w-full max-w-8xl">
<Link
to="/organization/access-management"
to="/organizations/$orgId/access-management"
params={{ orgId }}
search={{
selectedTab: OrgAccessControlTabSections.Identities
}}

View File

@@ -6,11 +6,11 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/identities/$identityId"
)({
component: IdentityDetailsByIDPage,
context: () => ({
context: ({ params }) => ({
breadcrumbs: [
{
label: "Access Control",
link: linkOptions({ to: "/organization/access-management" })
link: linkOptions({ to: "/organizations/$orgId/access-management" as const, params })
},
{
label: "Identities"

View File

@@ -56,7 +56,8 @@ export const Page = () => {
handlePopUpClose("deleteOrgRole");
navigate({
to: "/organization/access-management" as const,
to: "/organizations/$orgId/access-management" as const,
params: { orgId },
search: {
selectedTab: OrgAccessControlTabSections.Roles
}
@@ -70,7 +71,8 @@ export const Page = () => {
{data && (
<div className="mx-auto w-full max-w-8xl">
<Link
to="/organization/access-management"
to="/organizations/$orgId/access-management"
params={{ orgId }}
search={{
selectedTab: OrgAccessControlTabSections.Roles
}}

View File

@@ -59,8 +59,9 @@ const Content = ({ role, onClose }: ContentProps) => {
});
navigate({
to: "/organization/roles/$roleId",
to: "/organizations/$orgId/roles/$roleId" as const,
params: {
orgId: role.orgId,
roleId: newRole.id
}
});

View File

@@ -97,8 +97,9 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
handlePopUpToggle("role", false);
navigate({
to: "/organization/roles/$roleId",
to: "/organizations/$orgId/roles/$roleId" as const,
params: {
orgId,
roleId: newRole.id
}
});

View File

@@ -17,7 +17,7 @@ enum SecretSharingPageTabs {
export const ShareSecretSection = () => {
const navigate = useNavigate();
const { isSubOrganization } = useOrganization();
const { isSubOrganization, currentOrg } = useOrganization();
const { selectedTab } = useSearch({
from: ROUTE_PATHS.Organization.SecretSharing.id
@@ -26,6 +26,7 @@ export const ShareSecretSection = () => {
const updateSelectedTab = (tab: string) => {
navigate({
to: ROUTE_PATHS.Organization.SecretSharing.path,
params: { orgId: currentOrg.id },
search: (prev) => ({ ...prev, selectedTab: tab as SecretSharingPageTabs })
});
};

View File

@@ -57,7 +57,8 @@ export const OAuthCallbackPage = () => {
});
navigate({
to: ROUTE_PATHS.Organization.SettingsPage.path
to: ROUTE_PATHS.Organization.SettingsPage.path,
params: { orgId: currentOrg.id }
});
}, []);

View File

@@ -17,6 +17,7 @@ import {
THead,
Tr
} from "@app/components/v2";
import { useOrganization } from "@app/context";
import { useListAppConnections } from "@app/hooks/api/appConnections/queries";
import {
useDeleteVaultExternalMigrationConfig,
@@ -33,6 +34,8 @@ export const VaultConnectionSection = () => {
const [configToDelete, setConfigToDelete] = useState<TVaultExternalMigrationConfig | null>(null);
const { data: configs = [], isPending: isLoadingConfigs } = useGetVaultExternalMigrationConfigs();
const { currentOrg } = useOrganization();
const { data: appConnections = [] } = useListAppConnections();
const { mutateAsync: deleteConfig } = useDeleteVaultExternalMigrationConfig();
@@ -157,7 +160,8 @@ export const VaultConnectionSection = () => {
Configure namespace-specific connections to enable in-platform migration features. Manage
connections in the{" "}
<Link
to="/organization/app-connections"
to="/organizations/$orgId/app-connections"
params={{ orgId: currentOrg.id }}
className="text-primary underline hover:text-primary-300"
>
App Connections

View File

@@ -44,7 +44,11 @@ export const SubOrgNameChangeSection = (): JSX.Element => {
subOrgId: currentOrg.id
});
navigate({ to: "/organization/settings", search: { subOrganization: name } });
navigate({
to: "/organizations/$orgId/settings",
params: { orgId: currentOrg.id },
search: { subOrganization: name }
});
queryClient.invalidateQueries();
await router.invalidate({ sync: true });
createNotification({

View File

@@ -263,7 +263,8 @@ export const LDAPGroupMapModal = ({ popUp, handlePopUpOpen, handlePopUpToggle }:
size="sm"
onClick={() =>
navigate({
to: "/organization/access-management"
to: "/organizations/$orgId/access-management",
params: { orgId: currentOrg.id }
})
}
>

View File

@@ -91,7 +91,8 @@ const Page = withPermission(
handlePopUpClose("removeMember");
navigate({
to: "/organization/access-management" as const,
to: "/organizations/$orgId/access-management" as const,
params: { orgId },
search: {
selectedTab: OrgAccessControlTabSections.Member
}
@@ -103,7 +104,8 @@ const Page = withPermission(
{membership && (
<div className="mx-auto w-full max-w-8xl">
<Link
to="/organization/access-management"
to="/organizations/$orgId/access-management"
params={{ orgId }}
search={{
selectedTab: OrgAccessControlTabSections.Member
}}

View File

@@ -6,11 +6,11 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/members/$membershipId"
)({
component: UserDetailsByIDPage,
context: () => ({
context: ({ params }) => ({
breadcrumbs: [
{
label: "Access Control",
link: linkOptions({ to: "/organization/access-management" })
link: linkOptions({ to: "/organizations/$orgId/access-management" as const, params })
},
{
label: "Users"

View File

@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { useProject } from "@app/context";
import { useOrganization, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { ProjectType } from "@app/hooks/api/projects/types";
import { ProjectAccessControlTabs } from "@app/types/project";
@@ -18,6 +18,7 @@ import {
const Page = () => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const selectedTab = useSearch({
strict: false,
@@ -29,6 +30,7 @@ const Page = () => {
to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
search: (prev) => ({ ...prev, selectedTab: tab }),
params: {
orgId: currentOrg.id,
projectId: currentProject.id
}
});

View File

@@ -140,7 +140,7 @@ const Content = ({ popUp, handlePopUpToggle }: Props) => {
<div className="text-sm">
All groups in your organization have already been added to this project.
</div>
<Link to={"/organization/access-management" as const}>
<Link to={"/organizations/$orgId/access-management" as const} params={{ orgId }}>
<Button variant="outline_bg">Create a new group</Button>
</Link>
</div>

View File

@@ -32,7 +32,12 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject
} from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import {
getUserTablePreference,
@@ -61,6 +66,7 @@ enum GroupsOrderBy {
}
export const GroupTable = ({ handlePopUpOpen }: Props) => {
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const navigate = useNavigate();
@@ -161,6 +167,7 @@ export const GroupTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/groups/$groupId` as const,
params: {
orgId: currentOrg.id,
projectId: currentProject.id,
groupId: id
}
@@ -171,6 +178,7 @@ export const GroupTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/groups/$groupId` as const,
params: {
orgId: currentOrg.id,
projectId: currentProject.id,
groupId: id
}

View File

@@ -277,6 +277,7 @@ export const IdentityTab = withProjectPermission(
navigate({
to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
params: {
orgId: currentOrg.id,
projectId: currentProject.id,
identityId: id
}
@@ -287,6 +288,7 @@ export const IdentityTab = withProjectPermission(
navigate({
to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
params: {
orgId: currentOrg.id,
projectId: currentProject.id,
identityId: id
}

View File

@@ -1,7 +1,7 @@
import { Link } from "@tanstack/react-router";
import { Alert, AlertDescription } from "@app/components/v2";
import { useProject } from "@app/context";
import { useOrganization, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { TWorkspaceUser } from "@app/hooks/api/types";
@@ -12,6 +12,7 @@ type Props = {
onOpenUpgradeModal: (title: string) => void;
};
export const MemberRoleForm = ({ projectMember, onOpenUpgradeModal }: Props) => {
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
return (
<div>
@@ -24,6 +25,7 @@ export const MemberRoleForm = ({ projectMember, onOpenUpgradeModal }: Props) =>
<Link
to={`${getProjectBaseURL(currentProject.type)}/members/$membershipId` as const}
params={{
orgId: currentOrg.id,
projectId: currentProject.id,
membershipId: projectMember.id
}}

View File

@@ -7,7 +7,12 @@ import { formatRelative } from "date-fns";
import { ProjectPermissionCan } from "@app/components/permissions";
import { EmptyState, PageHeader, Spinner } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject
} from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { useGetWorkspaceGroupMembershipDetails } from "@app/hooks/api/projects/queries";
import { ProjectAccessControlTabs } from "@app/types/project";
@@ -21,6 +26,7 @@ const Page = () => {
select: (el) => el.groupId as string
});
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const { data: groupMembership, isPending } = useGetWorkspaceGroupMembershipDetails(
@@ -42,7 +48,8 @@ const Page = () => {
<Link
to={`${getProjectBaseURL(currentProject.type)}/access-management`}
params={{
projectId: currentProject.id
projectId: currentProject.id,
orgId: currentOrg.id
}}
search={{
selectedTab: ProjectAccessControlTabs.Groups

View File

@@ -114,7 +114,8 @@ const Page = () => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
params: {
projectId
projectId,
orgId: currentOrg.id
},
search: {
selectedTab: "identities"
@@ -137,7 +138,8 @@ const Page = () => {
<Link
to={`${getProjectBaseURL(currentProject.type)}/access-management`}
params={{
projectId
projectId,
orgId: currentOrg.id
}}
search={{
selectedTab: ProjectAccessControlTabs.Identities
@@ -223,9 +225,10 @@ const Page = () => {
{(isAllowed) =>
isAllowed ? (
<Link
to="/organization/identities/$identityId"
to="/organizations/$orgId/identities/$identityId"
params={{
identityId
identityId,
orgId: currentOrg.id
}}
>
<span className="cursor-pointer text-info underline underline-offset-2">

View File

@@ -95,7 +95,8 @@ export const Page = () => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
params: {
projectId: currentProject.id
projectId: currentProject.id,
orgId: currentOrg.id
}
});
handlePopUpClose("removeMember");
@@ -116,7 +117,8 @@ export const Page = () => {
<Link
to={`${getProjectBaseURL(currentProject.type)}/access-management`}
params={{
projectId: currentProject.id
projectId: currentProject.id,
orgId: currentOrg.id
}}
search={{
selectedTab: ProjectAccessControlTabs.Member

View File

@@ -22,7 +22,12 @@ import {
DropdownMenuTrigger,
PageHeader
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject
} from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { useDeleteProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -40,7 +45,9 @@ const Page = () => {
select: (el) => el.roleSlug as string
});
const { currentProject } = useProject();
const { currentOrg } = useOrganization();
const projectId = currentProject?.id || "";
const orgId = currentOrg?.id || "";
const { data } = useGetProjectRoleBySlug(projectId, roleSlug as string);
@@ -68,7 +75,8 @@ const Page = () => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
params: {
projectId
projectId,
orgId
},
search: {
selectedTab: ProjectAccessControlTabs.Roles
@@ -87,7 +95,8 @@ const Page = () => {
<Link
to={`${getProjectBaseURL(currentProject.type)}/access-management`}
params={{
projectId
projectId,
orgId
}}
search={{
selectedTab: ProjectAccessControlTabs.Roles

View File

@@ -5,7 +5,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent, Spinner } from "@app/components/v2";
import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSub, useOrganization, useProject } from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { getProjectBaseURL } from "@app/helpers/project";
import { useCreateProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
@@ -45,6 +45,7 @@ const Content = ({ role, onClose }: ContentProps) => {
resolver: zodResolver(schema)
});
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const createRole = useCreateProjectRole();
@@ -83,6 +84,7 @@ const Content = ({ role, onClose }: ContentProps) => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug` as const,
params: {
orgId: currentOrg.id,
roleSlug: newRole.slug,
projectId: currentProject.id
}

View File

@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
import { useProject } from "@app/context";
import { useOrganization, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import {
useCreateProjectRole,
@@ -38,6 +38,9 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
roleSlug: string;
};
const { currentOrg } = useOrganization();
const orgId = currentOrg?.id || "";
const { currentProject } = useProject();
const projectId = currentProject?.id || "";
@@ -93,6 +96,7 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug` as const,
params: {
orgId,
roleSlug: slug,
projectId
}
@@ -111,6 +115,7 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
navigate({
to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug` as const,
params: {
orgId,
roleSlug: newRole.slug,
projectId
}

View File

@@ -45,7 +45,7 @@ export const CommitDetailsPage = () => {
folderId,
environment: envSlug
},
search: (query: Record<string, string>) => ({
search: (query) => ({
...query,
secretPath
})
@@ -62,7 +62,7 @@ export const CommitDetailsPage = () => {
environment: envSlug,
commitId: selectedCommitId
},
search: (query: Record<string, string>) => ({
search: (query) => ({
...query,
secretPath
})

View File

@@ -46,7 +46,7 @@ export const CommitsPage = () => {
environment: envSlug,
commitId
},
search: (query: Record<string, string>) => ({
search: (query) => ({
...query,
secretPath
})

View File

@@ -1,7 +1,7 @@
import { Link } from "@tanstack/react-router";
import { EmptyState } from "@app/components/v2";
import { useProject, useSubscription } from "@app/context";
import { useOrganization, useProject, useSubscription } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TIntegrationWithEnv } from "@app/hooks/api/integrations/types";
import { LogsSection } from "@app/pages/organization/AuditLogsPage/components/LogsSection";
@@ -15,6 +15,7 @@ type Props = {
export const IntegrationAuditLogsSection = ({ integration }: Props) => {
const { subscription } = useSubscription();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
@@ -53,7 +54,12 @@ export const IntegrationAuditLogsSection = ({ integration }: Props) => {
<p>
Please{" "}
{subscription && subscription.slug !== null ? (
<Link to="/organization/billing" target="_blank" rel="noopener noreferrer">
<Link
to="/organizations/$orgId/billing"
params={{ orgId: currentOrg.id }}
target="_blank"
rel="noopener noreferrer"
>
<a
className="cursor-pointer font-medium text-primary-500 transition-all hover:text-primary-600"
target="_blank"

View File

@@ -5,7 +5,12 @@ import { useNavigate, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject
} from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
import { ProjectType } from "@app/hooks/api/projects/types";
import { IntegrationsListPageTabs } from "@app/types/integrations";
@@ -19,6 +24,7 @@ import {
export const IntegrationsListPage = () => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const { t } = useTranslation();
@@ -33,7 +39,8 @@ export const IntegrationsListPage = () => {
selectedTab: tab as IntegrationsListPageTabs
},
params: {
projectId: currentProject.id
projectId: currentProject.id,
orgId: currentOrg.id
}
});
};

View File

@@ -24,6 +24,7 @@ import { ROUTE_PATHS } from "@app/const/routes";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject,
useProjectPermission
} from "@app/context";
@@ -60,6 +61,7 @@ export const CloudIntegrationSection = ({
"deleteConfirmation"
] as const);
const { permission } = useProjectPermission();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const navigate = useNavigate();
@@ -138,6 +140,7 @@ export const CloudIntegrationSection = ({
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
orgId: currentOrg.id,
projectId: currentProject.id
},
search: {

View File

@@ -40,7 +40,7 @@ import {
} from "@app/components/v2";
import { Badge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import { useToggle } from "@app/hooks";
@@ -81,6 +81,7 @@ export const SecretSyncRow = ({
projectId
} = secretSync;
const { currentOrg } = useOrganization();
const { syncOption } = useSecretSyncOption(destination);
const destinationName = SECRET_SYNC_MAP[destination].name;
@@ -134,7 +135,8 @@ export const SecretSyncRow = ({
params: {
syncId: id,
destination,
projectId
projectId,
orgId: currentOrg.id
}
})
}

View File

@@ -9,7 +9,7 @@ import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { Button, Spinner } from "@app/components/v2";
import { DocumentationLinkBadge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSub, useOrganization, useProject } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import { useListSecretSyncs } from "@app/hooks/api/secretSyncs";
@@ -26,6 +26,7 @@ export const SecretSyncsTab = () => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
useEffect(() => {
@@ -35,7 +36,8 @@ export const SecretSyncsTab = () => {
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
projectId: currentProject.id
projectId: currentProject.id,
orgId: currentOrg.id
},
search
});
@@ -66,6 +68,7 @@ export const SecretSyncsTab = () => {
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
orgId: currentOrg.id,
projectId: currentProject.id
},
search

View File

@@ -24,6 +24,7 @@ import { ROUTE_PATHS } from "@app/const/routes";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject,
useSubscription
} from "@app/context";
@@ -45,6 +46,7 @@ type Props = {
const TABS_TO_SHOW = 5;
export const EnvironmentTabs = ({ secretPath }: Props) => {
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const currentEnv = useParams({
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id,
@@ -96,7 +98,8 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
to: ROUTE_PATHS.SecretManager.SecretDashboardPage.path,
params: {
envSlug,
projectId: currentProject.id
projectId: currentProject.id,
orgId: currentOrg.id
},
search: (prev) => prev
});

View File

@@ -46,6 +46,7 @@ import { InfisicalSecretInput } from "@app/components/v2/InfisicalSecretInput";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
useProject,
useProjectPermission,
useSubscription
@@ -98,6 +99,7 @@ export const SecretDetailSidebar = ({
secretPath,
handleSecretShare
}: Props) => {
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const [isFieldFocused, setIsFieldFocused] = useToggle();
const queryClient = useQueryClient();
@@ -776,6 +778,7 @@ export const SecretDetailSidebar = ({
`${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const
}
params={{
orgId: currentOrg.id,
projectId: currentProject.id,
identityId: identity.id
}}
@@ -806,8 +809,9 @@ export const SecretDetailSidebar = ({
className="z-100"
>
<Link
to={"/organization/groups/$groupId" as const}
to={"/organizations/$orgId/groups/$groupId" as const}
params={{
orgId: currentOrg.id,
groupId: group.id
}}
className="text-secondary/80 rounded-md border border-mineshaft-600 bg-mineshaft-700 px-1 py-0.5 text-sm hover:text-mineshaft-100"

View File

@@ -26,7 +26,7 @@ import {
const PageContent = () => {
const navigate = useNavigate();
const { destination, syncId, projectId } = useParams({
const { destination, syncId, projectId, orgId } = useParams({
from: ROUTE_PATHS.SecretManager.SecretSyncDetailsByIDPage.id,
select: (params) => ({
...params,
@@ -82,6 +82,7 @@ const PageContent = () => {
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
orgId,
projectId
},
search: {

View File

@@ -36,7 +36,7 @@ import {
} from "@app/components/v2";
import { Badge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import { usePopUp, useToggle } from "@app/hooks";
@@ -65,6 +65,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
const updateSync = useUpdateSecretSync();
const { destination, environment, folder } = secretSync;
const { currentOrg } = useOrganization();
const destinationName = SECRET_SYNC_MAP[destination].name;
const { syncOption } = useSecretSyncOption(destination);
@@ -291,6 +292,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
orgId: currentOrg.id,
projectId: secretSync.projectId
},
search: {

View File

@@ -2,7 +2,7 @@ import { faFingerprint } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link } from "@tanstack/react-router";
import { useProject, useSubscription } from "@app/context";
import { useOrganization, useProject, useSubscription } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TSecretSync } from "@app/hooks/api/secretSyncs";
import { LogsSection } from "@app/pages/organization/AuditLogsPage/components/LogsSection";
@@ -19,6 +19,7 @@ type Props = {
export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
const { subscription } = useSubscription();
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
@@ -53,7 +54,12 @@ export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
<p>
Please{" "}
{subscription && subscription.slug !== null ? (
<Link to="/organization/billing" target="_blank" rel="noopener noreferrer">
<Link
to="/organizations/$orgId/billing"
params={{ orgId: currentOrg.id }}
target="_blank"
rel="noopener noreferrer"
>
<a
className="cursor-pointer underline transition-all hover:text-white"
target="_blank"

View File

@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
import { useProject } from "@app/context";
import { useOrganization, useProject } from "@app/context";
import { useCreateAppConnection, useUpdateAppConnection } from "@app/hooks/api/appConnections";
import { GitLabConnectionMethod } from "@app/hooks/api/appConnections/types/gitlab-connection";
@@ -14,6 +14,7 @@ export const GitLabOAuthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.GitlabOauthCallbackPage.id
});
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
useEffect(() => {
@@ -25,7 +26,8 @@ export const GitLabOAuthCallbackPage = () => {
if (csrfToken !== storedState) {
console.error("CSRF token mismatch");
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: { error: "invalid_state" }
});
return;
@@ -37,7 +39,8 @@ export const GitLabOAuthCallbackPage = () => {
if (!storedFormData) {
console.error("No stored form data found");
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: { error: "missing_form_data" }
});
return;
@@ -73,7 +76,8 @@ export const GitLabOAuthCallbackPage = () => {
// Navigate to success page or app connections list
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: {
success: formData.isUpdate ? "connection_updated" : "connection_created",
connectionId: appConnection.id
@@ -82,12 +86,21 @@ export const GitLabOAuthCallbackPage = () => {
} catch (err) {
console.error("Error handling GitLab OAuth callback:", err);
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: { error: "connection_failed" }
});
}
})();
}, [code, state, navigate, createAppConnection, updateAppConnection, currentProject.id]);
}, [
code,
state,
navigate,
createAppConnection,
updateAppConnection,
currentProject.id,
currentOrg.id
]);
return (
<div className="flex h-screen items-center justify-center">

View File

@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
import { useProject } from "@app/context";
import { useOrganization, useProject } from "@app/context";
import { useCreateAppConnection, useUpdateAppConnection } from "@app/hooks/api/appConnections";
import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";
@@ -14,7 +14,7 @@ export const HerokuOAuthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.HerokuOauthCallbackPage.id
});
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
useEffect(() => {
@@ -25,7 +25,8 @@ export const HerokuOAuthCallbackPage = () => {
if (state !== storedState) {
console.error("CSRF token mismatch");
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: { error: "invalid_state" }
});
return;
@@ -39,7 +40,8 @@ export const HerokuOAuthCallbackPage = () => {
if (!storedFormData) {
console.error("No stored form data found");
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: { error: "missing_form_data" }
});
return;
@@ -74,7 +76,8 @@ export const HerokuOAuthCallbackPage = () => {
// Navigate to success page or app connections list
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: {
success: formData.isUpdate ? "connection_updated" : "connection_created",
connectionId: appConnection.id
@@ -83,7 +86,8 @@ export const HerokuOAuthCallbackPage = () => {
} catch (err) {
console.error("Error handling Heroku OAuth callback:", err);
navigate({
to: "/organization/app-connections",
to: "/organizations/$orgId/app-connections",
params: { orgId: currentOrg.id },
search: { error: "connection_failed" }
});
}

View File

@@ -102,6 +102,7 @@ export const SecretScanningDataSourceRow = ({
navigate({
to: ROUTE_PATHS.SecretScanning.DataSourceByIdPage.path,
params: {
orgId: currentOrg.id,
dataSourceId: id,
type,
projectId