mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-20 21:18:18 +00:00
65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import { subject } from "@casl/ability";
|
|
import { faEdit } from "@fortawesome/free-solid-svg-icons";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { ProjectPermissionCan } from "@app/components/permissions";
|
|
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
|
import { Badge, IconButton } from "@app/components/v2";
|
|
import { ProjectPermissionSub } from "@app/context";
|
|
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
|
|
import { TPkiSync } from "@app/hooks/api/pkiSyncs";
|
|
|
|
type Props = {
|
|
pkiSync: TPkiSync;
|
|
onEditOptions: VoidFunction;
|
|
};
|
|
|
|
export const PkiSyncOptionsSection = ({ pkiSync, onEditOptions }: Props) => {
|
|
const {
|
|
syncOptions: { canRemoveCertificates }
|
|
} = pkiSync;
|
|
|
|
const permissionSubject = subject(ProjectPermissionSub.PkiSyncs, {
|
|
subscriberId: pkiSync.subscriberId || ""
|
|
});
|
|
|
|
return (
|
|
<div>
|
|
<div className="border-mineshaft-600 bg-mineshaft-900 flex w-full flex-col gap-3 rounded-lg border px-4 py-3">
|
|
<div className="border-mineshaft-400 flex items-center justify-between border-b pb-2">
|
|
<h3 className="text-mineshaft-100 font-medium">Sync Options</h3>
|
|
<ProjectPermissionCan I={ProjectPermissionPkiSyncActions.Edit} a={permissionSubject}>
|
|
{(isAllowed) => (
|
|
<IconButton
|
|
variant="plain"
|
|
colorSchema="secondary"
|
|
isDisabled={!isAllowed}
|
|
ariaLabel="Edit sync options"
|
|
onClick={onEditOptions}
|
|
>
|
|
<FontAwesomeIcon icon={faEdit} />
|
|
</IconButton>
|
|
)}
|
|
</ProjectPermissionCan>
|
|
</div>
|
|
<div>
|
|
<div className="space-y-3">
|
|
{/* Hidden for now - Import certificates functionality disabled
|
|
<GenericFieldLabel label="Certificate Import">
|
|
<Badge variant={canImportCertificates ? "success" : "danger"}>
|
|
{canImportCertificates ? "Enabled" : "Disabled"}
|
|
</Badge>
|
|
</GenericFieldLabel>
|
|
*/}
|
|
<GenericFieldLabel label="Certificate Removal">
|
|
<Badge variant={canRemoveCertificates ? "success" : "danger"}>
|
|
{canRemoveCertificates ? "Enabled" : "Disabled"}
|
|
</Badge>
|
|
</GenericFieldLabel>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|