feat: completed identity project detail screen

This commit is contained in:
=
2024-10-25 00:59:40 +05:30
parent d03f890471
commit b6a1ab2376
22 changed files with 1451 additions and 754 deletions
@@ -18,6 +18,7 @@ export {
useGetUserWorkspaces,
useGetWorkspaceAuthorizations,
useGetWorkspaceById,
useGetWorkspaceIdentityMembershipDetails,
useGetWorkspaceIdentityMemberships,
useGetWorkspaceIndexStatus,
useGetWorkspaceIntegrations,
+19 -1
View File
@@ -9,7 +9,7 @@ import { TCertificate } from "../certificates/types";
import { TCertificateTemplate } from "../certificateTemplates/types";
import { TGroupMembership } from "../groups/types";
import { identitiesKeys } from "../identities/queries";
import { TProjectIdentitiesList } from "../identities/types";
import { IdentityMembership, TProjectIdentitiesList } from "../identities/types";
import { IntegrationAuth } from "../integrationAuth/types";
import { TIntegration } from "../integrations/types";
import { TPkiAlert } from "../pkiAlerts/types";
@@ -477,6 +477,9 @@ export const useUpdateIdentityWorkspaceRole = () => {
onSuccess: (_, { identityId, workspaceId }) => {
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIdentityMemberships(workspaceId));
queryClient.invalidateQueries(identitiesKeys.getIdentityProjectMemberships(identityId));
queryClient.invalidateQueries(
workspaceKeys.getWorkspaceIdentityMembershipDetails(workspaceId, identityId)
);
}
});
};
@@ -553,6 +556,21 @@ export const useGetWorkspaceIdentityMemberships = (
});
};
export const useGetWorkspaceIdentityMembershipDetails = (projectId: string, identityId: string) => {
return useQuery({
enabled: Boolean(projectId && identityId),
queryKey: workspaceKeys.getWorkspaceIdentityMembershipDetails(projectId, identityId),
queryFn: async () => {
const {
data: { identityMembership }
} = await apiRequest.get<{ identityMembership: IdentityMembership }>(
`/api/v2/workspace/${projectId}/identity-memberships/${identityId}`
);
return identityMembership;
}
});
};
export const useListWorkspaceGroups = (projectId: string) => {
return useQuery({
queryKey: workspaceKeys.getWorkspaceGroupMemberships(projectId),
@@ -19,6 +19,8 @@ export const workspaceKeys = {
[{ workspaceId, membershipId }, "workspace-user-details"] as const,
getWorkspaceIdentityMemberships: (workspaceId: string) =>
[{ workspaceId }, "workspace-identity-memberships"] as const,
getWorkspaceIdentityMembershipDetails: (workspaceId: string, identityId: string) =>
[{ workspaceId, identityId }, "workspace-identity-membership-details"] as const,
// allows invalidation using above key without knowing params
getWorkspaceIdentityMembershipsWithParams: ({
workspaceId,