mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 06:28:11 +00:00
Merge pull request #4790 from Infisical/fix/remove-duplicate-error-notifications
Fix: remove duplicate error notifications
This commit is contained in:
@@ -35,7 +35,6 @@ export const WishForm = () => {
|
|||||||
const [isOpen, setIsOpen] = useToggle(false);
|
const [isOpen, setIsOpen] = useToggle(false);
|
||||||
|
|
||||||
const createWish = async (data: TFormData) => {
|
const createWish = async (data: TFormData) => {
|
||||||
try {
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
text: data.text
|
text: data.text
|
||||||
});
|
});
|
||||||
@@ -46,12 +45,6 @@ export const WishForm = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setIsOpen.off();
|
setIsOpen.off();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "An error occured while sending your wish to the Infisical team.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ const TotpRegistration = ({ onComplete, shouldCenterQr }: Props) => {
|
|||||||
|
|
||||||
const handleTotpVerify = async (event: React.FormEvent<HTMLFormElement>) => {
|
const handleTotpVerify = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
try {
|
|
||||||
const result = await verifyUserTotp({
|
const result = await verifyUserTotp({
|
||||||
totp
|
totp
|
||||||
});
|
});
|
||||||
@@ -41,12 +40,6 @@ const TotpRegistration = ({ onComplete, shouldCenterQr }: Props) => {
|
|||||||
} else if (onComplete) {
|
} else if (onComplete) {
|
||||||
onComplete();
|
onComplete();
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to verify TOTP code",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRecoveryDownloadComplete = async () => {
|
const handleRecoveryDownloadComplete = async () => {
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
|
|||||||
const { mutateAsync: selectOrg } = useSelectOrganization();
|
const { mutateAsync: selectOrg } = useSelectOrganization();
|
||||||
|
|
||||||
const onFormSubmit = async ({ name }: FormData) => {
|
const onFormSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
|
||||||
const organization = await createOrg({
|
const organization = await createOrg({
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
@@ -65,13 +64,6 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
|
|||||||
|
|
||||||
reset();
|
reset();
|
||||||
onClose();
|
onClose();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to created organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export const DeletePkiSyncModal = ({ isOpen, onOpenChange, pkiSync, onComplete }
|
|||||||
const handleDeletePkiSync = async () => {
|
const handleDeletePkiSync = async () => {
|
||||||
const destinationName = PKI_SYNC_MAP[destination].name;
|
const destinationName = PKI_SYNC_MAP[destination].name;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteSync.mutateAsync({
|
await deleteSync.mutateAsync({
|
||||||
syncId,
|
syncId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -34,14 +33,6 @@ export const DeletePkiSyncModal = ({ isOpen, onOpenChange, pkiSync, onComplete }
|
|||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${destinationName} PKI Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {
|
|||||||
const triggerImportCertificates = useTriggerPkiSyncImportCertificates();
|
const triggerImportCertificates = useTriggerPkiSyncImportCertificates();
|
||||||
|
|
||||||
const handleTriggerImportCertificates = async () => {
|
const handleTriggerImportCertificates = async () => {
|
||||||
try {
|
|
||||||
await triggerImportCertificates.mutateAsync({
|
await triggerImportCertificates.mutateAsync({
|
||||||
syncId,
|
syncId,
|
||||||
destination,
|
destination,
|
||||||
@@ -34,14 +33,6 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger certificate import for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {
|
|||||||
const triggerRemoveCertificates = useTriggerPkiSyncRemoveCertificates();
|
const triggerRemoveCertificates = useTriggerPkiSyncRemoveCertificates();
|
||||||
|
|
||||||
const handleTriggerRemoveCertificates = async () => {
|
const handleTriggerRemoveCertificates = async () => {
|
||||||
try {
|
|
||||||
await triggerRemoveCertificates.mutateAsync({
|
await triggerRemoveCertificates.mutateAsync({
|
||||||
syncId,
|
syncId,
|
||||||
destination,
|
destination,
|
||||||
@@ -34,14 +33,6 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger certificate removal for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -86,14 +86,8 @@ export const CreatePkiSyncForm = ({ destination, onComplete, onCancel, initialDa
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(pkiSync);
|
onComplete(pkiSync);
|
||||||
} catch (err: Error | unknown) {
|
} catch {
|
||||||
console.error("PKI sync creation failed:", err);
|
|
||||||
setShowConfirmation(false);
|
setShowConfirmation(false);
|
||||||
createNotification({
|
|
||||||
title: `Failed to create ${destinationName} Certificate Sync`,
|
|
||||||
text: err instanceof Error ? err.message : "An unknown error occurred",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export const EditPkiSyncForm = ({ pkiSync, fields, onComplete }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = async ({ connection, ...formData }: TUpdatePkiSyncForm) => {
|
const onSubmit = async ({ connection, ...formData }: TUpdatePkiSyncForm) => {
|
||||||
try {
|
|
||||||
const updatedPkiSync = await updatePkiSync.mutateAsync({
|
const updatedPkiSync = await updatePkiSync.mutateAsync({
|
||||||
syncId: pkiSync.id,
|
syncId: pkiSync.id,
|
||||||
...formData,
|
...formData,
|
||||||
@@ -56,14 +55,6 @@ export const EditPkiSyncForm = ({ pkiSync, fields, onComplete }: Props) => {
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(updatedPkiSync);
|
onComplete(updatedPkiSync);
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to update ${destinationName} PKI Sync`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let Component: ReactNode;
|
let Component: ReactNode;
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
|
|||||||
}, [currentProject, showSlugField]);
|
}, [currentProject, showSlugField]);
|
||||||
|
|
||||||
const onFormSubmit = async (data: BaseFormData | FormDataWithSlug) => {
|
const onFormSubmit = async (data: BaseFormData | FormDataWithSlug) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.id) return;
|
if (!currentProject?.id) return;
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
@@ -73,13 +72,6 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
|
|||||||
text: "Successfully updated project overview",
|
text: "Successfully updated project overview",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update project overview",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ const NewProjectForm = ({ onOpenChange }: NewProjectFormProps) => {
|
|||||||
// type check
|
// type check
|
||||||
if (!currentOrg) return;
|
if (!currentOrg) return;
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
try {
|
|
||||||
const {
|
const {
|
||||||
data: { project }
|
data: { project }
|
||||||
} = await createWs.mutateAsync({
|
} = await createWs.mutateAsync({
|
||||||
@@ -160,10 +159,6 @@ const NewProjectForm = ({ onOpenChange }: NewProjectFormProps) => {
|
|||||||
to: getProjectHomePage(project.type, project.environments),
|
to: getProjectHomePage(project.type, project.environments),
|
||||||
params: { projectId: project.id }
|
params: { projectId: project.id }
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({ text: "Failed to create project", type: "error" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const onSubmit = handleSubmit((data) => {
|
const onSubmit = handleSubmit((data) => {
|
||||||
return onCreateProject(data);
|
return onCreateProject(data);
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ export const DeleteSecretRotationV2Modal = ({
|
|||||||
const handleDeleteSecretRotation = async () => {
|
const handleDeleteSecretRotation = async () => {
|
||||||
const rotationType = SECRET_ROTATION_MAP[type].name;
|
const rotationType = SECRET_ROTATION_MAP[type].name;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteSecretRotation.mutateAsync({
|
await deleteSecretRotation.mutateAsync({
|
||||||
rotationId,
|
rotationId,
|
||||||
type,
|
type,
|
||||||
@@ -54,12 +53,6 @@ export const DeleteSecretRotationV2Modal = ({
|
|||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${rotationType} Rotation`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const Content = ({ secretRotation, onComplete }: ContentProps) => {
|
|||||||
const rotationType = SECRET_ROTATION_MAP[type].name;
|
const rotationType = SECRET_ROTATION_MAP[type].name;
|
||||||
|
|
||||||
const handleRotateSecrets = async () => {
|
const handleRotateSecrets = async () => {
|
||||||
try {
|
|
||||||
await rotateSecrets.mutateAsync({
|
await rotateSecrets.mutateAsync({
|
||||||
rotationId,
|
rotationId,
|
||||||
type,
|
type,
|
||||||
@@ -36,14 +35,6 @@ const Content = ({ secretRotation, onComplete }: ContentProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to rotate ${rotationType} secrets`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ export const SecretRotationV2Form = ({
|
|||||||
environment: environment.slug,
|
environment: environment.slug,
|
||||||
projectId: currentProject.id
|
projectId: currentProject.id
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
const rotation = await mutation;
|
const rotation = await mutation;
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -128,13 +127,6 @@ export const SecretRotationV2Form = ({
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(rotation);
|
onComplete(rotation);
|
||||||
} catch (err: any) {
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${secretRotation ? "update" : "create"} ${rotationType} Rotation`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePrev = () => {
|
const handlePrev = () => {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export const DeleteSecretScanningDataSourceModal = ({
|
|||||||
const handleDeleteDataSource = async () => {
|
const handleDeleteDataSource = async () => {
|
||||||
const dataSourceType = SECRET_SCANNING_DATA_SOURCE_MAP[type].name;
|
const dataSourceType = SECRET_SCANNING_DATA_SOURCE_MAP[type].name;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteDataSource.mutateAsync({
|
await deleteDataSource.mutateAsync({
|
||||||
dataSourceId,
|
dataSourceId,
|
||||||
type,
|
type,
|
||||||
@@ -42,12 +41,6 @@ export const DeleteSecretScanningDataSourceModal = ({
|
|||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${dataSourceType} Data Source`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ export const SecretScanningDataSourceForm = ({
|
|||||||
connectionId: connection?.id,
|
connectionId: connection?.id,
|
||||||
projectId: currentProject.id
|
projectId: currentProject.id
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
const source = await mutation;
|
const source = await mutation;
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -81,13 +80,6 @@ export const SecretScanningDataSourceForm = ({
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(source);
|
onComplete(source);
|
||||||
} catch (err: any) {
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${dataSource ? "update" : "create"} ${sourceType} Data Source`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePrev = () => {
|
const handlePrev = () => {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export const DeleteSecretSyncModal = ({ isOpen, onOpenChange, secretSync, onComp
|
|||||||
const handleDeleteSecretSync = async () => {
|
const handleDeleteSecretSync = async () => {
|
||||||
const destinationName = SECRET_SYNC_MAP[destination].name;
|
const destinationName = SECRET_SYNC_MAP[destination].name;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteSync.mutateAsync({
|
await deleteSync.mutateAsync({
|
||||||
syncId,
|
syncId,
|
||||||
destination,
|
destination,
|
||||||
@@ -38,14 +37,6 @@ export const DeleteSecretSyncModal = ({ isOpen, onOpenChange, secretSync, onComp
|
|||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to remove ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
|
|||||||
const triggerImportSecrets = useTriggerSecretSyncImportSecrets();
|
const triggerImportSecrets = useTriggerSecretSyncImportSecrets();
|
||||||
|
|
||||||
const handleTriggerImportSecrets = async ({ importBehavior }: TFormData) => {
|
const handleTriggerImportSecrets = async ({ importBehavior }: TFormData) => {
|
||||||
try {
|
|
||||||
await triggerImportSecrets.mutateAsync({
|
await triggerImportSecrets.mutateAsync({
|
||||||
syncId,
|
syncId,
|
||||||
destination,
|
destination,
|
||||||
@@ -65,14 +64,6 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger secret import for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
|
|||||||
const triggerSyncImport = useTriggerSecretSyncRemoveSecrets();
|
const triggerSyncImport = useTriggerSecretSyncRemoveSecrets();
|
||||||
|
|
||||||
const handleTriggerRemoveSecrets = async () => {
|
const handleTriggerRemoveSecrets = async () => {
|
||||||
try {
|
|
||||||
await triggerSyncImport.mutateAsync({
|
await triggerSyncImport.mutateAsync({
|
||||||
syncId,
|
syncId,
|
||||||
destination,
|
destination,
|
||||||
@@ -34,14 +33,6 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger secret removal for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -88,14 +88,8 @@ export const CreateSecretSyncForm = ({
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(secretSync);
|
onComplete(secretSync);
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
console.error(err);
|
|
||||||
setShowConfirmation(false);
|
setShowConfirmation(false);
|
||||||
createNotification({
|
|
||||||
title: `Failed to add ${destinationName} Sync`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ export const EditSecretSyncForm = ({ secretSync, fields, onComplete }: Props) =>
|
|||||||
|
|
||||||
const performUpdate = useCallback(
|
const performUpdate = useCallback(
|
||||||
async (formData: TSecretSyncForm) => {
|
async (formData: TSecretSyncForm) => {
|
||||||
try {
|
|
||||||
const { environment, connection, ...updateData } = formData;
|
const { environment, connection, ...updateData } = formData;
|
||||||
const updatedSecretSync = await updateSecretSync.mutateAsync({
|
const updatedSecretSync = await updateSecretSync.mutateAsync({
|
||||||
syncId: secretSync.id,
|
syncId: secretSync.id,
|
||||||
@@ -73,14 +72,6 @@ export const EditSecretSyncForm = ({ secretSync, fields, onComplete }: Props) =>
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(updatedSecretSync);
|
onComplete(updatedSecretSync);
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to update ${destinationName} Sync`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[updateSecretSync, secretSync.id, secretSync.projectId, destinationName, onComplete]
|
[updateSecretSync, secretSync.id, secretSync.projectId, destinationName, onComplete]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ export const CreateTagModal = ({ isOpen, onToggle, append, currentSecret }: Prop
|
|||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ slug, color }: FormData) => {
|
const onFormSubmit = async ({ slug, color }: FormData) => {
|
||||||
try {
|
|
||||||
const data = await createWsTag({
|
const data = await createWsTag({
|
||||||
projectId,
|
projectId,
|
||||||
tagColor: color,
|
tagColor: color,
|
||||||
@@ -143,13 +142,6 @@ export const CreateTagModal = ({ isOpen, onToggle, append, currentSecret }: Prop
|
|||||||
text: "Successfully created a tag",
|
text: "Successfully created a tag",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create a tag",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ export const NewSubOrganizationForm = ({ onClose }: ContentProps) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const onSubmit = async ({ name }: FormData) => {
|
const onSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
|
||||||
const { organization } = await createSubOrg.mutateAsync({
|
const { organization } = await createSubOrg.mutateAsync({
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
@@ -52,12 +51,6 @@ export const NewSubOrganizationForm = ({ onClose }: ContentProps) => {
|
|||||||
search: (prev) => ({ ...prev, subOrganization: organization.name })
|
search: (prev) => ({ ...prev, subOrganization: organization.name })
|
||||||
});
|
});
|
||||||
await router.invalidate({ sync: true }).catch(() => null);
|
await router.invalidate({ sync: true }).catch(() => null);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create sub organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
import { Link, linkOptions } from "@tanstack/react-router";
|
import { Link, linkOptions } from "@tanstack/react-router";
|
||||||
|
|
||||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
import { OrgPermissionCan } from "@app/components/permissions";
|
import { OrgPermissionCan } from "@app/components/permissions";
|
||||||
import { NewProjectModal } from "@app/components/projects";
|
import { NewProjectModal } from "@app/components/projects";
|
||||||
import {
|
import {
|
||||||
@@ -59,31 +58,17 @@ export const ProjectSelect = () => {
|
|||||||
const { mutateAsync: updateUserProjectFavorites } = useUpdateUserProjectFavorites();
|
const { mutateAsync: updateUserProjectFavorites } = useUpdateUserProjectFavorites();
|
||||||
|
|
||||||
const addProjectToFavorites = async (projectId: string) => {
|
const addProjectToFavorites = async (projectId: string) => {
|
||||||
try {
|
|
||||||
await updateUserProjectFavorites({
|
await updateUserProjectFavorites({
|
||||||
orgId: currentOrg!.id,
|
orgId: currentOrg!.id,
|
||||||
projectFavorites: [...(projectFavorites || []), projectId]
|
projectFavorites: [...(projectFavorites || []), projectId]
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to add project to favorites.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeProjectFromFavorites = async (projectId: string) => {
|
const removeProjectFromFavorites = async (projectId: string) => {
|
||||||
try {
|
|
||||||
await updateUserProjectFavorites({
|
await updateUserProjectFavorites({
|
||||||
orgId: currentOrg!.id,
|
orgId: currentOrg!.id,
|
||||||
projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
|
projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove project from favorites.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAddingProjectsAllowed = subscription?.workspaceLimit
|
const isAddingProjectsAllowed = subscription?.workspaceLimit
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ const Content = ({ onClose }: ContentProps) => {
|
|||||||
const users = usersData.filter((user) => !user.superAdmin);
|
const users = usersData.filter((user) => !user.superAdmin);
|
||||||
|
|
||||||
const onSubmit = async ({ user }: FormData) => {
|
const onSubmit = async ({ user }: FormData) => {
|
||||||
try {
|
|
||||||
await grantAdmin.mutateAsync(user.id);
|
await grantAdmin.mutateAsync(user.id);
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -73,12 +72,6 @@ const Content = ({ onClose }: ContentProps) => {
|
|||||||
text: "Successfully granted server admin status"
|
text: "Successfully granted server admin status"
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to grant server admin status",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -303,18 +303,11 @@ export const ServerAdminsTable = () => {
|
|||||||
const handleRemoveUser = async () => {
|
const handleRemoveUser = async () => {
|
||||||
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteUser(id);
|
await deleteUser(id);
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully deleted user"
|
text: "Successfully deleted user"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error deleting user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeUser");
|
handlePopUpClose("removeUser");
|
||||||
};
|
};
|
||||||
@@ -322,24 +315,16 @@ export const ServerAdminsTable = () => {
|
|||||||
const handleRemoveServerAdminAccess = async () => {
|
const handleRemoveServerAdminAccess = async () => {
|
||||||
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
|
||||||
await removeAdminAccess(id);
|
await removeAdminAccess(id);
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully removed server admin access from user"
|
text: "Successfully removed server admin access from user"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error removing server admin access from user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeServerAdmin");
|
handlePopUpClose("removeServerAdmin");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveUsers = async () => {
|
const handleRemoveUsers = async () => {
|
||||||
try {
|
|
||||||
await deleteUsers(selectedUsers.map((user) => user.id));
|
await deleteUsers(selectedUsers.map((user) => user.id));
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -349,12 +334,6 @@ export const ServerAdminsTable = () => {
|
|||||||
|
|
||||||
setSelectedUsers([]);
|
setSelectedUsers([]);
|
||||||
handlePopUpClose("removeUsers");
|
handlePopUpClose("removeUsers");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove users",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export const AuthenticationPageForm = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onAuthFormSubmit = async (formData: TAuthForm) => {
|
const onAuthFormSubmit = async (formData: TAuthForm) => {
|
||||||
try {
|
|
||||||
const enabledMethods: LoginMethod[] = [];
|
const enabledMethods: LoginMethod[] = [];
|
||||||
if (formData.isEmailEnabled) {
|
if (formData.isEmailEnabled) {
|
||||||
enabledMethods.push(LoginMethod.EMAIL);
|
enabledMethods.push(LoginMethod.EMAIL);
|
||||||
@@ -100,13 +99,6 @@ export const AuthenticationPageForm = () => {
|
|||||||
text: "Login methods have been successfully updated.",
|
text: "Login methods have been successfully updated.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to update login methods."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -31,15 +31,10 @@ export const CachingPageForm = () => {
|
|||||||
const handleInvalidateCacheSubmit = async () => {
|
const handleInvalidateCacheSubmit = async () => {
|
||||||
if (!type || isInvalidating) return;
|
if (!type || isInvalidating) return;
|
||||||
|
|
||||||
try {
|
|
||||||
await invalidateCache({ type });
|
await invalidateCache({ type });
|
||||||
createNotification({ text: `Began invalidating ${type} cache`, type: "success" });
|
createNotification({ text: `Began invalidating ${type} cache`, type: "success" });
|
||||||
setShouldPoll(true);
|
setShouldPoll(true);
|
||||||
handlePopUpClose("invalidateCache");
|
handlePopUpClose("invalidateCache");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({ text: `Failed to invalidate ${type} cache`, type: "error" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -60,19 +60,12 @@ export const EncryptionPageForm = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
await updateEncryptionStrategy(formData.encryptionStrategy);
|
await updateEncryptionStrategy(formData.encryptionStrategy);
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Encryption strategy updated successfully"
|
text: "Encryption strategy updated successfully"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to update encryption strategy"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ export const EnvironmentPageForm = () => {
|
|||||||
|
|
||||||
const onSubmit = useCallback(
|
const onSubmit = useCallback(
|
||||||
async (formData: TForm) => {
|
async (formData: TForm) => {
|
||||||
try {
|
|
||||||
const filteredFormData = Object.fromEntries(
|
const filteredFormData = Object.fromEntries(
|
||||||
Object.entries(formData).filter(([, value]) => value !== "")
|
Object.entries(formData).filter(([, value]) => value !== "")
|
||||||
);
|
);
|
||||||
@@ -190,17 +189,6 @@ export const EnvironmentPageForm = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset(formData);
|
reset(formData);
|
||||||
} catch (error) {
|
|
||||||
const errorMessage =
|
|
||||||
(error as any)?.response?.data?.message ||
|
|
||||||
(error as any)?.message ||
|
|
||||||
"An unknown error occurred";
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
title: "Failed to update environment overrides",
|
|
||||||
text: errorMessage
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[reset, updateServerConfig]
|
[reset, updateServerConfig]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ export const GeneralPageForm = () => {
|
|||||||
const organizations = useGetOrganizations();
|
const organizations = useGetOrganizations();
|
||||||
|
|
||||||
const onFormSubmit = async (formData: TDashboardForm) => {
|
const onFormSubmit = async (formData: TDashboardForm) => {
|
||||||
try {
|
|
||||||
const {
|
const {
|
||||||
allowedSignUpDomain,
|
allowedSignUpDomain,
|
||||||
trustSamlEmails,
|
trustSamlEmails,
|
||||||
@@ -92,13 +91,6 @@ export const GeneralPageForm = () => {
|
|||||||
text: "Successfully changed sign up setting.",
|
text: "Successfully changed sign up setting.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to update sign up setting."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export const UsageReportSection = () => {
|
|||||||
const generateUsageReport = useGenerateUsageReport();
|
const generateUsageReport = useGenerateUsageReport();
|
||||||
|
|
||||||
const handleGenerateReport = async () => {
|
const handleGenerateReport = async () => {
|
||||||
try {
|
|
||||||
const response = await generateUsageReport.mutateAsync();
|
const response = await generateUsageReport.mutateAsync();
|
||||||
const { csvContent, filename } = response;
|
const { csvContent, filename } = response;
|
||||||
|
|
||||||
@@ -20,13 +19,6 @@ export const UsageReportSection = () => {
|
|||||||
text: `Usage report downloaded: "${filename}"`,
|
text: `Usage report downloaded: "${filename}"`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to generate usage report:", error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to generate usage report. Please try again.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ const Content = ({ onClose }: ContentProps) => {
|
|||||||
const { users = [] } = data ?? {};
|
const { users = [] } = data ?? {};
|
||||||
|
|
||||||
const onSubmit = async ({ name, invitees }: FormData) => {
|
const onSubmit = async ({ name, invitees }: FormData) => {
|
||||||
try {
|
|
||||||
await createOrg.mutateAsync({
|
await createOrg.mutateAsync({
|
||||||
name,
|
name,
|
||||||
inviteAdminEmails: invitees
|
inviteAdminEmails: invitees
|
||||||
@@ -94,12 +93,6 @@ const Content = ({ onClose }: ContentProps) => {
|
|||||||
text: "Successfully created organization"
|
text: "Successfully created organization"
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const { append } = useFieldArray<FormData>({ control, name: "invitees" });
|
const { append } = useFieldArray<FormData>({ control, name: "invitees" });
|
||||||
|
|||||||
@@ -185,18 +185,11 @@ export const MachineIdentitiesTable = () => {
|
|||||||
const handleRemoveServerAdmin = async () => {
|
const handleRemoveServerAdmin = async () => {
|
||||||
const { id } = popUp?.removeServerAdmin?.data as { id: string; name: string };
|
const { id } = popUp?.removeServerAdmin?.data as { id: string; name: string };
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteIdentitySuperAdminAccess(id);
|
await deleteIdentitySuperAdminAccess(id);
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully removed server admin permissions"
|
text: "Successfully removed server admin permissions"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error removing server admin permissions"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeServerAdmin");
|
handlePopUpClose("removeServerAdmin");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -179,12 +179,6 @@ const ViewMembersModalContent = ({
|
|||||||
text: "Successfully resent org invitation",
|
text: "Successfully resent org invitation",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to resend org invitation",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
setResendInviteId(null);
|
setResendInviteId(null);
|
||||||
}
|
}
|
||||||
@@ -479,7 +473,6 @@ const OrganizationsPanelTable = ({
|
|||||||
const { mutateAsync: accessOrganization } = useServerAdminAccessOrg();
|
const { mutateAsync: accessOrganization } = useServerAdminAccessOrg();
|
||||||
|
|
||||||
const handleAccessOrg = async (orgId: string) => {
|
const handleAccessOrg = async (orgId: string) => {
|
||||||
try {
|
|
||||||
await accessOrganization(orgId);
|
await accessOrganization(orgId);
|
||||||
|
|
||||||
navigate({
|
navigate({
|
||||||
@@ -493,12 +486,6 @@ const OrganizationsPanelTable = ({
|
|||||||
text: "Successfully joined organization",
|
text: "Successfully joined organization",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to join organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -364,18 +364,11 @@ export const UserIdentitiesTable = () => {
|
|||||||
const handleRemoveUser = async () => {
|
const handleRemoveUser = async () => {
|
||||||
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteUser(id);
|
await deleteUser(id);
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully deleted user"
|
text: "Successfully deleted user"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error deleting user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeUser");
|
handlePopUpClose("removeUser");
|
||||||
};
|
};
|
||||||
@@ -383,18 +376,11 @@ export const UserIdentitiesTable = () => {
|
|||||||
const handleGrantServerAdminAccess = async () => {
|
const handleGrantServerAdminAccess = async () => {
|
||||||
const { id } = popUp?.upgradeToServerAdmin?.data as { id: string; username: string };
|
const { id } = popUp?.upgradeToServerAdmin?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
|
||||||
await grantAdminAccess(id);
|
await grantAdminAccess(id);
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully granted server admin access to user"
|
text: "Successfully granted server admin access to user"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error granting server admin access to user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("upgradeToServerAdmin");
|
handlePopUpClose("upgradeToServerAdmin");
|
||||||
};
|
};
|
||||||
@@ -402,24 +388,16 @@ export const UserIdentitiesTable = () => {
|
|||||||
const handleRemoveServerAdminAccess = async () => {
|
const handleRemoveServerAdminAccess = async () => {
|
||||||
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
|
||||||
await removeAdminAccess(id);
|
await removeAdminAccess(id);
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully removed server admin access from user"
|
text: "Successfully removed server admin access from user"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error removing server admin access from user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeServerAdmin");
|
handlePopUpClose("removeServerAdmin");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveUsers = async () => {
|
const handleRemoveUsers = async () => {
|
||||||
try {
|
|
||||||
await deleteUsers(selectedUsers.map((user) => user.id));
|
await deleteUsers(selectedUsers.map((user) => user.id));
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -429,12 +407,6 @@ export const UserIdentitiesTable = () => {
|
|||||||
|
|
||||||
setSelectedUsers([]);
|
setSelectedUsers([]);
|
||||||
handlePopUpClose("removeUsers");
|
handlePopUpClose("removeUsers");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove users",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { useNavigate } from "@tanstack/react-router";
|
|||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
// TODO(akhilmhdh): rewrite this into module functions in lib
|
// TODO(akhilmhdh): rewrite this into module functions in lib
|
||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||||
import { Button, ContentLoader, FormControl, Input } from "@app/components/v2";
|
import { Button, ContentLoader, FormControl, Input } from "@app/components/v2";
|
||||||
@@ -46,7 +45,6 @@ export const SignUpPage = () => {
|
|||||||
const handleFormSubmit = async ({ email, password, firstName, lastName }: TFormSchema) => {
|
const handleFormSubmit = async ({ email, password, firstName, lastName }: TFormSchema) => {
|
||||||
// avoid multi submission
|
// avoid multi submission
|
||||||
if (isSubmitting) return;
|
if (isSubmitting) return;
|
||||||
try {
|
|
||||||
const res = await createAdminUser({
|
const res = await createAdminUser({
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
@@ -62,13 +60,6 @@ export const SignUpPage = () => {
|
|||||||
// Part of migration to nextjs 14
|
// Part of migration to nextjs 14
|
||||||
localStorage.setItem("orgData.id", res.organization.id);
|
localStorage.setItem("orgData.id", res.organization.id);
|
||||||
navigate({ to: "/admin" });
|
navigate({ to: "/admin" });
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to create admin"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config?.initialized) return <ContentLoader text="Redirecting to admin page..." />;
|
if (config?.initialized) return <ContentLoader text="Redirecting to admin page..." />;
|
||||||
|
|||||||
@@ -75,11 +75,7 @@ export const PasswordSetupPage = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} catch (error) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: (error as Error).message ?? "Error setting password"
|
|
||||||
});
|
|
||||||
navigate({ to: "/personal-settings" });
|
navigate({ to: "/personal-settings" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-14
@@ -73,7 +73,6 @@ export const EmailConfirmationStep = ({
|
|||||||
const { mutateAsync: verifyEmailVerificationCode } = useVerifyEmailVerificationCode();
|
const { mutateAsync: verifyEmailVerificationCode } = useVerifyEmailVerificationCode();
|
||||||
|
|
||||||
const checkCode = async () => {
|
const checkCode = async () => {
|
||||||
try {
|
|
||||||
await verifyEmailVerificationCode({ username, code });
|
await verifyEmailVerificationCode({ username, code });
|
||||||
setCodeError(false);
|
setCodeError(false);
|
||||||
|
|
||||||
@@ -102,18 +101,11 @@ export const EmailConfirmationStep = ({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to verify code",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setCode("");
|
setCode("");
|
||||||
};
|
};
|
||||||
|
|
||||||
const resendCode = async () => {
|
const resendCode = async () => {
|
||||||
try {
|
|
||||||
const queryParams = new URLSearchParams(window.location.search);
|
const queryParams = new URLSearchParams(window.location.search);
|
||||||
const token = queryParams.get("token");
|
const token = queryParams.get("token");
|
||||||
if (!token) {
|
if (!token) {
|
||||||
@@ -128,12 +120,6 @@ export const EmailConfirmationStep = ({
|
|||||||
text: "Successfully resent code",
|
text: "Successfully resent code",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to resend code",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ export const PkiAlertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
alertUnit,
|
alertUnit,
|
||||||
emails
|
emails
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
const emailArray = emails
|
const emailArray = emails
|
||||||
@@ -152,13 +151,6 @@ export const PkiAlertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: `Successfully ${alert ? "updated" : "created"} alert`,
|
text: `Successfully ${alert ? "updated" : "created"} alert`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${alert ? "updated" : "created"} alert`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export const PkiAlertsSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveAlertSubmit = async (alertId: string) => {
|
const onRemoveAlertSubmit = async (alertId: string) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
await deletePkiAlert({
|
await deletePkiAlert({
|
||||||
@@ -36,13 +35,6 @@ export const PkiAlertsSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deletePkiAlert");
|
handlePopUpClose("deletePkiAlert");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete alert",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ export const PkiCollectionModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
}, [pkiCollection]);
|
}, [pkiCollection]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name, description }: FormData) => {
|
const onFormSubmit = async ({ name, description }: FormData) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
if (pkiCollection) {
|
if (pkiCollection) {
|
||||||
@@ -98,13 +97,6 @@ export const PkiCollectionModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: `Successfully ${pkiCollection ? "updated" : "created"} PKI collection`,
|
text: `Successfully ${pkiCollection ? "updated" : "created"} PKI collection`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${pkiCollection ? "updated" : "created"} PKI collection`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export const PkiCollectionSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemovePkiCollectionSubmit = async (collectionId: string) => {
|
const onRemovePkiCollectionSubmit = async (collectionId: string) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
await deletePkiCollection({
|
await deletePkiCollection({
|
||||||
@@ -36,13 +35,6 @@ export const PkiCollectionSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deletePkiCollection");
|
handlePopUpClose("deletePkiCollection");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete PKI collection",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ const Page = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCaSubmit = async () => {
|
const onRemoveCaSubmit = async () => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
await deleteCa({
|
await deleteCa({
|
||||||
@@ -78,12 +77,6 @@ const Page = () => {
|
|||||||
projectId
|
projectId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ export const CaRenewalModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
// }, [ca, parentCa]);
|
// }, [ca, parentCa]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ type, notAfter }: FormData) => {
|
const onFormSubmit = async ({ type, notAfter }: FormData) => {
|
||||||
try {
|
|
||||||
if (!projectSlug || !popUpData.caId) return;
|
if (!projectSlug || !popUpData.caId) return;
|
||||||
|
|
||||||
await renewCa({
|
await renewCa({
|
||||||
@@ -102,9 +101,6 @@ export const CaRenewalModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -48,7 +48,6 @@ export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onFormSubmit = async ({ certificate, certificateChain }: FormData) => {
|
const onFormSubmit = async ({ certificate, certificateChain }: FormData) => {
|
||||||
try {
|
|
||||||
if (!csr || !caId || !currentProject?.slug) return;
|
if (!csr || !caId || !currentProject?.slug) return;
|
||||||
|
|
||||||
await importCaCertificate({
|
await importCaCertificate({
|
||||||
@@ -65,12 +64,6 @@ export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
handlePopUpToggle("installCaCert", false);
|
handlePopUpToggle("installCaCert", false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to install certificate for CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const downloadTxtFile = (filename: string, content: string) => {
|
const downloadTxtFile = (filename: string, content: string) => {
|
||||||
|
|||||||
-7
@@ -101,7 +101,6 @@ export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
|
|||||||
}, [parentCa]);
|
}, [parentCa]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ notAfter, maxPathLength }: FormData) => {
|
const onFormSubmit = async ({ notAfter, maxPathLength }: FormData) => {
|
||||||
try {
|
|
||||||
if (!csr || !caId || !currentProject?.slug) return;
|
if (!csr || !caId || !currentProject?.slug) return;
|
||||||
|
|
||||||
const { certificate, certificateChain } = await signIntermediate({
|
const { certificate, certificateChain } = await signIntermediate({
|
||||||
@@ -126,12 +125,6 @@ export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
handlePopUpToggle("installCaCert", false);
|
handlePopUpToggle("installCaCert", false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to install certificate for CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function generatePathLengthOpts(parentCaMaxPathLength: number): number[] {
|
function generatePathLengthOpts(parentCaMaxPathLength: number): number[] {
|
||||||
|
|||||||
@@ -175,7 +175,6 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
status,
|
status,
|
||||||
configuration
|
configuration
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
if (ca) {
|
if (ca) {
|
||||||
@@ -210,13 +209,6 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export const CaSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCaSubmit = async (caName: string) => {
|
const onRemoveCaSubmit = async (caName: string) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
|
await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
|
||||||
@@ -38,16 +37,9 @@ export const CaSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCa");
|
handlePopUpClose("deleteCa");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => {
|
const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
|
await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
|
||||||
@@ -58,13 +50,6 @@ export const CaSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("caStatus");
|
handlePopUpClose("caStatus");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -297,7 +297,6 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
status,
|
status,
|
||||||
configuration: formConfiguration
|
configuration: formConfiguration
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
let configPayload: any;
|
let configPayload: any;
|
||||||
@@ -347,13 +346,6 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-15
@@ -23,7 +23,6 @@ export const ExternalCaSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCaSubmit = async (caName: string, type: CaType) => {
|
const onRemoveCaSubmit = async (caName: string, type: CaType) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.id) return;
|
if (!currentProject?.id) return;
|
||||||
|
|
||||||
await deleteCa({ caName, type, projectId: currentProject.id });
|
await deleteCa({ caName, type, projectId: currentProject.id });
|
||||||
@@ -34,12 +33,6 @@ export const ExternalCaSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCa");
|
handlePopUpClose("deleteCa");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdateCaStatus = async ({
|
const onUpdateCaStatus = async ({
|
||||||
@@ -51,7 +44,6 @@ export const ExternalCaSection = () => {
|
|||||||
type: CaType;
|
type: CaType;
|
||||||
status: CaStatus;
|
status: CaStatus;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
await updateCa({ caName: name, type, status, projectId: currentProject.id });
|
await updateCa({ caName: name, type, status, projectId: currentProject.id });
|
||||||
@@ -62,13 +54,6 @@ export const ExternalCaSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("caStatus");
|
handlePopUpClose("caStatus");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${status === CaStatus.ACTIVE ? "enable" : "disable"} CA`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ export const CertificateImportModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
chainPem,
|
chainPem,
|
||||||
collectionId
|
collectionId
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
const { serialNumber, certificate, certificateChain, privateKey } = await importCertificate({
|
const { serialNumber, certificate, certificateChain, privateKey } = await importCertificate({
|
||||||
@@ -96,13 +95,6 @@ export const CertificateImportModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: "Successfully imported certificate",
|
text: "Successfully imported certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to import certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-12
@@ -243,7 +243,6 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }
|
|||||||
keyUsages,
|
keyUsages,
|
||||||
extendedKeyUsages
|
extendedKeyUsages
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) {
|
if (!currentProject?.slug) {
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Project not found. Please refresh and try again.",
|
text: "Project not found. Please refresh and try again.",
|
||||||
@@ -310,17 +309,6 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }
|
|||||||
text: "Successfully created certificate",
|
text: "Successfully created certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error("Certificate creation failed:", err);
|
|
||||||
const errorMessage =
|
|
||||||
err instanceof Error
|
|
||||||
? err.message
|
|
||||||
: "An unexpected error occurred while creating the certificate";
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to create certificate: ${errorMessage}`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
currentProject?.slug,
|
currentProject?.slug,
|
||||||
|
|||||||
-10
@@ -163,7 +163,6 @@ export const CertificateManageRenewalModal = ({ popUp, handlePopUpToggle }: Prop
|
|||||||
}, [popUp.manageRenewal.isOpen, defaultRenewalDays, reset]);
|
}, [popUp.manageRenewal.isOpen, defaultRenewalDays, reset]);
|
||||||
|
|
||||||
const onUpdateRenewal = async (data: FormData) => {
|
const onUpdateRenewal = async (data: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) {
|
if (!currentProject?.slug) {
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Unable to update auto-renewal: Project not found. Please refresh the page and try again.",
|
text: "Unable to update auto-renewal: Project not found. Please refresh the page and try again.",
|
||||||
@@ -186,15 +185,6 @@ export const CertificateManageRenewalModal = ({ popUp, handlePopUpToggle }: Prop
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("manageRenewal", false);
|
handlePopUpToggle("manageRenewal", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: isAutoRenewalEnabled
|
|
||||||
? "Failed to update auto-renewal configuration. Please check your inputs and try again."
|
|
||||||
: "Failed to enable auto-renewal. Please check your inputs and try again.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getModalTitle = () => {
|
const getModalTitle = () => {
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ export const CertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
keyUsages,
|
keyUsages,
|
||||||
extendedKeyUsages
|
extendedKeyUsages
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
const { serialNumber, certificate, certificateChain, privateKey } = await createCertificate({
|
const { serialNumber, certificate, certificateChain, privateKey } = await createCertificate({
|
||||||
@@ -218,13 +217,6 @@ export const CertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: "Successfully created certificate",
|
text: "Successfully created certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
-8
@@ -61,7 +61,6 @@ export const CertificateRenewalConfigModal = ({ popUp, handlePopUpToggle }: Prop
|
|||||||
const renewBeforeDays = watch("renewBeforeDays");
|
const renewBeforeDays = watch("renewBeforeDays");
|
||||||
|
|
||||||
const onSubmit = async (data: FormData) => {
|
const onSubmit = async (data: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) {
|
if (!currentProject?.slug) {
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Project not found",
|
text: "Project not found",
|
||||||
@@ -82,13 +81,6 @@ export const CertificateRenewalConfigModal = ({ popUp, handlePopUpToggle }: Prop
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("configureRenewal", false);
|
handlePopUpToggle("configureRenewal", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update auto-renewal configuration",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -19,7 +19,6 @@ export const CertificateRenewalDisableModal = ({ popUp, handlePopUpToggle }: Pro
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onDisableConfirm = async () => {
|
const onDisableConfirm = async () => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) {
|
if (!currentProject?.slug) {
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Project not found",
|
text: "Project not found",
|
||||||
@@ -40,13 +39,6 @@ export const CertificateRenewalDisableModal = ({ popUp, handlePopUpToggle }: Pro
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("disableRenewal", false);
|
handlePopUpToggle("disableRenewal", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to disable auto-renewal",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-4
@@ -18,7 +18,6 @@ export const CertificateRenewalModal = ({ popUp, handlePopUpToggle }: Props) =>
|
|||||||
const { mutateAsync: renewCertificate, isPending: isRenewing } = useRenewCertificate();
|
const { mutateAsync: renewCertificate, isPending: isRenewing } = useRenewCertificate();
|
||||||
|
|
||||||
const onRenewConfirm = async () => {
|
const onRenewConfirm = async () => {
|
||||||
try {
|
|
||||||
const { certificateId } = popUp.renewCertificate.data as { certificateId: string };
|
const { certificateId } = popUp.renewCertificate.data as { certificateId: string };
|
||||||
|
|
||||||
await renewCertificate({
|
await renewCertificate({
|
||||||
@@ -31,9 +30,6 @@ export const CertificateRenewalModal = ({ popUp, handlePopUpToggle }: Props) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("renewCertificate", false);
|
handlePopUpToggle("renewCertificate", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const certificateData = popUp.renewCertificate.data as {
|
const certificateData = popUp.renewCertificate.data as {
|
||||||
|
|||||||
-8
@@ -48,7 +48,6 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props)
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onFormSubmit = async ({ revocationReason }: FormData) => {
|
const onFormSubmit = async ({ revocationReason }: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string };
|
const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string };
|
||||||
@@ -66,13 +65,6 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props)
|
|||||||
text: "Successfully revoked certificate",
|
text: "Successfully revoked certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to revoke certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -159,7 +159,6 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
if (certTemplate) {
|
if (certTemplate) {
|
||||||
await updateCertTemplate({
|
await updateCertTemplate({
|
||||||
id: certTemplate.id,
|
id: certTemplate.id,
|
||||||
@@ -215,13 +214,6 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
|
|||||||
|
|
||||||
reset();
|
reset();
|
||||||
handlePopUpToggle("certificateTemplate", false);
|
handlePopUpToggle("certificateTemplate", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to save changes",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -41,7 +41,6 @@ export const CertificateTemplatesSection = ({ caId }: Props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteCertTemplate({
|
await deleteCertTemplate({
|
||||||
id,
|
id,
|
||||||
projectId: currentProject.id
|
projectId: currentProject.id
|
||||||
@@ -53,13 +52,6 @@ export const CertificateTemplatesSection = ({ caId }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCertificateTemplate");
|
handlePopUpClose("deleteCertificateTemplate");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete certificate template",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export const CertificatesSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCertificateSubmit = async (serialNumber: string) => {
|
const onRemoveCertificateSubmit = async (serialNumber: string) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
await deleteCert({ serialNumber, projectSlug: currentProject.slug });
|
await deleteCert({ serialNumber, projectSlug: currentProject.slug });
|
||||||
@@ -53,13 +52,6 @@ export const CertificatesSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCertificate");
|
handlePopUpClose("deleteCertificate");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
}, [caData]);
|
}, [caData]);
|
||||||
|
|
||||||
const handleDisableAutoRenewal = async (certificateId: string, commonName: string) => {
|
const handleDisableAutoRenewal = async (certificateId: string, commonName: string) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) {
|
if (!currentProject?.slug) {
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Unable to disable auto-renewal: Project not found. Please refresh the page and try again.",
|
text: "Unable to disable auto-renewal: Project not found. Please refresh the page and try again.",
|
||||||
@@ -137,13 +136,6 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
text: `Auto-renewal disabled for ${commonName}`,
|
text: `Auto-renewal disabled for ${commonName}`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to disable auto-renewal. Please try again or contact support if the issue persists.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-14
@@ -217,7 +217,6 @@ export const PkiSyncsTable = ({ pkiSyncs }: Props) => {
|
|||||||
|
|
||||||
const isAutoSyncEnabled = !pkiSync.isAutoSyncEnabled;
|
const isAutoSyncEnabled = !pkiSync.isAutoSyncEnabled;
|
||||||
|
|
||||||
try {
|
|
||||||
await updateSync.mutateAsync({
|
await updateSync.mutateAsync({
|
||||||
syncId: pkiSync.id,
|
syncId: pkiSync.id,
|
||||||
projectId: pkiSync.projectId,
|
projectId: pkiSync.projectId,
|
||||||
@@ -229,18 +228,11 @@ export const PkiSyncsTable = ({ pkiSyncs }: Props) => {
|
|||||||
text: `Successfully ${isAutoSyncEnabled ? "enabled" : "disabled"} auto-sync for ${destinationName} Sync`,
|
text: `Successfully ${isAutoSyncEnabled ? "enabled" : "disabled"} auto-sync for ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isAutoSyncEnabled ? "enable" : "disable"} auto-sync for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTriggerSync = async (pkiSync: TPkiSync) => {
|
const handleTriggerSync = async (pkiSync: TPkiSync) => {
|
||||||
const destinationName = PKI_SYNC_MAP[pkiSync.destination].name;
|
const destinationName = PKI_SYNC_MAP[pkiSync.destination].name;
|
||||||
|
|
||||||
try {
|
|
||||||
await triggerSync.mutateAsync({
|
await triggerSync.mutateAsync({
|
||||||
syncId: pkiSync.id,
|
syncId: pkiSync.id,
|
||||||
destination: pkiSync.destination,
|
destination: pkiSync.destination,
|
||||||
@@ -251,12 +243,6 @@ export const PkiSyncsTable = ({ pkiSyncs }: Props) => {
|
|||||||
text: `Successfully triggered ${destinationName} Sync`,
|
text: `Successfully triggered ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -45,7 +45,6 @@ export const PkiCollectionPage = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onDeletePkiCollectionSubmit = async (collectionIdToDelete: string) => {
|
const onDeletePkiCollectionSubmit = async (collectionIdToDelete: string) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
await deletePkiCollection({
|
await deletePkiCollection({
|
||||||
@@ -64,12 +63,6 @@ export const PkiCollectionPage = () => {
|
|||||||
projectId: params.projectId
|
projectId: params.projectId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete PKI collection",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -51,7 +51,6 @@ const Page = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveSubscriberSubmit = async (subscriberNameToDelete: string) => {
|
const onRemoveSubscriberSubmit = async (subscriberNameToDelete: string) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
await deletePkiSubscriber({ subscriberName: subscriberNameToDelete, projectId });
|
await deletePkiSubscriber({ subscriberName: subscriberNameToDelete, projectId });
|
||||||
@@ -68,13 +67,6 @@ const Page = () => {
|
|||||||
projectId
|
projectId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete subscriber",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -70,7 +70,6 @@ export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }:
|
|||||||
useOrderPkiSubscriberCert();
|
useOrderPkiSubscriberCert();
|
||||||
|
|
||||||
const onIssuePkiSubscriberCert = async () => {
|
const onIssuePkiSubscriberCert = async () => {
|
||||||
try {
|
|
||||||
if (pkiSubscriber?.supportsImmediateCertIssuance) {
|
if (pkiSubscriber?.supportsImmediateCertIssuance) {
|
||||||
const response = await issuePkiSubscriberCert({ subscriberName, projectId });
|
const response = await issuePkiSubscriberCert({ subscriberName, projectId });
|
||||||
|
|
||||||
@@ -95,13 +94,6 @@ export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }:
|
|||||||
type: "info"
|
type: "info"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to issue certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const canIssuePkiSubscriberCert = permission.can(
|
const canIssuePkiSubscriberCert = permission.can(
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ export const PkiSubscriberModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
locality,
|
locality,
|
||||||
emailAddress
|
emailAddress
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
if (!caId) {
|
if (!caId) {
|
||||||
@@ -392,13 +391,6 @@ export const PkiSubscriberModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: `Successfully ${pkiSubscriber ? "updated" : "added"} PKI subscriber`,
|
text: `Successfully ${pkiSubscriber ? "updated" : "added"} PKI subscriber`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${pkiSubscriber ? "update" : "add"} PKI subscriber`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-16
@@ -32,7 +32,6 @@ export const PkiSubscriberSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemovePkiSubscriberSubmit = async (subscriberName: string) => {
|
const onRemovePkiSubscriberSubmit = async (subscriberName: string) => {
|
||||||
try {
|
|
||||||
const subscriber = await deletePkiSubscriber({ subscriberName, projectId });
|
const subscriber = await deletePkiSubscriber({ subscriberName, projectId });
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -41,13 +40,6 @@ export const PkiSubscriberSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deletePkiSubscriber");
|
handlePopUpClose("deletePkiSubscriber");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete PKI subscriber",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdatePkiSubscriberStatus = async ({
|
const onUpdatePkiSubscriberStatus = async ({
|
||||||
@@ -57,7 +49,6 @@ export const PkiSubscriberSection = () => {
|
|||||||
subscriberName: string;
|
subscriberName: string;
|
||||||
status: PkiSubscriberStatus;
|
status: PkiSubscriberStatus;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.slug) return;
|
if (!currentProject?.slug) return;
|
||||||
|
|
||||||
await updatePkiSubscriber({ subscriberName, projectId, status });
|
await updatePkiSubscriber({ subscriberName, projectId, status });
|
||||||
@@ -68,13 +59,6 @@ export const PkiSubscriberSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("pkiSubscriberStatus");
|
handlePopUpClose("pkiSubscriberStatus");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${status === PkiSubscriberStatus.ACTIVE ? "enable" : "disable"} subscriber`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const subscriberStatusData = popUp?.pkiSubscriberStatus?.data as {
|
const subscriberStatusData = popUp?.pkiSubscriberStatus?.data as {
|
||||||
|
|||||||
-16
@@ -86,7 +86,6 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
|
|||||||
}, [pkiSync.id, setIsIdCopied]);
|
}, [pkiSync.id, setIsIdCopied]);
|
||||||
|
|
||||||
const handleTriggerSync = useCallback(async () => {
|
const handleTriggerSync = useCallback(async () => {
|
||||||
try {
|
|
||||||
await triggerSyncMutation.mutateAsync({
|
await triggerSyncMutation.mutateAsync({
|
||||||
syncId: id,
|
syncId: id,
|
||||||
destination,
|
destination,
|
||||||
@@ -96,17 +95,9 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
|
|||||||
text: "PKI sync job queued successfully",
|
text: "PKI sync job queued successfully",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to trigger sync:", error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to trigger PKI sync",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [triggerSyncMutation, id, destination, projectId]);
|
}, [triggerSyncMutation, id, destination, projectId]);
|
||||||
|
|
||||||
const handleToggleAutoSync = useCallback(async () => {
|
const handleToggleAutoSync = useCallback(async () => {
|
||||||
try {
|
|
||||||
await updatePkiSyncMutation.mutateAsync({
|
await updatePkiSyncMutation.mutateAsync({
|
||||||
syncId: id,
|
syncId: id,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -117,13 +108,6 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
|
|||||||
text: `Auto-sync ${pkiSync.isAutoSyncEnabled ? "disabled" : "enabled"} successfully`,
|
text: `Auto-sync ${pkiSync.isAutoSyncEnabled ? "disabled" : "enabled"} successfully`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to toggle auto-sync:", error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to toggle auto-sync",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [updatePkiSyncMutation, id, projectId, pkiSync.isAutoSyncEnabled]);
|
}, [updatePkiSyncMutation, id, projectId, pkiSync.isAutoSyncEnabled]);
|
||||||
|
|
||||||
const permissionSubject = subject(ProjectPermissionSub.PkiSyncs, {
|
const permissionSubject = subject(ProjectPermissionSub.PkiSyncs, {
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ export const PkiTemplateListPage = () => {
|
|||||||
const deleteCertTemplate = useDeleteCertTemplateV2();
|
const deleteCertTemplate = useDeleteCertTemplateV2();
|
||||||
|
|
||||||
const onRemovePkiSubscriberSubmit = async () => {
|
const onRemovePkiSubscriberSubmit = async () => {
|
||||||
try {
|
|
||||||
const pkiTemplate = await deleteCertTemplate.mutateAsync({
|
const pkiTemplate = await deleteCertTemplate.mutateAsync({
|
||||||
projectId: currentProject.id,
|
projectId: currentProject.id,
|
||||||
templateName: popUp?.deleteTemplate?.data?.name
|
templateName: popUp?.deleteTemplate?.data?.name
|
||||||
@@ -90,13 +89,6 @@ export const PkiTemplateListPage = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteTemplate");
|
handlePopUpClose("deleteTemplate");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete PKI subscriber",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
if (certTemplate) {
|
if (certTemplate) {
|
||||||
await updateCertTemplate({
|
await updateCertTemplate({
|
||||||
templateName: certTemplate.name,
|
templateName: certTemplate.name,
|
||||||
@@ -182,13 +181,6 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
|
|||||||
|
|
||||||
reset();
|
reset();
|
||||||
handlePopUpToggle(false);
|
handlePopUpToggle(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to save changes",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -51,7 +51,6 @@ export const CertificateProfilesTab = () => {
|
|||||||
const handleDeleteConfirm = async () => {
|
const handleDeleteConfirm = async () => {
|
||||||
if (!selectedProfile) return;
|
if (!selectedProfile) return;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteProfile.mutateAsync({
|
await deleteProfile.mutateAsync({
|
||||||
profileId: selectedProfile.id
|
profileId: selectedProfile.id
|
||||||
});
|
});
|
||||||
@@ -61,12 +60,6 @@ export const CertificateProfilesTab = () => {
|
|||||||
text: `Certificate profile "${selectedProfile.slug}" deleted successfully`,
|
text: `Certificate profile "${selectedProfile.slug}" deleted successfully`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error(
|
|
||||||
`Failed to delete profile "${selectedProfile.slug}" (ID: ${selectedProfile.id}):`,
|
|
||||||
error
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -236,7 +236,6 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
|
|||||||
}, [isEdit, profile, reset]);
|
}, [isEdit, profile, reset]);
|
||||||
|
|
||||||
const onFormSubmit = async (data: FormData) => {
|
const onFormSubmit = async (data: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.id && !isEdit) return;
|
if (!currentProject?.id && !isEdit) return;
|
||||||
|
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
@@ -287,13 +286,6 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
|
|||||||
|
|
||||||
reset();
|
reset();
|
||||||
onClose();
|
onClose();
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error ${isEdit ? "updating" : "creating"} profile:`, error);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isEdit ? "update" : "create"} certificate profile`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -48,7 +48,6 @@ export const CertificateTemplatesV2Tab = () => {
|
|||||||
const handleDeleteConfirm = async () => {
|
const handleDeleteConfirm = async () => {
|
||||||
if (!selectedTemplate) return;
|
if (!selectedTemplate) return;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteTemplateV2.mutateAsync({
|
await deleteTemplateV2.mutateAsync({
|
||||||
templateId: selectedTemplate.id
|
templateId: selectedTemplate.id
|
||||||
});
|
});
|
||||||
@@ -58,13 +57,6 @@ export const CertificateTemplatesV2Tab = () => {
|
|||||||
text: `Certificate template "${selectedTemplate.name}" deleted successfully`,
|
text: `Certificate template "${selectedTemplate.name}" deleted successfully`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to delete template:", error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete certificate template",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -407,7 +407,6 @@ export const CreateTemplateModal = ({ isOpen, onClose, template, mode = "create"
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFormSubmit = async (data: FormData) => {
|
const onFormSubmit = async (data: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentProject?.id && !isEdit) return;
|
if (!currentProject?.id && !isEdit) return;
|
||||||
|
|
||||||
const hasEmptyAttributeValues = data.attributes?.some(
|
const hasEmptyAttributeValues = data.attributes?.some(
|
||||||
@@ -453,13 +452,6 @@ export const CreateTemplateModal = ({ isOpen, onClose, template, mode = "create"
|
|||||||
|
|
||||||
reset();
|
reset();
|
||||||
onClose();
|
onClose();
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error ${isEdit ? "updating" : "creating"} template:`, error);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isEdit ? "update" : "create"} certificate template`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const addAttribute = () => {
|
const addAttribute = () => {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export const DeleteKmipClientModal = ({ isOpen, onOpenChange, kmipClient }: Prop
|
|||||||
const { id, projectId, name } = kmipClient;
|
const { id, projectId, name } = kmipClient;
|
||||||
|
|
||||||
const handleDeleteKmipClient = async () => {
|
const handleDeleteKmipClient = async () => {
|
||||||
try {
|
|
||||||
await deleteKmipClients.mutateAsync({
|
await deleteKmipClients.mutateAsync({
|
||||||
id,
|
id,
|
||||||
projectId
|
projectId
|
||||||
@@ -29,16 +28,6 @@ export const DeleteKmipClientModal = ({ isOpen, onOpenChange, kmipClient }: Prop
|
|||||||
});
|
});
|
||||||
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to delete KMIP client";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -98,20 +98,12 @@ const KmipClientForm = ({ onComplete, kmipClient }: FormProps) => {
|
|||||||
.map(([key]) => key as KmipPermission)
|
.map(([key]) => key as KmipPermission)
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
|
||||||
await mutation;
|
await mutation;
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully ${isUpdate ? "updated" : "added"} KMIP client`,
|
text: `Successfully ${isUpdate ? "updated" : "added"} KMIP client`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "add"} KMIP client`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ const DecryptForm = ({ cmek }: FormProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleDecryptData = async (formData: FormData) => {
|
const handleDecryptData = async (formData: FormData) => {
|
||||||
try {
|
|
||||||
const data = await cmekDecrypt.mutateAsync({ ...formData, keyId: cmek.id });
|
const data = await cmekDecrypt.mutateAsync({ ...formData, keyId: cmek.id });
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully decrypted data",
|
text: "Successfully decrypted data",
|
||||||
@@ -62,13 +61,6 @@ const DecryptForm = ({ cmek }: FormProps) => {
|
|||||||
setPlaintext(
|
setPlaintext(
|
||||||
shouldDecode ? Buffer.from(decodeBase64(data.plaintext)).toString("utf8") : data.plaintext
|
shouldDecode ? Buffer.from(decodeBase64(data.plaintext)).toString("utf8") : data.plaintext
|
||||||
);
|
);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to decrypt data",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -53,19 +53,11 @@ const EncryptForm = ({ cmek }: FormProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleEncryptData = async (formData: FormData) => {
|
const handleEncryptData = async (formData: FormData) => {
|
||||||
try {
|
|
||||||
await cmekEncrypt.mutateAsync({ ...formData, keyId: cmek.id });
|
await cmekEncrypt.mutateAsync({ ...formData, keyId: cmek.id });
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully encrypted data",
|
text: "Successfully encrypted data",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to encrypt data",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ciphertext = cmekEncrypt.data?.ciphertext;
|
const ciphertext = cmekEncrypt.data?.ciphertext;
|
||||||
|
|||||||
@@ -86,20 +86,12 @@ const CmekForm = ({ onComplete, cmek }: FormProps) => {
|
|||||||
encryptionAlgorithm: encryptionAlgorithm as AsymmetricKeyAlgorithm | SymmetricKeyAlgorithm
|
encryptionAlgorithm: encryptionAlgorithm as AsymmetricKeyAlgorithm | SymmetricKeyAlgorithm
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
|
||||||
await mutation;
|
await mutation;
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully ${isUpdate ? "updated" : "added"} key`,
|
text: `Successfully ${isUpdate ? "updated" : "added"} key`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "add"} key`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectedKeyUsage = watch("keyUsage");
|
const selectedKeyUsage = watch("keyUsage");
|
||||||
|
|||||||
@@ -59,19 +59,11 @@ const SignForm = ({ cmek }: FormProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleSignData = async (formData: FormData) => {
|
const handleSignData = async (formData: FormData) => {
|
||||||
try {
|
|
||||||
await cmekSign.mutateAsync({ ...formData, keyId: cmek.id });
|
await cmekSign.mutateAsync({ ...formData, keyId: cmek.id });
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully signed data",
|
text: "Successfully signed data",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to sign data",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const signature = cmekSign.data?.signature;
|
const signature = cmekSign.data?.signature;
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ export const CmekTable = () => {
|
|||||||
const updateCmek = useUpdateCmek();
|
const updateCmek = useUpdateCmek();
|
||||||
|
|
||||||
const handleDisableCmek = async ({ id: keyId, isDisabled }: TCmek) => {
|
const handleDisableCmek = async ({ id: keyId, isDisabled }: TCmek) => {
|
||||||
try {
|
|
||||||
await updateCmek.mutateAsync({
|
await updateCmek.mutateAsync({
|
||||||
keyId,
|
keyId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -163,17 +162,6 @@ export const CmekTable = () => {
|
|||||||
text: `Key successfully ${isDisabled ? "enabled" : "disabled"}`,
|
text: `Key successfully ${isDisabled ? "enabled" : "disabled"}`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text =
|
|
||||||
error?.response?.data?.message ?? `Failed to ${isDisabled ? "enable" : "disable"} key`;
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const cannotEditKey = permission.cannot(
|
const cannotEditKey = permission.cannot(
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ const VerifyForm = ({ cmek }: FormProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleVerifyData = async (formData: FormData) => {
|
const handleVerifyData = async (formData: FormData) => {
|
||||||
try {
|
|
||||||
const result = await cmekVerify.mutateAsync({ ...formData, keyId: cmek.id });
|
const result = await cmekVerify.mutateAsync({ ...formData, keyId: cmek.id });
|
||||||
|
|
||||||
if (result.signatureValid) {
|
if (result.signatureValid) {
|
||||||
@@ -84,13 +83,6 @@ const VerifyForm = ({ cmek }: FormProps) => {
|
|||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to sign data",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const signature = watch("signature");
|
const signature = watch("signature");
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export const DeleteCmekModal = ({ isOpen, onOpenChange, cmek }: Props) => {
|
|||||||
const { id: keyId, projectId, name } = cmek;
|
const { id: keyId, projectId, name } = cmek;
|
||||||
|
|
||||||
const handleDeleteCmek = async () => {
|
const handleDeleteCmek = async () => {
|
||||||
try {
|
|
||||||
await deleteCmek.mutateAsync({
|
await deleteCmek.mutateAsync({
|
||||||
keyId,
|
keyId,
|
||||||
projectId
|
projectId
|
||||||
@@ -28,16 +27,6 @@ export const DeleteCmekModal = ({ isOpen, onOpenChange, cmek }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to delete key";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -74,7 +74,6 @@ export const OrgGroupModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Pr
|
|||||||
}, [popUp?.group?.data, roles]);
|
}, [popUp?.group?.data, roles]);
|
||||||
|
|
||||||
const onGroupModalSubmit = async ({ name, slug, role }: TGroupFormData) => {
|
const onGroupModalSubmit = async ({ name, slug, role }: TGroupFormData) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
|
|
||||||
const group = popUp?.group?.data as {
|
const group = popUp?.group?.data as {
|
||||||
@@ -105,12 +104,6 @@ export const OrgGroupModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Pr
|
|||||||
text: `Successfully ${popUp?.group?.data ? "updated" : "created"} group`,
|
text: `Successfully ${popUp?.group?.data ? "updated" : "created"} group`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${popUp?.group?.data ? "updated" : "created"} group`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -36,7 +36,6 @@ export const OrgGroupsSection = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onDeleteGroupSubmit = async ({ name, groupId }: { name: string; groupId: string }) => {
|
const onDeleteGroupSubmit = async ({ name, groupId }: { name: string; groupId: string }) => {
|
||||||
try {
|
|
||||||
await deleteMutateAsync({
|
await deleteMutateAsync({
|
||||||
id: groupId
|
id: groupId
|
||||||
});
|
});
|
||||||
@@ -44,13 +43,6 @@ export const OrgGroupsSection = () => {
|
|||||||
text: `Successfully deleted the group named ${name}`,
|
text: `Successfully deleted the group named ${name}`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete the group named ${name}`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("deleteGroup");
|
handlePopUpClose("deleteGroup");
|
||||||
};
|
};
|
||||||
|
|||||||
-8
@@ -79,7 +79,6 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
const { data: roles } = useGetOrgRoles(orgId);
|
const { data: roles } = useGetOrgRoles(orgId);
|
||||||
|
|
||||||
const handleChangeRole = async ({ id, role }: { id: string; role: string }) => {
|
const handleChangeRole = async ({ id, role }: { id: string; role: string }) => {
|
||||||
try {
|
|
||||||
await updateMutateAsync({
|
await updateMutateAsync({
|
||||||
id,
|
id,
|
||||||
role
|
role
|
||||||
@@ -89,13 +88,6 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
text: "Successfully updated group role",
|
text: "Successfully updated group role",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update group role",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
-7
@@ -140,7 +140,6 @@ export const IdentityAliCloudAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -173,12 +172,6 @@ export const IdentityAliCloudAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-12
@@ -103,7 +103,6 @@ export const IdentityAuthTemplateModal = ({ popUp, handlePopUpToggle }: Props) =
|
|||||||
const selectedMethod = watch("method");
|
const selectedMethod = watch("method");
|
||||||
|
|
||||||
const onFormSubmit = async (data: FormData) => {
|
const onFormSubmit = async (data: FormData) => {
|
||||||
try {
|
|
||||||
if (isEdit && template) {
|
if (isEdit && template) {
|
||||||
await updateTemplate({
|
await updateTemplate({
|
||||||
templateId: template.id,
|
templateId: template.id,
|
||||||
@@ -142,17 +141,6 @@ export const IdentityAuthTemplateModal = ({ popUp, handlePopUpToggle }: Props) =
|
|||||||
|
|
||||||
handlePopUpToggle(isEdit ? "editTemplate" : "createTemplate", false);
|
handlePopUpToggle(isEdit ? "editTemplate" : "createTemplate", false);
|
||||||
reset();
|
reset();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text =
|
|
||||||
error?.response?.data?.message ?? `Failed to ${isEdit ? "update" : "create"} auth template`;
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
|||||||
-7
@@ -150,7 +150,6 @@ export const IdentityAwsAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -187,12 +186,6 @@ export const IdentityAwsAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -146,7 +146,6 @@ export const IdentityAzureAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -183,12 +182,6 @@ export const IdentityAzureAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -155,7 +155,6 @@ export const IdentityGcpAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -194,12 +193,6 @@ export const IdentityGcpAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -220,7 +220,6 @@ export const IdentityJwtAuthForm = ({
|
|||||||
boundClaims,
|
boundClaims,
|
||||||
boundSubject
|
boundSubject
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) {
|
if (!identityId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -269,12 +268,6 @@ export const IdentityJwtAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -314,7 +314,6 @@ export const IdentityKubernetesAuthForm = ({
|
|||||||
tokenReviewMode,
|
tokenReviewMode,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -373,12 +372,6 @@ export const IdentityKubernetesAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const tokenReviewMode = watch("tokenReviewMode");
|
const tokenReviewMode = watch("tokenReviewMode");
|
||||||
|
|||||||
-7
@@ -316,7 +316,6 @@ export const IdentityLdapAuthForm = ({
|
|||||||
}, [subscription, handlePopUpOpen, handlePopUpToggle]);
|
}, [subscription, handlePopUpOpen, handlePopUpToggle]);
|
||||||
|
|
||||||
const onFormSubmit = async (formData: FormData) => {
|
const onFormSubmit = async (formData: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -387,12 +386,6 @@ export const IdentityLdapAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-11
@@ -42,7 +42,6 @@ export const IdentityLinkForm = ({ onClose }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onFormSubmit = async ({ identity, role }: FormData) => {
|
const onFormSubmit = async ({ identity, role }: FormData) => {
|
||||||
try {
|
|
||||||
await createMutateAsync({
|
await createMutateAsync({
|
||||||
identityId: identity.id,
|
identityId: identity.id,
|
||||||
roles: [{ role: role.slug, isTemporary: false }]
|
roles: [{ role: role.slug, isTemporary: false }]
|
||||||
@@ -57,16 +56,6 @@ export const IdentityLinkForm = ({ onClose }: Props) => {
|
|||||||
identityId: identity.id
|
identityId: identity.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to link identity";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-13
@@ -108,7 +108,6 @@ export const IdentityModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
}, [popUp?.identity?.data, roles]);
|
}, [popUp?.identity?.data, roles]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name, role, metadata, hasDeleteProtection }: FormData) => {
|
const onFormSubmit = async ({ name, role, metadata, hasDeleteProtection }: FormData) => {
|
||||||
try {
|
|
||||||
const identity = popUp?.identity?.data as {
|
const identity = popUp?.identity?.data as {
|
||||||
identityId: string;
|
identityId: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -171,18 +170,6 @@ export const IdentityModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text =
|
|
||||||
error?.response?.data?.message ??
|
|
||||||
`Failed to ${popUp?.identity?.data ? "update" : "create"} identity`;
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -152,7 +152,6 @@ export const IdentityOciAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -187,12 +186,6 @@ export const IdentityOciAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -204,7 +204,6 @@ export const IdentityOidcAuthForm = ({
|
|||||||
claimMetadataMapping,
|
claimMetadataMapping,
|
||||||
boundSubject
|
boundSubject
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) {
|
if (!identityId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -255,12 +254,6 @@ export const IdentityOidcAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-22
@@ -56,7 +56,6 @@ export const IdentitySection = withPermission(
|
|||||||
const isEnterprise = subscription?.slug === "enterprise";
|
const isEnterprise = subscription?.slug === "enterprise";
|
||||||
|
|
||||||
const onDeleteIdentitySubmit = async (identityId: string) => {
|
const onDeleteIdentitySubmit = async (identityId: string) => {
|
||||||
try {
|
|
||||||
await deleteMutateAsync({
|
await deleteMutateAsync({
|
||||||
identityId,
|
identityId,
|
||||||
organizationId: orgId
|
organizationId: orgId
|
||||||
@@ -68,20 +67,9 @@ export const IdentitySection = withPermission(
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteIdentity");
|
handlePopUpClose("deleteIdentity");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to delete identity";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDeleteTemplateSubmit = async (templateId: string) => {
|
const onDeleteTemplateSubmit = async (templateId: string) => {
|
||||||
try {
|
|
||||||
await deleteTemplateMutateAsync({
|
await deleteTemplateMutateAsync({
|
||||||
templateId,
|
templateId,
|
||||||
organizationId: orgId
|
organizationId: orgId
|
||||||
@@ -93,16 +81,6 @@ export const IdentitySection = withPermission(
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteTemplate");
|
handlePopUpClose("deleteTemplate");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to delete template";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user