mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-21 16:28:12 +00:00
feat: removed last bit of workspace in frontend. Fatality!
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
ProjectPermissionActions,
|
||||
ProjectPermissionIdentityActions,
|
||||
ProjectPermissionSub,
|
||||
useWorkspace
|
||||
useProject
|
||||
} from "@app/context";
|
||||
import { getProjectBaseURL, getProjectHomePage } from "@app/helpers/project";
|
||||
import { usePopUp } from "@app/hooks";
|
||||
@@ -38,12 +38,10 @@ const Page = () => {
|
||||
strict: false,
|
||||
select: (el) => el.identityId as string
|
||||
});
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
|
||||
const workspaceId = currentWorkspace?.id || "";
|
||||
const { currentProject, projectId } = useProject();
|
||||
|
||||
const { data: identityMembershipDetails, isPending: isMembershipDetailsLoading } =
|
||||
useGetWorkspaceIdentityMembershipDetails(workspaceId, identityId);
|
||||
useGetWorkspaceIdentityMembershipDetails(projectId, identityId);
|
||||
|
||||
const { mutateAsync: deleteMutateAsync, isPending: isDeletingIdentity } =
|
||||
useDeleteIdentityFromWorkspace();
|
||||
@@ -59,7 +57,7 @@ const Page = () => {
|
||||
{
|
||||
actorId: identityId,
|
||||
actorType: ActorType.IDENTITY,
|
||||
projectId: workspaceId
|
||||
projectId: projectId
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
@@ -67,8 +65,8 @@ const Page = () => {
|
||||
type: "success",
|
||||
text: "Identity privilege assumption has started"
|
||||
});
|
||||
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);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -78,7 +76,7 @@ const Page = () => {
|
||||
try {
|
||||
await deleteMutateAsync({
|
||||
identityId,
|
||||
workspaceId
|
||||
projectId
|
||||
});
|
||||
createNotification({
|
||||
text: "Successfully removed identity from project",
|
||||
@@ -86,9 +84,9 @@ const Page = () => {
|
||||
});
|
||||
handlePopUpClose("deleteIdentity");
|
||||
navigate({
|
||||
to: `${getProjectBaseURL(currentWorkspace.type)}/access-management` as const,
|
||||
to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
|
||||
params: {
|
||||
projectId: workspaceId
|
||||
projectId: projectId
|
||||
},
|
||||
search: {
|
||||
selectedTab: "identities"
|
||||
|
||||
+4
-4
@@ -25,7 +25,7 @@ import {
|
||||
ProjectPermissionIdentityActions,
|
||||
ProjectPermissionSub,
|
||||
useProjectPermission,
|
||||
useWorkspace
|
||||
useProject
|
||||
} from "@app/context";
|
||||
import {
|
||||
useCreateIdentityProjectAdditionalPrivilege,
|
||||
@@ -78,8 +78,8 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
|
||||
isDisabled
|
||||
}: Props) => {
|
||||
const isCreate = !privilegeId;
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const projectId = currentWorkspace?.id || "";
|
||||
const { currentProject } = useProject();
|
||||
const projectId = currentProject?.id || "";
|
||||
const { data: privilegeDetails, isPending } = useGetIdentityProjectPrivilegeDetails({
|
||||
identityId,
|
||||
projectId,
|
||||
@@ -225,7 +225,7 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
<AddPoliciesButton isDisabled={isDisabled} projectType={currentWorkspace.type} />
|
||||
<AddPoliciesButton isDisabled={isDisabled} projectType={currentProject.type} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ import {
|
||||
Tooltip,
|
||||
Tr
|
||||
} from "@app/components/v2";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
|
||||
import { formatProjectRoleName } from "@app/helpers/roles";
|
||||
import { usePopUp } from "@app/hooks";
|
||||
import { useUpdateIdentityWorkspaceRole } from "@app/hooks/api";
|
||||
@@ -41,7 +41,7 @@ export const IdentityRoleDetailsSection = ({
|
||||
identityMembershipDetails,
|
||||
isMembershipDetailsLoading
|
||||
}: Props) => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
|
||||
"deleteRole",
|
||||
"modifyRole"
|
||||
@@ -53,7 +53,7 @@ export const IdentityRoleDetailsSection = ({
|
||||
try {
|
||||
const updatedRoles = identityMembershipDetails?.roles?.filter((el) => el.id !== id);
|
||||
await updateIdentityWorkspaceRole({
|
||||
workspaceId: currentWorkspace?.id || "",
|
||||
projectId: currentProject?.id || "",
|
||||
identityId: identityMembershipDetails.identity.id,
|
||||
roles: updatedRoles.map(
|
||||
({
|
||||
|
||||
+5
-6
@@ -30,12 +30,12 @@ import {
|
||||
ProjectPermissionIdentityActions,
|
||||
ProjectPermissionSub,
|
||||
useProjectPermission,
|
||||
useWorkspace
|
||||
useProject
|
||||
} from "@app/context";
|
||||
import { useGetProjectRoles, useUpdateIdentityWorkspaceRole } from "@app/hooks/api";
|
||||
import { IdentityMembership } from "@app/hooks/api/identities/types";
|
||||
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
|
||||
import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/workspace/types";
|
||||
import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/projects/types";
|
||||
|
||||
const roleFormSchema = z.object({
|
||||
roles: z
|
||||
@@ -62,9 +62,8 @@ type Props = {
|
||||
};
|
||||
|
||||
export const IdentityRoleModify = ({ identityProjectMembership }: Props) => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const workspaceId = currentWorkspace?.id || "";
|
||||
const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(workspaceId);
|
||||
const { projectId } = useProject();
|
||||
const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(projectId);
|
||||
const { permission } = useProjectPermission();
|
||||
const isIdentityEditDisabled = permission.cannot(
|
||||
ProjectPermissionIdentityActions.Edit,
|
||||
@@ -117,7 +116,7 @@ export const IdentityRoleModify = ({ identityProjectMembership }: Props) => {
|
||||
|
||||
try {
|
||||
await updateIdentityWorkspaceRole.mutateAsync({
|
||||
workspaceId,
|
||||
projectId,
|
||||
identityId: identityProjectMembership.identity.id,
|
||||
roles: sanitizedRoles
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user