mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 16:28:40 +00:00
refactor: streamline error handling and notification logic across various components
This commit is contained in:
@@ -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 () => {
|
||||||
|
|||||||
-11
@@ -145,7 +145,6 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeRole = async ({ identityId, role }: { identityId: string; role: string }) => {
|
const handleChangeRole = async ({ identityId, role }: { identityId: string; role: string }) => {
|
||||||
try {
|
|
||||||
await updateMutateAsync({
|
await updateMutateAsync({
|
||||||
identityId,
|
identityId,
|
||||||
role,
|
role,
|
||||||
@@ -156,16 +155,6 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
text: "Successfully updated identity role",
|
text: "Successfully updated identity role",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to update identity role";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRoleToggle = useCallback(
|
const handleRoleToggle = useCallback(
|
||||||
|
|||||||
-7
@@ -134,7 +134,6 @@ export const IdentityTlsCertAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -169,12 +168,6 @@ export const IdentityTlsCertAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -127,7 +127,6 @@ export const IdentityTokenAuthForm = ({
|
|||||||
accessTokenNumUsesLimit,
|
accessTokenNumUsesLimit,
|
||||||
accessTokenTrustedIps
|
accessTokenTrustedIps
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -158,12 +157,6 @@ export const IdentityTokenAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-9
@@ -220,7 +220,6 @@ export const IdentityUniversalAuthForm = ({
|
|||||||
lockoutCounterResetValue,
|
lockoutCounterResetValue,
|
||||||
lockoutCounterResetUnit
|
lockoutCounterResetUnit
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
|
||||||
if (!identityId) return;
|
if (!identityId) return;
|
||||||
|
|
||||||
const lockoutDurationSeconds = ms(`${lockoutDurationValue}${lockoutDurationUnit}`) / 1000;
|
const lockoutDurationSeconds = ms(`${lockoutDurationValue}${lockoutDurationUnit}`) / 1000;
|
||||||
@@ -270,14 +269,6 @@ export const IdentityUniversalAuthForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
const text = `Failed to ${isUpdate ? "update" : "configure"} identity`;
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-9
@@ -122,7 +122,6 @@ export const AddOrgMemberModal = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const parsedEmails = emails
|
const parsedEmails = emails
|
||||||
.replace(/\s/g, "")
|
.replace(/\s/g, "")
|
||||||
.split(",")
|
.split(",")
|
||||||
@@ -171,14 +170,6 @@ export const AddOrgMemberModal = ({
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to invite user to org",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serverDetails?.emailConfigured) {
|
if (serverDetails?.emailConfigured) {
|
||||||
handlePopUpToggle("addMember", false);
|
handlePopUpToggle("addMember", false);
|
||||||
|
|||||||
-8
@@ -106,7 +106,6 @@ export const AddSubOrgMemberModal = ({ onClose }: Props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const usernames = users.map((el) => el.username);
|
const usernames = users.map((el) => el.username);
|
||||||
await addUsersMutateAsync({
|
await addUsersMutateAsync({
|
||||||
organizationId: currentOrg?.id,
|
organizationId: currentOrg?.id,
|
||||||
@@ -125,13 +124,6 @@ export const AddSubOrgMemberModal = ({ onClose }: Props) => {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
onClose();
|
onClose();
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to add user to suborganization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGroupHeaderLabel = (type: ProjectType) => {
|
const getGroupHeaderLabel = (type: ProjectType) => {
|
||||||
|
|||||||
-7
@@ -44,7 +44,6 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
|
|||||||
acknowledgesPermanentChange;
|
acknowledgesPermanentChange;
|
||||||
|
|
||||||
const handlePrivilegeSystemUpgrade = async () => {
|
const handlePrivilegeSystemUpgrade = async () => {
|
||||||
try {
|
|
||||||
await upgradePrivilegeSystem();
|
await upgradePrivilegeSystem();
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -53,12 +52,6 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to upgrade privilege system",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
|||||||
-9
@@ -18,7 +18,6 @@ export const DeleteAppConnectionModal = ({ isOpen, onOpenChange, appConnection }
|
|||||||
const { id: connectionId, name, app } = appConnection;
|
const { id: connectionId, name, app } = appConnection;
|
||||||
|
|
||||||
const handleDeleteAppConnection = async () => {
|
const handleDeleteAppConnection = async () => {
|
||||||
try {
|
|
||||||
await deleteAppConnection.mutateAsync({
|
await deleteAppConnection.mutateAsync({
|
||||||
connectionId,
|
connectionId,
|
||||||
app
|
app
|
||||||
@@ -30,14 +29,6 @@ export const DeleteAppConnectionModal = ({ isOpen, onOpenChange, appConnection }
|
|||||||
});
|
});
|
||||||
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to remove ${APP_CONNECTION_MAP[app].name} connection`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-9
@@ -43,7 +43,6 @@ const Content = ({ appConnection, onComplete }: ContentProps) => {
|
|||||||
} = form;
|
} = form;
|
||||||
|
|
||||||
const onSubmit = async (formData: FormData) => {
|
const onSubmit = async (formData: FormData) => {
|
||||||
try {
|
|
||||||
await updateAppConnection.mutateAsync({
|
await updateAppConnection.mutateAsync({
|
||||||
connectionId: appConnection.id,
|
connectionId: appConnection.id,
|
||||||
...formData
|
...formData
|
||||||
@@ -53,14 +52,6 @@ const Content = ({ appConnection, onComplete }: ContentProps) => {
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to update ${appName} Connection`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+8
-48
@@ -127,12 +127,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
projectId,
|
projectId,
|
||||||
connection
|
connection
|
||||||
};
|
};
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} GitLab Connection`,
|
|
||||||
text: err?.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -176,12 +171,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} Azure Key Vault Connection`,
|
|
||||||
text: err?.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -233,12 +223,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} Azure App Configuration Connection`,
|
|
||||||
text: err?.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -290,12 +275,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} Azure Client Secrets Connection`,
|
|
||||||
text: err?.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -353,12 +333,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} Azure DevOps Connection`,
|
|
||||||
text: err?.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -441,12 +416,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} GitHub Connection`,
|
|
||||||
text: e.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -498,12 +468,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} GitHub Radar Connection`,
|
|
||||||
text: e.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
@@ -553,12 +518,7 @@ export const OAuthCallbackPage = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${connectionId ? "update" : "add"} Heroku Connection`,
|
|
||||||
text: e.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
navigate({
|
navigate({
|
||||||
to: returnUrl,
|
to: returnUrl,
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
-8
@@ -35,7 +35,6 @@ export const CompanyNameSection = () => {
|
|||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name }: { name: string }) => {
|
const onFormSubmit = async ({ name }: { name: string }) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
if (name === "") return;
|
if (name === "") return;
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
@@ -47,13 +46,6 @@ export const CompanyNameSection = () => {
|
|||||||
text: "Successfully updated business name",
|
text: "Successfully updated business name",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update business name",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -35,7 +35,6 @@ export const InvoiceEmailSection = () => {
|
|||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ email }: { email: string }) => {
|
const onFormSubmit = async ({ email }: { email: string }) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
if (email === "") return;
|
if (email === "") return;
|
||||||
|
|
||||||
@@ -48,13 +47,6 @@ export const InvoiceEmailSection = () => {
|
|||||||
text: "Successfully updated invoice email recipient",
|
text: "Successfully updated invoice email recipient",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update invoice email recipient",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -39,7 +39,6 @@ export const PmtMethodsTable = () => {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
await deleteOrgPmtMethod.mutateAsync({
|
await deleteOrgPmtMethod.mutateAsync({
|
||||||
organizationId: currentOrg.id,
|
organizationId: currentOrg.id,
|
||||||
pmtMethodId: pmtMethodToRemove.id
|
pmtMethodId: pmtMethodToRemove.id
|
||||||
@@ -49,12 +48,6 @@ export const PmtMethodsTable = () => {
|
|||||||
text: "Successfully removed payment method"
|
text: "Successfully removed payment method"
|
||||||
});
|
});
|
||||||
handlePopUpClose("removeCard");
|
handlePopUpClose("removeCard");
|
||||||
} catch (error: any) {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: error.message ?? "Error removing payment method"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -98,7 +98,6 @@ export const TaxIDModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onTaxIDModalSubmit = async ({ type, value }: AddTaxIDFormData) => {
|
const onTaxIDModalSubmit = async ({ type, value }: AddTaxIDFormData) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
await addOrgTaxId.mutateAsync({
|
await addOrgTaxId.mutateAsync({
|
||||||
organizationId: currentOrg.id,
|
organizationId: currentOrg.id,
|
||||||
@@ -111,13 +110,6 @@ export const TaxIDModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
handlePopUpClose("addTaxID");
|
handlePopUpClose("addTaxID");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to add Tax ID",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ const Page = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onDeleteGroupSubmit = async ({ name, id }: { name: string; id: string }) => {
|
const onDeleteGroupSubmit = async ({ name, id }: { name: string; id: string }) => {
|
||||||
try {
|
|
||||||
await deleteMutateAsync({
|
await deleteMutateAsync({
|
||||||
id
|
id
|
||||||
});
|
});
|
||||||
@@ -70,13 +69,6 @@ const Page = () => {
|
|||||||
selectedTab: TabSections.Groups
|
selectedTab: TabSections.Groups
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete the ${name} group`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("deleteGroup");
|
handlePopUpClose("deleteGroup");
|
||||||
};
|
};
|
||||||
|
|||||||
-7
@@ -63,7 +63,6 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
const { mutateAsync: addUserToGroupMutateAsync } = useAddUserToGroup();
|
const { mutateAsync: addUserToGroupMutateAsync } = useAddUserToGroup();
|
||||||
|
|
||||||
const handleAddMember = async (username: string) => {
|
const handleAddMember = async (username: string) => {
|
||||||
try {
|
|
||||||
if (!popUpData?.slug) {
|
if (!popUpData?.slug) {
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Some data is missing, please refresh the page and try again",
|
text: "Some data is missing, please refresh the page and try again",
|
||||||
@@ -82,12 +81,6 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
text: "Successfully assigned user to the group",
|
text: "Successfully assigned user to the group",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to assign user to the group",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -29,7 +29,6 @@ export const GroupMembersSection = ({ groupId, groupSlug }: Props) => {
|
|||||||
|
|
||||||
const { mutateAsync: removeUserFromGroupMutateAsync } = useRemoveUserFromGroup();
|
const { mutateAsync: removeUserFromGroupMutateAsync } = useRemoveUserFromGroup();
|
||||||
const handleRemoveUserFromGroup = async (username: string) => {
|
const handleRemoveUserFromGroup = async (username: string) => {
|
||||||
try {
|
|
||||||
await removeUserFromGroupMutateAsync({
|
await removeUserFromGroupMutateAsync({
|
||||||
groupId,
|
groupId,
|
||||||
username,
|
username,
|
||||||
@@ -42,12 +41,6 @@ export const GroupMembersSection = ({ groupId, groupSlug }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("removeMemberFromGroup", false);
|
handlePopUpToggle("removeMemberFromGroup", false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to remove user ${username} from the group`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-11
@@ -75,7 +75,6 @@ const Content = ({ identityId, handlePopUpToggle }: Omit<Props, "popUp">) => {
|
|||||||
}, [workspaces, projectMemberships]);
|
}, [workspaces, projectMemberships]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ project: selectedProject, role }: FormData) => {
|
const onFormSubmit = async ({ project: selectedProject, role }: FormData) => {
|
||||||
try {
|
|
||||||
await addIdentityToWorkspace({
|
await addIdentityToWorkspace({
|
||||||
projectId: selectedProject.id,
|
projectId: selectedProject.id,
|
||||||
identityId,
|
identityId,
|
||||||
@@ -89,16 +88,6 @@ const Content = ({ identityId, handlePopUpToggle }: Omit<Props, "popUp">) => {
|
|||||||
|
|
||||||
reset();
|
reset();
|
||||||
handlePopUpToggle("addIdentityToProject", false);
|
handlePopUpToggle("addIdentityToProject", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to add identity to project";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isProjectSelected = Boolean(projectId);
|
const isProjectSelected = Boolean(projectId);
|
||||||
|
|||||||
-11
@@ -22,7 +22,6 @@ export const IdentityProjectsSection = ({ identityId }: Props) => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveIdentitySubmit = async (id: string, projectId: string) => {
|
const onRemoveIdentitySubmit = async (id: string, projectId: string) => {
|
||||||
try {
|
|
||||||
await deleteMutateAsync({
|
await deleteMutateAsync({
|
||||||
identityId: id,
|
identityId: id,
|
||||||
projectId
|
projectId
|
||||||
@@ -34,16 +33,6 @@ export const IdentityProjectsSection = ({ identityId }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("removeIdentityFromProject");
|
handlePopUpClose("removeIdentityFromProject");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to remove identity from project";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-13
@@ -72,7 +72,6 @@ export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
}, [popUp?.token?.data]);
|
}, [popUp?.token?.data]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name }: FormData) => {
|
const onFormSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
|
||||||
if (tokenData?.tokenId) {
|
if (tokenData?.tokenId) {
|
||||||
// update
|
// update
|
||||||
|
|
||||||
@@ -100,18 +99,6 @@ export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text =
|
|
||||||
error?.response?.data?.message ??
|
|
||||||
`Failed to ${popUp?.token?.data ? "update" : "create"} token`;
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+2
-10
@@ -31,8 +31,7 @@ export const LockoutFields = ({
|
|||||||
|
|
||||||
const [lockedOutState, setLockedOutState] = useState(lockedOut);
|
const [lockedOutState, setLockedOutState] = useState(lockedOut);
|
||||||
|
|
||||||
async function clearLockouts() {
|
const clearLockouts = async () => {
|
||||||
try {
|
|
||||||
const deleted = await mutateAsync({ identityId });
|
const deleted = await mutateAsync({ identityId });
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully cleared ${deleted} lockout${deleted === 1 ? "" : "s"}`,
|
text: `Successfully cleared ${deleted} lockout${deleted === 1 ? "" : "s"}`,
|
||||||
@@ -40,14 +39,7 @@ export const LockoutFields = ({
|
|||||||
});
|
});
|
||||||
setLockedOutState(false);
|
setLockedOutState(false);
|
||||||
onResetAllLockouts();
|
onResetAllLockouts();
|
||||||
} catch (error) {
|
};
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to clear lockouts. Please try again.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
-11
@@ -51,7 +51,6 @@ export const IdentityTokenAuthTokensTable = ({ tokens, identityId }: Props) => {
|
|||||||
tokenId: string;
|
tokenId: string;
|
||||||
name: string;
|
name: string;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
|
||||||
await revokeToken({
|
await revokeToken({
|
||||||
identityId: parentIdentityId,
|
identityId: parentIdentityId,
|
||||||
tokenId
|
tokenId
|
||||||
@@ -63,16 +62,6 @@ export const IdentityTokenAuthTokensTable = ({ tokens, identityId }: Props) => {
|
|||||||
text: `Successfully revoked token ${name ?? ""}`,
|
text: `Successfully revoked token ${name ?? ""}`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to revoke token";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -43,7 +43,6 @@ export const IdentityUniversalAuthClientSecretsTable = ({ clientSecrets, identit
|
|||||||
const { mutateAsync: revokeClientSecret } = useRevokeIdentityUniversalAuthClientSecret();
|
const { mutateAsync: revokeClientSecret } = useRevokeIdentityUniversalAuthClientSecret();
|
||||||
|
|
||||||
const onDeleteClientSecretSubmit = async (clientSecretId: string) => {
|
const onDeleteClientSecretSubmit = async (clientSecretId: string) => {
|
||||||
try {
|
|
||||||
await revokeClientSecret({
|
await revokeClientSecret({
|
||||||
identityId,
|
identityId,
|
||||||
clientSecretId
|
clientSecretId
|
||||||
@@ -55,13 +54,6 @@ export const IdentityUniversalAuthClientSecretsTable = ({ clientSecrets, identit
|
|||||||
text: "Successfully deleted client secret",
|
text: "Successfully deleted client secret",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete client secret",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -140,7 +140,6 @@ export const Content = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleDeleteAuthMethod = async () => {
|
const handleDeleteAuthMethod = async () => {
|
||||||
try {
|
|
||||||
await revokeMethod({
|
await revokeMethod({
|
||||||
identityId,
|
identityId,
|
||||||
organizationId: orgId
|
organizationId: orgId
|
||||||
@@ -150,15 +149,8 @@ export const Content = ({
|
|||||||
text: "Successfully removed auth method",
|
text: "Successfully removed auth method",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("revokeAuthMethod", false);
|
handlePopUpToggle("revokeAuthMethod", false);
|
||||||
onDeleteAuthMethod();
|
onDeleteAuthMethod();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove auth method",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+1
-6
@@ -168,12 +168,7 @@ export const GatewayCliDeploymentMethod = () => {
|
|||||||
type: "info"
|
type: "info"
|
||||||
});
|
});
|
||||||
setStep("command");
|
setStep("command");
|
||||||
} catch (err) {
|
} catch {
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to generate token for the selected identity",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
setIdentityToken("");
|
setIdentityToken("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-6
@@ -141,12 +141,7 @@ export const RelayCliDeploymentMethod = () => {
|
|||||||
type: "info"
|
type: "info"
|
||||||
});
|
});
|
||||||
setStep("command");
|
setStep("command");
|
||||||
} catch (err) {
|
} catch {
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to generate token for the selected identity",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
setIdentityToken("");
|
setIdentityToken("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { useNavigate } from "@tanstack/react-router";
|
|||||||
import { CheckIcon } from "lucide-react";
|
import { CheckIcon } from "lucide-react";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
import { OrgPermissionCan } from "@app/components/permissions";
|
import { OrgPermissionCan } from "@app/components/permissions";
|
||||||
import { RequestProjectAccessModal } from "@app/components/projects/RequestProjectAccessModal";
|
import { RequestProjectAccessModal } from "@app/components/projects/RequestProjectAccessModal";
|
||||||
import {
|
import {
|
||||||
@@ -103,7 +102,6 @@ export const AllProjectView = ({
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
environments: ProjectEnv[]
|
environments: ProjectEnv[]
|
||||||
) => {
|
) => {
|
||||||
try {
|
|
||||||
await orgAdminAccessProject.mutateAsync({
|
await orgAdminAccessProject.mutateAsync({
|
||||||
projectId
|
projectId
|
||||||
});
|
});
|
||||||
@@ -113,12 +111,6 @@ export const AllProjectView = ({
|
|||||||
projectId
|
projectId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to access project",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useResetPageHelper({
|
useResetPageHelper({
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
import { OrgPermissionCan } from "@app/components/permissions";
|
import { OrgPermissionCan } from "@app/components/permissions";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -158,34 +157,20 @@ export const MyProjectView = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const addProjectToFavorites = async (projectId: string) => {
|
const addProjectToFavorites = async (projectId: string) => {
|
||||||
try {
|
|
||||||
if (currentOrg?.id) {
|
if (currentOrg?.id) {
|
||||||
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 {
|
|
||||||
if (currentOrg?.id) {
|
if (currentOrg?.id) {
|
||||||
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 renderProjectGridItem = (workspace: Project, isFavorite: boolean) => (
|
const renderProjectGridItem = (workspace: Project, isFavorite: boolean) => (
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export const Page = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onDeleteOrgRoleSubmit = async () => {
|
const onDeleteOrgRoleSubmit = async () => {
|
||||||
try {
|
|
||||||
if (!orgId || !roleId) return;
|
if (!orgId || !roleId) return;
|
||||||
|
|
||||||
await deleteOrgRole({
|
await deleteOrgRole({
|
||||||
@@ -62,16 +61,6 @@ export const Page = () => {
|
|||||||
selectedTab: OrgAccessControlTabSections.Roles
|
selectedTab: OrgAccessControlTabSections.Roles
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
const error = err as any;
|
|
||||||
const text = error?.response?.data?.message ?? "Failed to delete organization role";
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isCustomRole = !["admin", "member", "no-access"].includes(data?.slug ?? "");
|
const isCustomRole = !["admin", "member", "no-access"].includes(data?.slug ?? "");
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
}, [role]);
|
}, [role]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name, description, slug }: FormData) => {
|
const onFormSubmit = async ({ name, description, slug }: FormData) => {
|
||||||
try {
|
|
||||||
if (!orgId) return;
|
if (!orgId) return;
|
||||||
|
|
||||||
if (role) {
|
if (role) {
|
||||||
@@ -111,14 +110,6 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch {
|
|
||||||
const text = `Failed to ${popUp?.role?.data ? "update" : "create"} role`;
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -56,7 +56,6 @@ export const RequestSecretForm = () => {
|
|||||||
const onFormSubmit = async ({ name, accessType, expiresIn }: FormData) => {
|
const onFormSubmit = async ({ name, accessType, expiresIn }: FormData) => {
|
||||||
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
|
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
|
||||||
|
|
||||||
try {
|
|
||||||
const { id } = await createSecretRequest({
|
const { id } = await createSecretRequest({
|
||||||
name,
|
name,
|
||||||
accessType,
|
accessType,
|
||||||
@@ -78,13 +77,6 @@ export const RequestSecretForm = () => {
|
|||||||
text: "Shared secret link copied to clipboard.",
|
text: "Shared secret link copied to clipboard.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create a shared secret.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasSecretLink = Boolean(secretLink);
|
const hasSecretLink = Boolean(secretLink);
|
||||||
|
|||||||
-8
@@ -22,7 +22,6 @@ export const RequestSecretTab = () => {
|
|||||||
const { mutateAsync: deleteSecretRequest } = useDeleteSecretRequest();
|
const { mutateAsync: deleteSecretRequest } = useDeleteSecretRequest();
|
||||||
|
|
||||||
const onDeleteApproved = async () => {
|
const onDeleteApproved = async () => {
|
||||||
try {
|
|
||||||
await deleteSecretRequest({
|
await deleteSecretRequest({
|
||||||
secretRequestId: popUp.deleteSecretRequestConfirmation.data?.id
|
secretRequestId: popUp.deleteSecretRequestConfirmation.data?.id
|
||||||
});
|
});
|
||||||
@@ -32,13 +31,6 @@ export const RequestSecretTab = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteSecretRequestConfirmation");
|
handlePopUpClose("deleteSecretRequestConfirmation");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete shared secret",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-7
@@ -90,7 +90,6 @@ export const OrgSecretShareLimitSection = () => {
|
|||||||
}, [currentOrg, reset]);
|
}, [currentOrg, reset]);
|
||||||
|
|
||||||
const handleFormSubmit = async (formData: TForm) => {
|
const handleFormSubmit = async (formData: TForm) => {
|
||||||
try {
|
|
||||||
const maxSharedSecretLifetimeSeconds =
|
const maxSharedSecretLifetimeSeconds =
|
||||||
ms(`${formData.maxLifetimeValue}${formData.maxLifetimeUnit}`) / 1000;
|
ms(`${formData.maxLifetimeValue}${formData.maxLifetimeUnit}`) / 1000;
|
||||||
|
|
||||||
@@ -106,12 +105,6 @@ export const OrgSecretShareLimitSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
reset(formData);
|
reset(formData);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update secret share limits",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Units for the dropdown with readable labels
|
// Units for the dropdown with readable labels
|
||||||
|
|||||||
-8
@@ -9,7 +9,6 @@ export const SecretSharingAllowShareToAnyone = () => {
|
|||||||
const { mutateAsync } = useUpdateOrg();
|
const { mutateAsync } = useUpdateOrg();
|
||||||
|
|
||||||
const handleSecretSharingToggle = async (value: boolean) => {
|
const handleSecretSharingToggle = async (value: boolean) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
@@ -21,13 +20,6 @@ export const SecretSharingAllowShareToAnyone = () => {
|
|||||||
text: `Successfully ${value ? "enabled" : "disabled"} secret sharing to members outside of this organization`,
|
text: `Successfully ${value ? "enabled" : "disabled"} secret sharing to members outside of this organization`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: (err as { response: { data: { message: string } } }).response.data.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -20,7 +20,6 @@ export const ShareSecretTab = () => {
|
|||||||
const deleteSecretShare = useDeleteSharedSecret();
|
const deleteSecretShare = useDeleteSharedSecret();
|
||||||
|
|
||||||
const onDeleteApproved = async () => {
|
const onDeleteApproved = async () => {
|
||||||
try {
|
|
||||||
deleteSecretShare.mutateAsync({
|
deleteSecretShare.mutateAsync({
|
||||||
sharedSecretId: (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.id
|
sharedSecretId: (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.id
|
||||||
});
|
});
|
||||||
@@ -30,13 +29,6 @@ export const ShareSecretTab = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteSharedSecretConfirmation");
|
handlePopUpClose("deleteSharedSecretConfirmation");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete shared secret",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-18
@@ -28,21 +28,12 @@ const CreateForm = ({ provider, onComplete }: CreateFormProps) => {
|
|||||||
const onSubmit = async (
|
const onSubmit = async (
|
||||||
formData: DiscriminativePick<TAuditLogStream, "provider" | "credentials">
|
formData: DiscriminativePick<TAuditLogStream, "provider" | "credentials">
|
||||||
) => {
|
) => {
|
||||||
try {
|
|
||||||
const logStream = await createAuditLogStream.mutateAsync(formData);
|
const logStream = await createAuditLogStream.mutateAsync(formData);
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully created ${providerName} Log Stream`,
|
text: `Successfully created ${providerName} Log Stream`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(logStream);
|
onComplete(logStream);
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to create ${providerName} Log Stream`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
@@ -68,7 +59,6 @@ const UpdateForm = ({ auditLogStream, onComplete }: UpdateFormProps) => {
|
|||||||
const onSubmit = async (
|
const onSubmit = async (
|
||||||
formData: DiscriminativePick<TAuditLogStream, "provider" | "credentials">
|
formData: DiscriminativePick<TAuditLogStream, "provider" | "credentials">
|
||||||
) => {
|
) => {
|
||||||
try {
|
|
||||||
const connection = await updateAuditLogStream.mutateAsync({
|
const connection = await updateAuditLogStream.mutateAsync({
|
||||||
auditLogStreamId: auditLogStream.id,
|
auditLogStreamId: auditLogStream.id,
|
||||||
...formData
|
...formData
|
||||||
@@ -78,14 +68,6 @@ const UpdateForm = ({ auditLogStream, onComplete }: UpdateFormProps) => {
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(connection);
|
onComplete(connection);
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to update ${providerName} Log Stream`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (auditLogStream.provider) {
|
switch (auditLogStream.provider) {
|
||||||
|
|||||||
-9
@@ -20,7 +20,6 @@ export const DeleteAuditLogStreamModal = ({ isOpen, onOpenChange, auditLogStream
|
|||||||
const providerDetails = AUDIT_LOG_STREAM_PROVIDER_MAP[provider];
|
const providerDetails = AUDIT_LOG_STREAM_PROVIDER_MAP[provider];
|
||||||
|
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
try {
|
|
||||||
await deleteAuditLogStream.mutateAsync({
|
await deleteAuditLogStream.mutateAsync({
|
||||||
auditLogStreamId,
|
auditLogStreamId,
|
||||||
provider
|
provider
|
||||||
@@ -32,14 +31,6 @@ export const DeleteAuditLogStreamModal = ({ isOpen, onOpenChange, auditLogStream
|
|||||||
});
|
});
|
||||||
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${providerDetails.name} stream`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -54,7 +54,6 @@ export const VaultConnectionSection = () => {
|
|||||||
const handleDeleteConfirm = async () => {
|
const handleDeleteConfirm = async () => {
|
||||||
if (!configToDelete) return;
|
if (!configToDelete) return;
|
||||||
|
|
||||||
try {
|
|
||||||
await deleteConfig({ id: configToDelete.id });
|
await deleteConfig({ id: configToDelete.id });
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
@@ -62,13 +61,6 @@ export const VaultConnectionSection = () => {
|
|||||||
});
|
});
|
||||||
setIsDeleteModalOpen(false);
|
setIsDeleteModalOpen(false);
|
||||||
setConfigToDelete(null);
|
setConfigToDelete(null);
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to delete namespace config:", error);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to delete namespace configuration"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConnectionName = (connectionId: string | null) => {
|
const getConnectionName = (connectionId: string | null) => {
|
||||||
|
|||||||
-8
@@ -74,7 +74,6 @@ export const VaultNamespaceConfigModal = ({ isOpen, onOpenChange, editConfig }:
|
|||||||
}, [isOpen, editConfig, reset]);
|
}, [isOpen, editConfig, reset]);
|
||||||
|
|
||||||
const onFormSubmit = async (data: FormData) => {
|
const onFormSubmit = async (data: FormData) => {
|
||||||
try {
|
|
||||||
if (isEdit && editConfig) {
|
if (isEdit && editConfig) {
|
||||||
await updateConfig({
|
await updateConfig({
|
||||||
id: editConfig.id,
|
id: editConfig.id,
|
||||||
@@ -97,13 +96,6 @@ export const VaultNamespaceConfigModal = ({ isOpen, onOpenChange, editConfig }:
|
|||||||
}
|
}
|
||||||
reset();
|
reset();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to save namespace config:", error);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: `Failed to ${isEdit ? "update" : "create"} namespace configuration`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
|||||||
-8
@@ -19,7 +19,6 @@ export const OrgDeleteSection = () => {
|
|||||||
const { mutateAsync, isPending } = useDeleteOrgById();
|
const { mutateAsync, isPending } = useDeleteOrgById();
|
||||||
|
|
||||||
const handleDeleteOrgSubmit = async () => {
|
const handleDeleteOrgSubmit = async () => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
@@ -33,13 +32,6 @@ export const OrgDeleteSection = () => {
|
|||||||
|
|
||||||
clearSession();
|
clearSession();
|
||||||
navigate({ to: "/login" });
|
navigate({ to: "/login" });
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-4
@@ -51,7 +51,6 @@ export const OrgEncryptionTab = withPermission(
|
|||||||
kmsId: string;
|
kmsId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
await removeExternalKms(kmsId);
|
await removeExternalKms(kmsId);
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -60,9 +59,6 @@ export const OrgEncryptionTab = withPermission(
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("removeExternalKms", false);
|
handlePopUpToggle("removeExternalKms", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -35,7 +35,6 @@ export const AddOrgIncidentContactModal = ({
|
|||||||
const { mutateAsync, isPending } = useAddIncidentContact();
|
const { mutateAsync, isPending } = useAddIncidentContact();
|
||||||
|
|
||||||
const onFormSubmit = async ({ email }: TAddContactForm) => {
|
const onFormSubmit = async ({ email }: TAddContactForm) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
@@ -53,13 +52,6 @@ export const AddOrgIncidentContactModal = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to add incident contact",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-8
@@ -33,7 +33,6 @@ export const OrgIncidentContactsTable = () => {
|
|||||||
const { mutateAsync } = useDeleteIncidentContact();
|
const { mutateAsync } = useDeleteIncidentContact();
|
||||||
|
|
||||||
const onRemoveIncidentContact = async () => {
|
const onRemoveIncidentContact = async () => {
|
||||||
try {
|
|
||||||
const incidentContactId = (popUp?.removeContact?.data as { id: string })?.id;
|
const incidentContactId = (popUp?.removeContact?.data as { id: string })?.id;
|
||||||
|
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
@@ -48,13 +47,6 @@ export const OrgIncidentContactsTable = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("removeContact");
|
handlePopUpClose("removeContact");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove incident contact",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const filteredContacts = contacts
|
const filteredContacts = contacts
|
||||||
|
|||||||
-8
@@ -56,7 +56,6 @@ export const OrgNameChangeSection = (): JSX.Element => {
|
|||||||
}, [roles]);
|
}, [roles]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name, slug, defaultMembershipRole }: FormData) => {
|
const onFormSubmit = async ({ name, slug, defaultMembershipRole }: FormData) => {
|
||||||
try {
|
|
||||||
if (!currentOrg?.id || !roles?.length) return;
|
if (!currentOrg?.id || !roles?.length) return;
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
@@ -70,13 +69,6 @@ export const OrgNameChangeSection = (): JSX.Element => {
|
|||||||
text: "Successfully updated organization details",
|
text: "Successfully updated organization details",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update organization details",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isFormInitialized) {
|
if (!isFormInitialized) {
|
||||||
|
|||||||
-8
@@ -39,7 +39,6 @@ export const SubOrgNameChangeSection = (): JSX.Element => {
|
|||||||
const { mutateAsync, isPending } = useUpdateSubOrganization();
|
const { mutateAsync, isPending } = useUpdateSubOrganization();
|
||||||
|
|
||||||
const onFormSubmit = async ({ name }: FormData) => {
|
const onFormSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
name,
|
name,
|
||||||
subOrgId: currentOrg.id
|
subOrgId: currentOrg.id
|
||||||
@@ -52,13 +51,6 @@ export const SubOrgNameChangeSection = (): JSX.Element => {
|
|||||||
text: "Successfully updated sub-organization details",
|
text: "Successfully updated sub-organization details",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update sub-organization details",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-12
@@ -1,7 +1,5 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
import { Switch } from "@app/components/v2";
|
import { Switch } from "@app/components/v2";
|
||||||
import { useOrganization } from "@app/context";
|
import { useOrganization } from "@app/context";
|
||||||
import { useUpdateOrg } from "@app/hooks/api";
|
import { useUpdateOrg } from "@app/hooks/api";
|
||||||
@@ -60,20 +58,10 @@ export const OrgProductSelectSection = () => {
|
|||||||
[key]: { ...products[key], enabled: value }
|
[key]: { ...products[key], enabled: value }
|
||||||
}));
|
}));
|
||||||
|
|
||||||
try {
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
orgId: currentOrg.id,
|
orgId: currentOrg.id,
|
||||||
[key]: value
|
[key]: value
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
if (axios.isAxiosError(e)) {
|
|
||||||
const { message = "Something went wrong" } = e.response?.data as { message: string };
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
|
|||||||
-6
@@ -30,12 +30,6 @@ export const OrgProductSettingsTab = () => {
|
|||||||
text: `Successfully ${state ? "enabled" : "disabled"} blocking duplicate secret sync destinations for this organization`,
|
text: `Successfully ${state ? "enabled" : "disabled"} blocking duplicate secret sync destinations for this organization`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update blocking duplicate secret sync destinations setting for this organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
-8
@@ -75,19 +75,11 @@ export const ExternalGroupOrgRoleMappings = () => {
|
|||||||
const mappingField = useFieldArray({ control, name: "mappings" });
|
const mappingField = useFieldArray({ control, name: "mappings" });
|
||||||
|
|
||||||
const handleUpdateMappings = async (form: TForm) => {
|
const handleUpdateMappings = async (form: TForm) => {
|
||||||
try {
|
|
||||||
await updateMappings.mutateAsync(form);
|
await updateMappings.mutateAsync(form);
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Group organization role mappings updated.",
|
text: "Group organization role mappings updated.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update group organization role mappings.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const disableScimEdit = permission.cannot(OrgPermissionActions.Edit, OrgPermissionSubjects.Scim);
|
const disableScimEdit = permission.cannot(OrgPermissionActions.Edit, OrgPermissionSubjects.Scim);
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
|
|||||||
caCert,
|
caCert,
|
||||||
shouldCloseModal = true
|
shouldCloseModal = true
|
||||||
}: TLDAPFormData & { shouldCloseModal?: boolean }) => {
|
}: TLDAPFormData & { shouldCloseModal?: boolean }) => {
|
||||||
try {
|
|
||||||
if (!currentOrg) return;
|
if (!currentOrg) return;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -162,13 +161,6 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
|
|||||||
text: `Successfully ${!data ? "added" : "updated"} LDAP configuration`,
|
text: `Successfully ${!data ? "added" : "updated"} LDAP configuration`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${!data ? "add" : "update"} LDAP configuration`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTestLDAPConnection = async () => {
|
const handleTestLDAPConnection = async () => {
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
|
|||||||
if (!currentOrg) {
|
if (!currentOrg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
await updateMutateAsync({
|
await updateMutateAsync({
|
||||||
issuer: "",
|
issuer: "",
|
||||||
discoveryURL: "",
|
discoveryURL: "",
|
||||||
@@ -141,12 +140,6 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
|
|||||||
text: "Successfully deleted OIDC configuration.",
|
text: "Successfully deleted OIDC configuration.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed deleting OIDC configuration.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -178,7 +171,6 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
|
|||||||
clientSecret,
|
clientSecret,
|
||||||
jwtSignatureAlgorithm
|
jwtSignatureAlgorithm
|
||||||
}: OIDCFormData) => {
|
}: OIDCFormData) => {
|
||||||
try {
|
|
||||||
if (!currentOrg) {
|
if (!currentOrg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -223,13 +215,6 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
|
|||||||
text: `Successfully ${!data ? "added" : "updated"} OIDC SSO configuration`,
|
text: `Successfully ${!data ? "added" : "updated"} OIDC SSO configuration`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${!data ? "add" : "update"} OIDC SSO configuration`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelet
|
|||||||
if (!currentOrg) {
|
if (!currentOrg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
await updateMutateAsync({
|
await updateMutateAsync({
|
||||||
organizationId: currentOrg.id,
|
organizationId: currentOrg.id,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
@@ -121,16 +120,9 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelet
|
|||||||
text: "Successfully deleted SAML SSO configuration.",
|
text: "Successfully deleted SAML SSO configuration.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed deleting SAML SSO configuration.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSSOModalSubmit = async ({ authProvider, entryPoint, issuer, cert }: AddSSOFormData) => {
|
const onSSOModalSubmit = async ({ authProvider, entryPoint, issuer, cert }: AddSSOFormData) => {
|
||||||
try {
|
|
||||||
if (!currentOrg) return;
|
if (!currentOrg) return;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -159,13 +151,6 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelet
|
|||||||
text: `Successfully ${!data ? "added" : "updated"} SAML SSO configuration`,
|
text: `Successfully ${!data ? "added" : "updated"} SAML SSO configuration`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${!data ? "add" : "update"} SAML SSO configuration`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderLabels = (authProvider: string) => {
|
const renderLabels = (authProvider: string) => {
|
||||||
|
|||||||
-4
@@ -253,7 +253,6 @@ const GroupRolesForm = ({ projectRoles, roles, groupId, onClose }: FormProps) =>
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
|
||||||
await updateGroupWorkspaceRole.mutateAsync({
|
await updateGroupWorkspaceRole.mutateAsync({
|
||||||
projectId: currentProject?.id || "",
|
projectId: currentProject?.id || "",
|
||||||
groupId,
|
groupId,
|
||||||
@@ -262,9 +261,6 @@ const GroupRolesForm = ({ projectRoles, roles, groupId, onClose }: FormProps) =>
|
|||||||
createNotification({ text: "Successfully updated group role", type: "success" });
|
createNotification({ text: "Successfully updated group role", type: "success" });
|
||||||
onClose();
|
onClose();
|
||||||
setSearchRoles("");
|
setSearchRoles("");
|
||||||
} catch {
|
|
||||||
createNotification({ text: "Failed to update group role", type: "error" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-5
@@ -77,17 +77,12 @@ export const ProjectRoleList = () => {
|
|||||||
|
|
||||||
const handleRoleDelete = async () => {
|
const handleRoleDelete = async () => {
|
||||||
const { id } = popUp?.deleteRole?.data as TProjectRole;
|
const { id } = popUp?.deleteRole?.data as TProjectRole;
|
||||||
try {
|
|
||||||
await deleteRole({
|
await deleteRole({
|
||||||
projectId,
|
projectId,
|
||||||
id
|
id
|
||||||
});
|
});
|
||||||
createNotification({ type: "success", text: "Successfully removed the role" });
|
createNotification({ type: "success", text: "Successfully removed the role" });
|
||||||
handlePopUpClose("deleteRole");
|
handlePopUpClose("deleteRole");
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to delete role" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
-5
@@ -131,7 +131,6 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
|
|||||||
temporaryAccessStartTime: el.temporaryAccess.temporaryAccessStartTime
|
temporaryAccessStartTime: el.temporaryAccess.temporaryAccessStartTime
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
if (isCreate) {
|
if (isCreate) {
|
||||||
await createIdentityProjectAdditionalPrivilege({
|
await createIdentityProjectAdditionalPrivilege({
|
||||||
permissions: formRolePermission2API(el.permissions),
|
permissions: formRolePermission2API(el.permissions),
|
||||||
@@ -154,10 +153,6 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
|
|||||||
createNotification({ type: "success", text: "Successfully updated privilege" });
|
createNotification({ type: "success", text: "Successfully updated privilege" });
|
||||||
}
|
}
|
||||||
onGoBack();
|
onGoBack();
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to update privilege" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const privilegeTemporaryAccess = form.watch("temporaryAccess");
|
const privilegeTemporaryAccess = form.watch("temporaryAccess");
|
||||||
|
|||||||
-5
@@ -57,7 +57,6 @@ export const IdentityProjectAdditionalPrivilegeSection = ({ identityMembershipDe
|
|||||||
|
|
||||||
const handlePrivilegeDelete = async () => {
|
const handlePrivilegeDelete = async () => {
|
||||||
const { id } = popUp?.deletePrivilege?.data as { id: string };
|
const { id } = popUp?.deletePrivilege?.data as { id: string };
|
||||||
try {
|
|
||||||
await deletePrivilege({
|
await deletePrivilege({
|
||||||
privilegeId: id,
|
privilegeId: id,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -65,10 +64,6 @@ export const IdentityProjectAdditionalPrivilegeSection = ({ identityMembershipDe
|
|||||||
});
|
});
|
||||||
createNotification({ type: "success", text: "Successfully removed the privilege" });
|
createNotification({ type: "success", text: "Successfully removed the privilege" });
|
||||||
handlePopUpClose("deletePrivilege");
|
handlePopUpClose("deletePrivilege");
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to delete privilege" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-5
@@ -50,7 +50,6 @@ export const IdentityRoleDetailsSection = ({
|
|||||||
|
|
||||||
const handleRoleDelete = async () => {
|
const handleRoleDelete = async () => {
|
||||||
const { id } = popUp?.deleteRole?.data as TProjectRole;
|
const { id } = popUp?.deleteRole?.data as TProjectRole;
|
||||||
try {
|
|
||||||
const updatedRoles = identityMembershipDetails?.roles?.filter((el) => el.id !== id);
|
const updatedRoles = identityMembershipDetails?.roles?.filter((el) => el.id !== id);
|
||||||
await updateIdentityWorkspaceRole({
|
await updateIdentityWorkspaceRole({
|
||||||
projectId: currentProject?.id || "",
|
projectId: currentProject?.id || "",
|
||||||
@@ -82,10 +81,6 @@ export const IdentityRoleDetailsSection = ({
|
|||||||
});
|
});
|
||||||
createNotification({ type: "success", text: "Successfully removed role" });
|
createNotification({ type: "success", text: "Successfully removed role" });
|
||||||
handlePopUpClose("deleteRole");
|
handlePopUpClose("deleteRole");
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to delete role" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-5
@@ -60,17 +60,12 @@ export const MemberProjectAdditionalPrivilegeSection = ({ membershipDetails }: P
|
|||||||
|
|
||||||
const handlePrivilegeDelete = async () => {
|
const handlePrivilegeDelete = async () => {
|
||||||
const { id } = popUp?.deletePrivilege?.data as { id: string };
|
const { id } = popUp?.deletePrivilege?.data as { id: string };
|
||||||
try {
|
|
||||||
await deletePrivilege({
|
await deletePrivilege({
|
||||||
privilegeId: id,
|
privilegeId: id,
|
||||||
projectMembershipId: membershipDetails.id
|
projectMembershipId: membershipDetails.id
|
||||||
});
|
});
|
||||||
createNotification({ type: "success", text: "Successfully removed the privilege" });
|
createNotification({ type: "success", text: "Successfully removed the privilege" });
|
||||||
handlePopUpClose("deletePrivilege");
|
handlePopUpClose("deletePrivilege");
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to delete privilege" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
-5
@@ -129,7 +129,6 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
|
|||||||
temporaryAccessStartTime: el.temporaryAccess.temporaryAccessStartTime
|
temporaryAccessStartTime: el.temporaryAccess.temporaryAccessStartTime
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
if (isCreate) {
|
if (isCreate) {
|
||||||
await createUserProjectAdditionalPrivilege({
|
await createUserProjectAdditionalPrivilege({
|
||||||
permissions: formRolePermission2API(el.permissions),
|
permissions: formRolePermission2API(el.permissions),
|
||||||
@@ -150,10 +149,6 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
|
|||||||
createNotification({ type: "success", text: "Successfully updated privilege" });
|
createNotification({ type: "success", text: "Successfully updated privilege" });
|
||||||
}
|
}
|
||||||
onGoBack();
|
onGoBack();
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to update privilege" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const privilegeTemporaryAccess = form.watch("temporaryAccess");
|
const privilegeTemporaryAccess = form.watch("temporaryAccess");
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
|
|||||||
const { mutateAsync: updateRole } = useUpdateProjectRole();
|
const { mutateAsync: updateRole } = useUpdateProjectRole();
|
||||||
|
|
||||||
const onSubmit = async (el: TFormSchema) => {
|
const onSubmit = async (el: TFormSchema) => {
|
||||||
try {
|
|
||||||
if (!projectId || !role?.id) return;
|
if (!projectId || !role?.id) return;
|
||||||
await updateRole({
|
await updateRole({
|
||||||
id: role?.id as string,
|
id: role?.id as string,
|
||||||
@@ -131,10 +130,6 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
|
|||||||
permissions: formRolePermission2API(el.permissions)
|
permissions: formRolePermission2API(el.permissions)
|
||||||
});
|
});
|
||||||
createNotification({ type: "success", text: "Successfully updated role" });
|
createNotification({ type: "success", text: "Successfully updated role" });
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({ type: "error", text: "Failed to update role" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isCustomRole = !Object.values(ProjectMembershipRole).includes(
|
const isCustomRole = !Object.values(ProjectMembershipRole).includes(
|
||||||
|
|||||||
-4
@@ -13,12 +13,8 @@ export const BackfillSecretReferenceSecretion = () => {
|
|||||||
|
|
||||||
const handleBackfill = async () => {
|
const handleBackfill = async () => {
|
||||||
if (backfillSecretReferences.isPending) return;
|
if (backfillSecretReferences.isPending) return;
|
||||||
try {
|
|
||||||
await backfillSecretReferences.mutateAsync({ projectId: currentProject.id || "" });
|
await backfillSecretReferences.mutateAsync({ projectId: currentProject.id || "" });
|
||||||
createNotification({ text: "Successfully re-indexed secret references", type: "success" });
|
createNotification({ text: "Successfully re-indexed secret references", type: "success" });
|
||||||
} catch {
|
|
||||||
createNotification({ text: "Failed to re-index secret references", type: "error" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
|
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
|
||||||
|
|||||||
Reference in New Issue
Block a user