mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 02:27:39 +00:00
Continue RolePermissionsTable
This commit is contained in:
@@ -32,7 +32,7 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
|
|||||||
oidcSSO: false,
|
oidcSSO: false,
|
||||||
scim: false,
|
scim: false,
|
||||||
ldap: false,
|
ldap: false,
|
||||||
groups: false,
|
groups: true,
|
||||||
status: null,
|
status: null,
|
||||||
trial_end: null,
|
trial_end: null,
|
||||||
has_used_trial: true,
|
has_used_trial: true,
|
||||||
|
|||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
import { faPlus } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
|
// import { createNotification } from "@app/components/notifications";
|
||||||
|
import {
|
||||||
|
// DeleteActionModal,
|
||||||
|
IconButton
|
||||||
|
} from "@app/components/v2";
|
||||||
|
// import { useDeleteIdentityFromWorkspace } from "@app/hooks/api";
|
||||||
|
// import { usePopUp } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
|
// import { IdentityAddToProjectModal } from "./IdentityAddToProjectModal";
|
||||||
|
// import { IdentityProjectsTable } from "./IdentityProjectsTable";
|
||||||
|
|
||||||
|
export const RolePermissionsSesction = () => {
|
||||||
|
// const { mutateAsync: deleteMutateAsync } = useDeleteIdentityFromWorkspace();
|
||||||
|
|
||||||
|
// const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
|
||||||
|
// "addIdentityToProject",
|
||||||
|
// "removeIdentityFromProject"
|
||||||
|
// ] as const);
|
||||||
|
|
||||||
|
// const onRemoveIdentitySubmit = async (id: string, projectId: string) => {
|
||||||
|
// try {
|
||||||
|
// await deleteMutateAsync({
|
||||||
|
// identityId: id,
|
||||||
|
// workspaceId: projectId
|
||||||
|
// });
|
||||||
|
|
||||||
|
// createNotification({
|
||||||
|
// text: "Successfully removed identity from project",
|
||||||
|
// type: "success"
|
||||||
|
// });
|
||||||
|
|
||||||
|
// handlePopUpClose("removeIdentityFromProject");
|
||||||
|
// } catch (err) {
|
||||||
|
// console.error(err);
|
||||||
|
// const error = err as any;
|
||||||
|
// const text = error?.response?.data?.message ?? "Failed to remove identity from project";
|
||||||
|
|
||||||
|
// createNotification({
|
||||||
|
// text,
|
||||||
|
// type: "error"
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
||||||
|
<div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
|
||||||
|
<h3 className="text-lg font-semibold text-mineshaft-100">Permissions</h3>
|
||||||
|
<IconButton
|
||||||
|
ariaLabel="copy icon"
|
||||||
|
variant="plain"
|
||||||
|
className="group relative"
|
||||||
|
onClick={() => {
|
||||||
|
console.log("TODO");
|
||||||
|
// handlePopUpOpen("addIdentityToProject");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={faPlus} />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
<div className="py-4">
|
||||||
|
Permissions Table
|
||||||
|
{/* <IdentityProjectsTable identityId={identityId} handlePopUpOpen={handlePopUpOpen} /> */}
|
||||||
|
</div>
|
||||||
|
{/* <DeleteActionModal
|
||||||
|
isOpen={popUp.removeIdentityFromProject.isOpen}
|
||||||
|
title={`Are you sure want to remove ${
|
||||||
|
(popUp?.removeIdentityFromProject?.data as { identityName: string })?.identityName || ""
|
||||||
|
} from ${
|
||||||
|
(popUp?.removeIdentityFromProject?.data as { projectName: string })?.projectName || ""
|
||||||
|
}?`}
|
||||||
|
onChange={(isOpen) => handlePopUpToggle("removeIdentityFromProject", isOpen)}
|
||||||
|
deleteKey="confirm"
|
||||||
|
onDeleteApproved={() => {
|
||||||
|
const popupData = popUp?.removeIdentityFromProject?.data as {
|
||||||
|
identityId: string;
|
||||||
|
projectId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
return onRemoveIdentitySubmit(popupData.identityId, popupData.projectId);
|
||||||
|
}}
|
||||||
|
/> */}
|
||||||
|
{/* <IdentityAddToProjectModal
|
||||||
|
identityId={identityId}
|
||||||
|
popUp={popUp}
|
||||||
|
handlePopUpToggle={handlePopUpToggle}
|
||||||
|
/> */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
import { faKey } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
|
import {
|
||||||
|
EmptyState,
|
||||||
|
Table,
|
||||||
|
TableContainer,
|
||||||
|
TableSkeleton,
|
||||||
|
TBody,
|
||||||
|
Th,
|
||||||
|
THead,
|
||||||
|
Tr
|
||||||
|
} from "@app/components/v2";
|
||||||
|
import { useGetIdentityProjectMemberships } from "@app/hooks/api";
|
||||||
|
// import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
|
// import { IdentityProjectRow } from "./IdentityProjectRow";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
identityId: string;
|
||||||
|
// handlePopUpOpen: (
|
||||||
|
// popUpName: keyof UsePopUpState<["removeIdentityFromProject"]>,
|
||||||
|
// data?: {}
|
||||||
|
// ) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const IdentityProjectsTable = ({
|
||||||
|
identityId
|
||||||
|
}: // handlePopUpOpen
|
||||||
|
Props) => {
|
||||||
|
const { data: projectMemberships, isLoading } = useGetIdentityProjectMemberships(identityId);
|
||||||
|
return (
|
||||||
|
<TableContainer>
|
||||||
|
<Table>
|
||||||
|
<THead>
|
||||||
|
<Tr>
|
||||||
|
<Th>Name</Th>
|
||||||
|
<Th>Role</Th>
|
||||||
|
<Th>Added On</Th>
|
||||||
|
<Th className="w-5" />
|
||||||
|
</Tr>
|
||||||
|
</THead>
|
||||||
|
<TBody>
|
||||||
|
{isLoading && <TableSkeleton columns={2} innerKey="identity-project-memberships" />}
|
||||||
|
{!isLoading &&
|
||||||
|
projectMemberships?.map((membership) => {
|
||||||
|
return (
|
||||||
|
<div key={`membership-${membership.id}`}>Row</div>
|
||||||
|
// <IdentityProjectRow
|
||||||
|
// key={`identity-project-membership-${membership.id}`}
|
||||||
|
// membership={membership}
|
||||||
|
// handlePopUpOpen={handlePopUpOpen}
|
||||||
|
// />
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TBody>
|
||||||
|
</Table>
|
||||||
|
{!isLoading && !projectMemberships?.length && (
|
||||||
|
<EmptyState title="This identity has not been assigned to any projects" icon={faKey} />
|
||||||
|
)}
|
||||||
|
</TableContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { RolePermissionsSesction } from "./RolePermissionsSection";
|
||||||
Reference in New Issue
Block a user