Merge remote-tracking branch 'origin/main' into feat/pki-ENG-3666

This commit is contained in:
Carlos Monastyrski
2025-09-16 12:48:37 -03:00
717 changed files with 14569 additions and 5316 deletions
+7 -7
View File
@@ -4,12 +4,12 @@ import { Link, Outlet } from "@tanstack/react-router";
import { motion } from "framer-motion";
import { Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
import { useProjectPermission, useWorkspace } from "@app/context";
import { useProject, useProjectPermission } from "@app/context";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const KmsLayout = () => {
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
return (
@@ -34,7 +34,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/overview"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -51,7 +51,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/kmip"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -70,7 +70,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/access-management"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -87,7 +87,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/audit-logs"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -104,7 +104,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/settings"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -40,7 +40,7 @@ import { envConfig } from "@app/config/env";
import { useOrganization, useSubscription, useUser } from "@app/context";
import { isInfisicalCloud } from "@app/helpers/platform";
import { useToggle } from "@app/hooks";
import { useGetOrganizations, useLogoutUser, workspaceKeys } from "@app/hooks/api";
import { projectKeys, useGetOrganizations, useLogoutUser } from "@app/hooks/api";
import { authKeys, selectOrganization } from "@app/hooks/api/auth/queries";
import { MfaMethod } from "@app/hooks/api/auth/types";
import { getAuthToken } from "@app/hooks/api/reactQuery";
@@ -135,7 +135,7 @@ export const Navbar = () => {
const handleOrgChange = async (orgId: string) => {
queryClient.removeQueries({ queryKey: authKeys.getAuthToken });
queryClient.removeQueries({ queryKey: workspaceKeys.getAllUserWorkspace() });
queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
const { token, isMfaEnabled, mfaMethod } = await selectOrganization({
organizationId: orgId
@@ -6,8 +6,9 @@ import {
faCog,
faFileLines,
faHome,
faLink,
faMobile,
faPlug,
faPuzzlePiece,
faSitemap,
faStamp,
faUsers
@@ -17,12 +18,12 @@ import { Link, Outlet } from "@tanstack/react-router";
import { motion } from "framer-motion";
import { Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
import { useProjectPermission, useWorkspace } from "@app/context";
import { useProject, useProjectPermission } from "@app/context";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const PkiManagerLayout = () => {
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
const { t } = useTranslation();
@@ -49,7 +50,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/subscribers"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -66,7 +67,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/certificate-templates"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -83,7 +84,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/certificates"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -100,7 +101,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/certificate-authorities"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -117,7 +118,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/alerting"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -134,26 +135,43 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/integrations"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
<MenuItem isSelected={isActive}>
<div className="mx-1 flex gap-2">
<div className="w-6">
<FontAwesomeIcon icon={faLink} />
<FontAwesomeIcon icon={faPuzzlePiece} />
</div>
Integrations
</div>
</MenuItem>
)}
</Link>
<Link
to="/projects/cert-management/$projectId/app-connections"
params={{
projectId: currentProject.id
}}
>
{({ isActive }) => (
<MenuItem isSelected={isActive}>
<div className="mx-1 flex gap-2">
<div className="w-6">
<FontAwesomeIcon icon={faPlug} />
</div>
App Connections
</div>
</MenuItem>
)}
</Link>
</MenuGroup>
<MenuGroup title="Others">
<Link
to="/projects/cert-management/$projectId/access-management"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -170,7 +188,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/audit-logs"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -187,7 +205,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/settings"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -2,13 +2,13 @@ import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Button } from "@app/components/v2";
import { useProjectPermission, useWorkspace } from "@app/context";
import { useProject, useProjectPermission } from "@app/context";
import { getProjectHomePage } from "@app/helpers/project";
import { useRemoveAssumeProjectPrivilege } from "@app/hooks/api";
import { ActorType } from "@app/hooks/api/auditLogs/enums";
export const AssumePrivilegeModeBanner = () => {
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const exitAssumePrivilegeMode = useRemoveAssumeProjectPrivilege();
const { assumedPrivilegeDetails } = useProjectPermission();
@@ -32,15 +32,12 @@ export const AssumePrivilegeModeBanner = () => {
onClick={() => {
exitAssumePrivilegeMode.mutate(
{
projectId: currentWorkspace.id
projectId: currentProject.id
},
{
onSuccess: () => {
const url = getProjectHomePage(
currentWorkspace.type,
currentWorkspace.environments
);
window.location.href = url.replace("$projectId", currentWorkspace.id);
const url = getProjectHomePage(currentProject.type, currentProject.environments);
window.location.href = url.replace("$projectId", currentProject.id);
}
}
);
@@ -28,21 +28,21 @@ import {
OrgPermissionActions,
OrgPermissionSubjects,
useOrganization,
useSubscription,
useWorkspace
useProject,
useSubscription
} from "@app/context";
import { getProjectHomePage } from "@app/helpers/project";
import { usePopUp } from "@app/hooks";
import { useGetUserWorkspaces } from "@app/hooks/api";
import { useGetUserProjects } from "@app/hooks/api";
import { Project } from "@app/hooks/api/projects/types";
import { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
import { Workspace } from "@app/hooks/api/workspace/types";
export const ProjectSelect = () => {
const [searchProject, setSearchProject] = useState("");
const { currentWorkspace } = useWorkspace();
const { currentProject: currentWorkspace } = useProject();
const { currentOrg } = useOrganization();
const { data: workspaces = [] } = useGetUserWorkspaces();
const { data: projects = [] } = useGetUserProjects();
const { data: projectFavorites } = useGetUserProjectFavorites(currentOrg.id);
const { subscription } = useSubscription();
@@ -86,16 +86,16 @@ export const ProjectSelect = () => {
"upgradePlan"
] as const);
const projects = useMemo(() => {
const projectOptions = workspaces
.map((w): Workspace & { isFavorite: boolean } => ({
const projectsSortedByFav = useMemo(() => {
const projectOptions = projects
.map((w): Project & { isFavorite: boolean } => ({
...w,
isFavorite: Boolean(projectFavorites?.includes(w.id))
}))
.sort((a, b) => Number(b.isFavorite) - Number(a.isFavorite));
return projectOptions;
}, [workspaces, projectFavorites, currentWorkspace]);
}, [projects, projectFavorites, currentWorkspace]);
return (
<div className="-mr-2 flex w-full items-center gap-1">
@@ -147,7 +147,7 @@ export const ProjectSelect = () => {
/>
</div>
<div className="thin-scrollbar max-h-80 overflow-auto">
{projects
{projectsSortedByFav
?.filter((el) => el.name?.toLowerCase().includes(searchProject.toLowerCase()))
?.map((workspace) => {
return (
@@ -200,16 +200,20 @@ export const ProjectSelect = () => {
</div>
<div className="mt-1 h-1 border-t border-mineshaft-600" />
<OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Workspace}>
{(isAllowed) => (
<DropdownMenuItem
isDisabled={!isAllowed}
icon={<FontAwesomeIcon icon={faPlus} />}
onClick={() =>
handlePopUpOpen(isAddingProjectsAllowed ? "addNewWs" : "upgradePlan")
}
>
New Project
</DropdownMenuItem>
{(isOldProjectPermissionAllowed) => (
<OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Project}>
{(isAllowed) => (
<DropdownMenuItem
isDisabled={!isAllowed && !isOldProjectPermissionAllowed}
icon={<FontAwesomeIcon icon={faPlus} />}
onClick={() =>
handlePopUpOpen(isAddingProjectsAllowed ? "addNewWs" : "upgradePlan")
}
>
New Project
</DropdownMenuItem>
)}
</OrgPermissionCan>
)}
</OrgPermissionCan>
</DropdownMenuContent>
@@ -6,6 +6,7 @@ import {
faCog,
faHome,
faMobile,
faPlug,
faPuzzlePiece,
faUsers,
faVault
@@ -15,7 +16,7 @@ import { Link, Outlet, useLocation } from "@tanstack/react-router";
import { motion } from "framer-motion";
import { Badge, Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
import { useProjectPermission, useWorkspace } from "@app/context";
import { useProject, useProjectPermission } from "@app/context";
import {
useGetAccessRequestsCount,
useGetSecretApprovalRequestCount,
@@ -25,16 +26,15 @@ import {
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const SecretManagerLayout = () => {
const { currentWorkspace } = useWorkspace();
const { currentProject, projectId } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
const { t } = useTranslation();
const workspaceId = currentWorkspace?.id || "";
const projectSlug = currentWorkspace?.slug || "";
const projectSlug = currentProject?.slug || "";
const location = useLocation();
const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({
workspaceId
projectId
});
const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({
projectSlug
@@ -42,7 +42,7 @@ export const SecretManagerLayout = () => {
// we only show the secret rotations v1 tab if they have existing rotations
const { data: secretRotations } = useGetSecretRotations({
workspaceId,
workspaceId: projectId,
options: {
refetchOnMount: false
}
@@ -74,9 +74,9 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/overview"
params={{
projectId: currentWorkspace.id,
...(currentWorkspace.environments.length
? { envSlug: currentWorkspace.environments[0]?.slug }
projectId: currentProject.id,
...(currentProject.environments.length
? { envSlug: currentProject.environments[0]?.slug }
: {})
}}
>
@@ -85,7 +85,7 @@ export const SecretManagerLayout = () => {
isSelected={
isActive ||
location.pathname.startsWith(
`/projects/secret-management/${currentWorkspace.id}/overview`
`/projects/secret-management/${currentProject.id}/overview`
)
}
>
@@ -101,7 +101,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/integrations"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -119,7 +119,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/secret-rotation"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -137,7 +137,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/approval"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -159,12 +159,29 @@ export const SecretManagerLayout = () => {
</MenuItem>
)}
</Link>
<Link
to="/projects/secret-management/$projectId/app-connections"
params={{
projectId: currentProject.id
}}
>
{({ isActive }) => (
<MenuItem isSelected={isActive}>
<div className="mx-1 flex gap-2">
<div className="w-6">
<FontAwesomeIcon icon={faPlug} />
</div>
App Connections
</div>
</MenuItem>
)}
</Link>
</MenuGroup>
<MenuGroup title="Others">
<Link
to="/projects/secret-management/$projectId/access-management"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -181,7 +198,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/audit-logs"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -198,7 +215,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/settings"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -4,6 +4,7 @@ import {
faDatabase,
faHome,
faMagnifyingGlass,
faPlug,
faUsers
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
@@ -13,9 +14,9 @@ import { motion } from "framer-motion";
import { Badge, Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
import {
ProjectPermissionSub,
useProject,
useProjectPermission,
useSubscription,
useWorkspace
useSubscription
} from "@app/context";
import { ProjectPermissionSecretScanningFindingActions } from "@app/context/ProjectPermissionContext/types";
import { useGetSecretScanningUnresolvedFindingCount } from "@app/hooks/api/secretScanningV2";
@@ -23,14 +24,14 @@ import { useGetSecretScanningUnresolvedFindingCount } from "@app/hooks/api/secre
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const SecretScanningLayout = () => {
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
const { permission } = useProjectPermission();
const { subscription } = useSubscription();
const { data: unresolvedFindings } = useGetSecretScanningUnresolvedFindingCount(
currentWorkspace.id,
currentProject.id,
{
enabled:
subscription.secretScanning &&
@@ -64,7 +65,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/data-sources"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -81,7 +82,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/findings"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -100,12 +101,29 @@ export const SecretScanningLayout = () => {
</MenuItem>
)}
</Link>
<Link
to="/projects/secret-scanning/$projectId/app-connections"
params={{
projectId: currentProject.id
}}
>
{({ isActive }) => (
<MenuItem isSelected={isActive}>
<div className="mx-1 flex gap-2">
<div className="w-6">
<FontAwesomeIcon icon={faPlug} />
</div>
App Connections
</div>
</MenuItem>
)}
</Link>
</MenuGroup>
<MenuGroup title="Others">
<Link
to="/projects/secret-scanning/$projectId/access-management"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -122,7 +140,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/audit-logs"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -139,7 +157,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/settings"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
+8 -8
View File
@@ -15,14 +15,14 @@ import { Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
useWorkspace
useProject,
useProjectPermission
} from "@app/context";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const SshLayout = () => {
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
return (
@@ -47,7 +47,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/overview"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -70,7 +70,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/cas"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -93,7 +93,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/access-management"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -110,7 +110,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/audit-logs"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -127,7 +127,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/settings"
params={{
projectId: currentWorkspace.id
projectId: currentProject.id
}}
>
{({ isActive }) => (