mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-28 17:55:15 +02:00
chore(unl-204): remove uses of toast text and confetti (#8941)
As of PR #8935, we no longer support both text and title, and confetti has been removed. This PR: - removes `confetti` from the toast interface - merges `text` and `title` into `text` and updates its uses across the codebase. - readjusts the text where necessary.
This commit is contained in:
parent
2f7beceb21
commit
b2c58102dd
@ -22,7 +22,7 @@ export const ApiTokenDocs = () => {
|
|||||||
copy(url);
|
copy(url);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Copied to clipboard',
|
text: 'Copied to clipboard',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@ export const UserToken = ({ token }: IUserTokenProps) => {
|
|||||||
if (copy(token)) {
|
if (copy(token)) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Token copied to clipboard',
|
text: 'Token copied to clipboard',
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Could not copy token',
|
text: 'Could not copy token',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ export const GoogleAuth = () => {
|
|||||||
try {
|
try {
|
||||||
await updateSettings(removeEmptyStringFields(data));
|
await updateSettings(removeEmptyStringFields(data));
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Settings stored',
|
text: 'Settings stored',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -97,7 +97,7 @@ export const OidcAuth = () => {
|
|||||||
try {
|
try {
|
||||||
await updateSettings(removeEmptyStringFields(data));
|
await updateSettings(removeEmptyStringFields(data));
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Settings stored',
|
text: 'Settings stored',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -50,8 +50,7 @@ export const PasswordAuth = () => {
|
|||||||
await updateSettings(settings);
|
await updateSettings(settings);
|
||||||
refetch();
|
refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Successfully saved',
|
text: 'Password authentication settings stored',
|
||||||
text: 'Password authentication settings stored.',
|
|
||||||
autoHideDuration: 4000,
|
autoHideDuration: 4000,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -88,7 +88,7 @@ export const SamlAuth = () => {
|
|||||||
try {
|
try {
|
||||||
await updateSettings(removeEmptyStringFields(data));
|
await updateSettings(removeEmptyStringFields(data));
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Settings stored',
|
text: 'Settings stored',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -58,7 +58,7 @@ export const ScimSettings = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Settings stored',
|
text: 'Settings stored',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
await refetch();
|
await refetch();
|
||||||
|
@ -101,7 +101,7 @@ export const BannerModal = ({ banner, open, setOpen }: IBannerModalProps) => {
|
|||||||
await addBanner(payload);
|
await addBanner(payload);
|
||||||
}
|
}
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Banner ${editing ? 'updated' : 'added'} successfully`,
|
text: `Banner ${editing ? 'updated' : 'added'} successfully`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -42,7 +42,7 @@ export const BannersTable = () => {
|
|||||||
try {
|
try {
|
||||||
await toggleBanner(banner.id, enabled);
|
await toggleBanner(banner.id, enabled);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `"${banner.message}" has been ${
|
text: `"${banner.message}" has been ${
|
||||||
enabled ? 'enabled' : 'disabled'
|
enabled ? 'enabled' : 'disabled'
|
||||||
}`,
|
}`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -57,7 +57,7 @@ export const BannersTable = () => {
|
|||||||
try {
|
try {
|
||||||
await removeBanner(banner.id);
|
await removeBanner(banner.id);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `"${banner.message}" has been deleted`,
|
text: `"${banner.message}" has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -25,7 +25,7 @@ export const CorsForm = ({ frontendApiOrigins }: ICorsFormProps) => {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
await setFrontendSettings(split);
|
await setFrontendSettings(split);
|
||||||
setValue(formatInputValue(split));
|
setValue(formatInputValue(split));
|
||||||
setToastData({ title: 'Settings saved', type: 'success' });
|
setToastData({ text: 'Settings saved', type: 'success' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,7 @@ export const CreateGroup = () => {
|
|||||||
const group = await createGroup(payload);
|
const group = await createGroup(payload);
|
||||||
navigate(`/admin/groups/${group.id}`);
|
navigate(`/admin/groups/${group.id}`);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Group created successfully',
|
text: 'Group created successfully',
|
||||||
text: 'Now you can start using your group.',
|
|
||||||
confetti: true,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -90,7 +90,7 @@ export const EditGroup = ({
|
|||||||
refetchGroups();
|
refetchGroups();
|
||||||
navigate(GO_BACK);
|
navigate(GO_BACK);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Group updated successfully',
|
text: 'Group updated successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -77,7 +77,7 @@ export const EditGroupUsers: FC<IEditGroupUsersProps> = ({
|
|||||||
refetchGroups();
|
refetchGroups();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Group users saved successfully',
|
text: 'Group users saved successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -38,7 +38,7 @@ export const RemoveGroupUser: FC<IRemoveGroupUserProps> = ({
|
|||||||
refetchGroup();
|
refetchGroup();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'User removed from group successfully',
|
text: 'User removed from group successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -31,7 +31,7 @@ export const RemoveGroup: FC<IRemoveGroupProps> = ({
|
|||||||
setOpen(false);
|
setOpen(false);
|
||||||
navigate('/admin/groups');
|
navigate('/admin/groups');
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Group removed successfully',
|
text: 'Group removed successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -58,7 +58,7 @@ export const License = () => {
|
|||||||
try {
|
try {
|
||||||
await updateLicenseKey(token);
|
await updateLicenseKey(token);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'License key updated',
|
text: 'License key updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetchLicense();
|
refetchLicense();
|
||||||
|
@ -45,7 +45,7 @@ export const MaintenanceToggle = () => {
|
|||||||
const updateEnabled = async () => {
|
const updateEnabled = async () => {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: `Maintenance mode has been successfully ${
|
text: `Maintenance mode has been successfully ${
|
||||||
enabled ? 'disabled' : 'enabled'
|
enabled ? 'disabled' : 'enabled'
|
||||||
}`,
|
}`,
|
||||||
});
|
});
|
||||||
|
@ -96,7 +96,7 @@ export const RoleModal = ({
|
|||||||
await addRole(payload);
|
await addRole(payload);
|
||||||
}
|
}
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Role ${editing ? 'updated' : 'added'} successfully`,
|
text: `Role ${editing ? 'updated' : 'added'} successfully`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -52,7 +52,7 @@ export const RolesTable = ({
|
|||||||
try {
|
try {
|
||||||
await removeRole(role.id);
|
await removeRole(role.id);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `${role.name} has been deleted`,
|
text: `${role.name} has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -196,7 +196,7 @@ export const ServiceAccountModal = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Service account ${
|
text: `Service account ${
|
||||||
editing ? 'updated' : 'added'
|
editing ? 'updated' : 'added'
|
||||||
} successfully`,
|
} successfully`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
@ -127,7 +127,7 @@ export const ServiceAccountTokens = ({
|
|||||||
setNewToken(token);
|
setNewToken(token);
|
||||||
setTokenOpen(true);
|
setTokenOpen(true);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Token created successfully',
|
text: 'Token created successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -146,7 +146,7 @@ export const ServiceAccountTokens = ({
|
|||||||
refetchTokens();
|
refetchTokens();
|
||||||
setDeleteOpen(false);
|
setDeleteOpen(false);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Token deleted successfully',
|
text: 'Token deleted successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -48,7 +48,7 @@ export const ServiceAccountsTable = () => {
|
|||||||
try {
|
try {
|
||||||
await removeServiceAccount(serviceAccount.id);
|
await removeServiceAccount(serviceAccount.id);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `${serviceAccount.name} has been deleted`,
|
text: `${serviceAccount.name} has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -60,7 +60,7 @@ const EditUser = () => {
|
|||||||
refetch();
|
refetch();
|
||||||
navigate('/admin/users');
|
navigate('/admin/users');
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'User information updated',
|
text: 'User information updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -71,7 +71,7 @@ export const InactiveUsersList = () => {
|
|||||||
try {
|
try {
|
||||||
await deleteInactiveUsers(inactiveUsers.map((i) => i.id));
|
await deleteInactiveUsers(inactiveUsers.map((i) => i.id));
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Inactive users has been deleted`,
|
text: `Inactive users has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
setShowDelInactiveDialog(false);
|
setShowDelInactiveDialog(false);
|
||||||
@ -84,7 +84,7 @@ export const InactiveUsersList = () => {
|
|||||||
try {
|
try {
|
||||||
await removeUser(userId);
|
await removeUser(userId);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `User has been deleted`,
|
text: `User has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetchInactiveUsers();
|
refetchInactiveUsers();
|
||||||
|
@ -51,7 +51,7 @@ export const LinkField: FC<ILinkFieldProps> = ({
|
|||||||
const setError = () =>
|
const setError = () =>
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: errorTitle,
|
text: errorTitle,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCopy = () => {
|
const handleCopy = () => {
|
||||||
@ -61,7 +61,7 @@ export const LinkField: FC<ILinkFieldProps> = ({
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: successTitle,
|
text: successTitle,
|
||||||
});
|
});
|
||||||
onCopy?.();
|
onCopy?.();
|
||||||
})
|
})
|
||||||
|
@ -62,8 +62,7 @@ const ChangePassword = ({
|
|||||||
setData({});
|
setData({});
|
||||||
closeDialog();
|
closeDialog();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Password changed successfully',
|
text: 'Password changed successfully',
|
||||||
text: 'The user can now sign in using the new password.',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -112,7 +112,7 @@ const UsersList = () => {
|
|||||||
try {
|
try {
|
||||||
await removeUser(user.id);
|
await removeUser(user.id);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `${user.name} has been deleted`,
|
text: `${user.name} has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -93,8 +93,7 @@ export const Application = () => {
|
|||||||
try {
|
try {
|
||||||
await deleteApplication(appName);
|
await deleteApplication(appName);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Deleted Successfully',
|
text: 'Deleted Successfully',
|
||||||
text: 'Application deleted successfully',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
navigate('/applications');
|
navigate('/applications');
|
||||||
|
@ -40,8 +40,7 @@ export const ApplicationUpdate = ({ application }: IApplicationUpdateProps) => {
|
|||||||
refetchApplication();
|
refetchApplication();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Updated Successfully',
|
text: 'Updated Successfully',
|
||||||
text: `${field} successfully updated`,
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -103,7 +103,7 @@ test('should show confirm dialog when reviving flag', async () => {
|
|||||||
});
|
});
|
||||||
fireEvent.click(reviveFlagsButton);
|
fireEvent.click(reviveFlagsButton);
|
||||||
|
|
||||||
await screen.findByText("And we're back!");
|
await screen.findByText('Feature flags revived');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should show confirm dialog when batch reviving flag', async () => {
|
test('should show confirm dialog when batch reviving flag', async () => {
|
||||||
@ -134,7 +134,7 @@ test('should show confirm dialog when batch reviving flag', async () => {
|
|||||||
});
|
});
|
||||||
fireEvent.click(reviveTogglesButton);
|
fireEvent.click(reviveTogglesButton);
|
||||||
|
|
||||||
await screen.findByText("And we're back!");
|
await screen.findByText('Feature flags revived');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should show info box when disableAllEnvsOnRevive flag is on', async () => {
|
test('should show info box when disableAllEnvsOnRevive flag is on', async () => {
|
||||||
|
@ -49,10 +49,7 @@ export const ArchivedFeatureDeleteConfirm = ({
|
|||||||
await refetch();
|
await refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: `Feature ${singularOrPluralFlags} deleted`,
|
text: `Feature ${singularOrPluralFlags} deleted`,
|
||||||
text: `You have successfully deleted the following feature ${singularOrPluralFlags}: ${deletedFeatures.join(
|
|
||||||
', ',
|
|
||||||
)}.`,
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -39,8 +39,7 @@ export const ArchivedFeatureReviveConfirm = ({
|
|||||||
await refetch();
|
await refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: "And we're back!",
|
text: 'Feature flags revived',
|
||||||
text: 'The feature flags have been revived.',
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -98,7 +98,7 @@ export const ChangeActions: FC<{
|
|||||||
change.id,
|
change.id,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Change discarded from change request draft.',
|
text: 'Change discarded from change request draft.',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
onRefetch?.();
|
onRefetch?.();
|
||||||
|
@ -125,7 +125,7 @@ export const EditChange = ({
|
|||||||
});
|
});
|
||||||
onSubmit();
|
onSubmit();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Change updated',
|
text: 'Change updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -136,7 +136,6 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
refetchActionableChangeRequests();
|
refetchActionableChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: 'Changes applied',
|
text: 'Changes applied',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -159,7 +158,6 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
refetchActionableChangeRequests();
|
refetchActionableChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: 'Changes scheduled',
|
text: 'Changes scheduled',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -177,7 +175,6 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
await refetchChangeRequest();
|
await refetchChangeRequest();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: 'Comment added',
|
text: 'Comment added',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -199,7 +196,6 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
refetchActionableChangeRequests();
|
refetchActionableChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: 'Changes cancelled',
|
text: 'Changes cancelled',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -221,7 +217,6 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: 'Changes rejected',
|
text: 'Changes rejected',
|
||||||
});
|
});
|
||||||
refetchChangeRequestOpen();
|
refetchChangeRequestOpen();
|
||||||
@ -244,7 +239,6 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
refetchChangeRequestOpen();
|
refetchChangeRequestOpen();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: 'Changes approved',
|
text: 'Changes approved',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -49,7 +49,7 @@ export const ChangeRequestTitle: FC<{
|
|||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Change request title updated!',
|
text: 'Change request title updated!',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -44,7 +44,7 @@ export const CommandBarFeedback = ({ onSubmit }: ICommandBarFeedbackProps) => {
|
|||||||
});
|
});
|
||||||
onSubmit();
|
onSubmit();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Feedback sent',
|
text: 'Feedback sent',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ export const CopyApiTokenButton = ({
|
|||||||
if (copy(value)) {
|
if (copy(value)) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: `Token copied to clipboard`,
|
text: 'Token copied to clipboard',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (track && typeof track === 'function') {
|
if (track && typeof track === 'function') {
|
||||||
|
@ -34,7 +34,7 @@ export const RemoveApiTokenButton = ({
|
|||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'API token removed',
|
text: 'API token removed',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -238,11 +238,8 @@ const useArchiveAction = ({
|
|||||||
);
|
);
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
text: isBulkArchive
|
|
||||||
? 'Your archive feature flags changes have been added to change request'
|
|
||||||
: 'Your archive feature flag change has been added to change request',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: isBulkArchive
|
text: isBulkArchive
|
||||||
? 'Changes added to a draft'
|
? 'Changes added to a draft'
|
||||||
: 'Change added to a draft',
|
: 'Change added to a draft',
|
||||||
});
|
});
|
||||||
@ -251,18 +248,16 @@ const useArchiveAction = ({
|
|||||||
const archiveToggle = async () => {
|
const archiveToggle = async () => {
|
||||||
await archiveFeatureToggle(projectId, featureIds[0]);
|
await archiveFeatureToggle(projectId, featureIds[0]);
|
||||||
setToastData({
|
setToastData({
|
||||||
text: 'Your feature flag has been archived',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Feature archived',
|
text: 'Feature flag archived',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const archiveToggles = async () => {
|
const archiveToggles = async () => {
|
||||||
await archiveFeatures(projectId, featureIds);
|
await archiveFeatures(projectId, featureIds);
|
||||||
setToastData({
|
setToastData({
|
||||||
text: 'Selected feature flags have been archived',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Features archived',
|
text: 'Feature flags archived',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,14 +50,12 @@ export const FeatureStaleDialog = ({
|
|||||||
if (isStale) {
|
if (isStale) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: "And we're back!",
|
text: 'The flag is no longer marked as stale',
|
||||||
text: 'The flag is no longer marked as stale.',
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'A job well done.',
|
text: 'The flag has been marked as stale',
|
||||||
text: 'The flag has been marked as stale.',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -259,16 +259,14 @@ const FormTemplate: React.FC<ICreateProps> = ({
|
|||||||
if (formatApiCode !== undefined) {
|
if (formatApiCode !== undefined) {
|
||||||
if (copy(formatApiCode())) {
|
if (copy(formatApiCode())) {
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Successfully copied the command',
|
text: 'Command copied',
|
||||||
text: 'The command should now be automatically copied to your clipboard',
|
|
||||||
autoHideDuration: 6000,
|
autoHideDuration: 6000,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
show: true,
|
show: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Could not copy the command',
|
text: 'Could not copy the command',
|
||||||
text: 'Sorry, but we could not copy the command.',
|
|
||||||
autoHideDuration: 6000,
|
autoHideDuration: 6000,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -7,7 +7,7 @@ import UIContext from 'contexts/UIContext';
|
|||||||
import Close from '@mui/icons-material/Close';
|
import Close from '@mui/icons-material/Close';
|
||||||
import type { IToast } from 'interfaces/toast';
|
import type { IToast } from 'interfaces/toast';
|
||||||
|
|
||||||
const Toast = ({ title, type }: IToast) => {
|
const Toast = ({ text, type }: IToast) => {
|
||||||
const { setToast } = useContext(UIContext);
|
const { setToast } = useContext(UIContext);
|
||||||
|
|
||||||
const { classes: styles } = useStyles();
|
const { classes: styles } = useStyles();
|
||||||
@ -20,7 +20,7 @@ const Toast = ({ title, type }: IToast) => {
|
|||||||
<div className={classnames(styles.container, 'dropdown-outline')}>
|
<div className={classnames(styles.container, 'dropdown-outline')}>
|
||||||
<CheckMarkBadge type={type} className={styles.checkMark} />
|
<CheckMarkBadge type={type} className={styles.checkMark} />
|
||||||
|
|
||||||
<h3 className={styles.headerStyles}>{title}</h3>
|
<h3 className={styles.headerStyles}>{text}</h3>
|
||||||
|
|
||||||
<Tooltip title='Close' arrow>
|
<Tooltip title='Close' arrow>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
@ -142,8 +142,7 @@ const ContextList: VFC = () => {
|
|||||||
refetchUnleashContext();
|
refetchUnleashContext();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Successfully deleted context',
|
text: 'Context field deleted',
|
||||||
text: 'Your context is now deleted',
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -51,8 +51,7 @@ export const CreateUnleashContext = ({
|
|||||||
await createContext(payload);
|
await createContext(payload);
|
||||||
refetchUnleashContext();
|
refetchUnleashContext();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Context created',
|
text: 'Context field created',
|
||||||
confetti: true,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
onSubmit();
|
onSubmit();
|
||||||
|
@ -63,7 +63,7 @@ export const EditContext = () => {
|
|||||||
refetch();
|
refetch();
|
||||||
navigate('/context');
|
navigate('/context');
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Context information updated',
|
text: 'Context information updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
|
@ -43,9 +43,8 @@ const CreateEnvironment = () => {
|
|||||||
await createEnvironment(payload);
|
await createEnvironment(payload);
|
||||||
refetch();
|
refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Environment created',
|
text: 'Environment created',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
navigate('/environments');
|
navigate('/environments');
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -49,7 +49,7 @@ const EditEnvironment = () => {
|
|||||||
navigate('/environments');
|
navigate('/environments');
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Successfully updated environment.',
|
text: 'Successfully updated environment.',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -43,8 +43,7 @@ export const EnvironmentActionCell = ({
|
|||||||
refetchPermissions();
|
refetchPermissions();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Environment deleted',
|
text: `Environment deleted`,
|
||||||
text: `You have successfully deleted the ${environment.name} environment.`,
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
@ -60,13 +59,13 @@ export const EnvironmentActionCell = ({
|
|||||||
await toggleEnvironmentOff(environment.name);
|
await toggleEnvironmentOff(environment.name);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Environment deprecated successfully',
|
text: 'Environment deprecated',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await toggleEnvironmentOn(environment.name);
|
await toggleEnvironmentOn(environment.name);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Environment undeprecated successfully',
|
text: 'Environment undeprecated',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -89,8 +88,7 @@ export const EnvironmentActionCell = ({
|
|||||||
} else {
|
} else {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Environment limit reached',
|
text: `Environment limit (${environmentLimit}) reached`,
|
||||||
text: `You have reached the maximum number of environments (${environmentLimit}). Please reach out if you need more.`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
@ -184,7 +184,7 @@ export const EnvironmentCloneModal = ({
|
|||||||
newToken(token);
|
newToken(token);
|
||||||
}
|
}
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Environment successfully cloned!',
|
text: 'Environment cloned',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetchEnvironments();
|
refetchEnvironments();
|
||||||
|
@ -63,12 +63,8 @@ export const useManageDependency = (
|
|||||||
}
|
}
|
||||||
void refetchChangeRequests();
|
void refetchChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
text:
|
|
||||||
actionType === 'addDependency'
|
|
||||||
? `${featureId} will depend on ${parent}`
|
|
||||||
: `${featureId} dependency will be removed`,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Change added to a draft',
|
text: 'Change added to draft',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +91,7 @@ export const useManageDependency = (
|
|||||||
eventType: 'dependency removed',
|
eventType: 'dependency removed',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({ title: 'Dependency removed', type: 'success' });
|
setToastData({ text: 'Dependency removed', type: 'success' });
|
||||||
} else {
|
} else {
|
||||||
await addDependency(featureId, {
|
await addDependency(featureId, {
|
||||||
feature: parent,
|
feature: parent,
|
||||||
@ -110,7 +106,7 @@ export const useManageDependency = (
|
|||||||
eventType: 'dependency added',
|
eventType: 'dependency added',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({ title: 'Dependency added', type: 'success' });
|
setToastData({ text: 'Dependency added', type: 'success' });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -54,7 +54,7 @@ const EditFeature = () => {
|
|||||||
await patchFeatureFlag(project, featureId, patch);
|
await patchFeatureFlag(project, featureId, patch);
|
||||||
navigate(`/projects/${project}/features/${name}`);
|
navigate(`/projects/${project}/features/${name}`);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Flag updated successfully',
|
text: 'Flag updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -150,9 +150,8 @@ export const FeatureStrategyCreate = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy created',
|
text: 'Strategy created',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -164,9 +163,8 @@ export const FeatureStrategyCreate = () => {
|
|||||||
});
|
});
|
||||||
// FIXME: segments in change requests
|
// FIXME: segments in change requests
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy added to draft',
|
text: 'Strategy added to draft',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
};
|
};
|
||||||
|
@ -209,9 +209,8 @@ export const FeatureStrategyEdit = () => {
|
|||||||
|
|
||||||
await refetchSavedStrategySegments();
|
await refetchSavedStrategySegments();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy updated',
|
text: 'Strategy updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,9 +222,8 @@ export const FeatureStrategyEdit = () => {
|
|||||||
});
|
});
|
||||||
// FIXME: segments in change requests
|
// FIXME: segments in change requests
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Change added to draft',
|
text: 'Change added to draft',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
};
|
};
|
||||||
|
@ -78,10 +78,7 @@ export const FeatureStrategyEmpty = ({
|
|||||||
refetchFeatureImmutable();
|
refetchFeatureImmutable();
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
title: multiple ? 'Strategies created' : 'Strategy created',
|
text: multiple ? 'Strategies created' : 'Strategy created',
|
||||||
text: multiple
|
|
||||||
? 'Successfully copied from another environment'
|
|
||||||
: 'Successfully created strategy',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -75,7 +75,7 @@ export const FeatureReleasePlanCard = ({
|
|||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Release plan added',
|
text: 'Release plan added',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -73,9 +73,8 @@ export const BulkDisableDialog = ({
|
|||||||
);
|
);
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
text: 'Your disabled feature flags changes have been added to change request',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Changes added to a draft',
|
text: 'Changes added to draft',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await bulkToggleFeaturesEnvironmentOff(
|
await bulkToggleFeaturesEnvironmentOff(
|
||||||
@ -84,9 +83,8 @@ export const BulkDisableDialog = ({
|
|||||||
selected,
|
selected,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
text: 'Your feature flags have been disabled',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Features disabled',
|
text: 'Feature flags disabled',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
onClose();
|
onClose();
|
||||||
|
@ -73,9 +73,8 @@ export const BulkEnableDialog = ({
|
|||||||
);
|
);
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
setToastData({
|
setToastData({
|
||||||
text: 'Your enable feature flags changes have been added to change request',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Changes added to a draft',
|
text: 'Changes added to draft',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await bulkToggleFeaturesEnvironmentOn(
|
await bulkToggleFeaturesEnvironmentOn(
|
||||||
@ -84,9 +83,8 @@ export const BulkEnableDialog = ({
|
|||||||
selected,
|
selected,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
text: 'Your feature flags have been enabled',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Features enabled',
|
text: 'Feature flags enabled',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ const EnvironmentAccordionBody = ({
|
|||||||
);
|
);
|
||||||
refetchFeature();
|
refetchFeature();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Order of strategies updated',
|
text: 'Order of strategies updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -129,9 +129,8 @@ const EnvironmentAccordionBody = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy execution order added to draft',
|
text: 'Strategy execution order added to draft',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
};
|
};
|
||||||
|
@ -86,8 +86,7 @@ export const CopyStrategyIconMenu: VFC<ICopyStrategyIconMenuProps> = ({
|
|||||||
refetchFeature();
|
refetchFeature();
|
||||||
refetchFeatureImmutable();
|
refetchFeatureImmutable();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Strategy created`,
|
text: `Strategy copied to ${targetEnvironment}`,
|
||||||
text: `Successfully copied a strategy to ${targetEnvironment}`,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -194,7 +194,7 @@ const useOnRemove = ({
|
|||||||
strategyId,
|
strategyId,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy deleted',
|
text: 'Strategy deleted',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetchFeature();
|
refetchFeature();
|
||||||
@ -227,7 +227,7 @@ const useOnSuggestRemove = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Changes added to the draft!',
|
text: 'Changes added to draft',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
await refetchChangeRequests();
|
await refetchChangeRequests();
|
||||||
|
@ -24,7 +24,7 @@ export const useEnableDisable = ({
|
|||||||
!enabled,
|
!enabled,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Strategy ${enabled ? 'enabled' : 'disabled'}`,
|
text: `Strategy ${enabled ? 'enabled' : 'disabled'}`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ export const useSuggestEnableDisable = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Changes added to the draft!',
|
text: 'Changes added to draft',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
await refetchChangeRequests();
|
await refetchChangeRequests();
|
||||||
|
@ -69,9 +69,8 @@ const useDeleteDependency = (project: string, featureId: string) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({
|
setToastData({
|
||||||
text: `${featureId} dependency will be removed`,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Change added to a draft',
|
text: 'Change added to draft',
|
||||||
});
|
});
|
||||||
await refetchChangeRequests();
|
await refetchChangeRequests();
|
||||||
} else {
|
} else {
|
||||||
@ -81,7 +80,7 @@ const useDeleteDependency = (project: string, featureId: string) => {
|
|||||||
eventType: 'dependency removed',
|
eventType: 'dependency removed',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({ title: 'Dependency removed', type: 'success' });
|
setToastData({ text: 'Dependency removed', type: 'success' });
|
||||||
await refetchFeature();
|
await refetchFeature();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -255,7 +255,7 @@ test('delete dependency with change request', async () => {
|
|||||||
const deleteButton = await screen.findByText('Delete');
|
const deleteButton = await screen.findByText('Delete');
|
||||||
fireEvent.click(deleteButton);
|
fireEvent.click(deleteButton);
|
||||||
|
|
||||||
await screen.findByText('Change added to a draft');
|
await screen.findByText('Change added to draft');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('edit dependency', async () => {
|
test('edit dependency', async () => {
|
||||||
|
@ -60,9 +60,8 @@ const useDeleteDependency = (project: string, featureId: string) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({
|
setToastData({
|
||||||
text: `${featureId} dependency will be removed`,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Change added to a draft',
|
text: 'Change added to draft',
|
||||||
});
|
});
|
||||||
await refetchChangeRequests();
|
await refetchChangeRequests();
|
||||||
} else {
|
} else {
|
||||||
@ -72,7 +71,7 @@ const useDeleteDependency = (project: string, featureId: string) => {
|
|||||||
eventType: 'dependency removed',
|
eventType: 'dependency removed',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setToastData({ title: 'Dependency removed', type: 'success' });
|
setToastData({ text: 'Dependency removed', type: 'success' });
|
||||||
await refetchFeature();
|
await refetchFeature();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -92,8 +92,7 @@ export const TagRow = ({ feature }: IFeatureOverviewSidePanelTagsProps) => {
|
|||||||
refetch();
|
refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Tag removed',
|
text: 'Tag removed',
|
||||||
text: 'Successfully removed tag',
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -71,8 +71,7 @@ export const FeatureOverviewSidePanelTags = ({
|
|||||||
refetch();
|
refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Tag deleted',
|
text: 'Tag deleted',
|
||||||
text: 'Successfully deleted tag',
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -10,7 +10,6 @@ import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
|||||||
import useFeatureApi from 'hooks/api/actions/useFeatureApi/useFeatureApi';
|
import useFeatureApi from 'hooks/api/actions/useFeatureApi/useFeatureApi';
|
||||||
import useFeatureTags from 'hooks/api/getters/useFeatureTags/useFeatureTags';
|
import useFeatureTags from 'hooks/api/getters/useFeatureTags/useFeatureTags';
|
||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
|
||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
import type { ITag, ITagType } from 'interfaces/tags';
|
import type { ITag, ITagType } from 'interfaces/tags';
|
||||||
import { type TagOption, TagsInput } from './TagsInput';
|
import { type TagOption, TagsInput } from './TagsInput';
|
||||||
@ -134,12 +133,9 @@ export const ManageTagsDialog = ({ open, setOpen }: IManageTagsProps) => {
|
|||||||
});
|
});
|
||||||
await refetch();
|
await refetch();
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
const message = formatUnknownError(error);
|
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: `Failed to add tag`,
|
text: 'Failed to add tag',
|
||||||
text: message,
|
|
||||||
confetti: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -179,9 +175,7 @@ export const ManageTagsDialog = ({ open, setOpen }: IManageTagsProps) => {
|
|||||||
differenceCount > 0 &&
|
differenceCount > 0 &&
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: `Updated tag${added.length > 1 ? 's' : ''} to flag`,
|
text: `Updated tag${added.length > 1 ? 's' : ''} to flag`,
|
||||||
text: getToastText(added.length, removed.length),
|
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setDifferenceCount(0);
|
setDifferenceCount(0);
|
||||||
|
@ -120,7 +120,7 @@ export const FeatureOverviewEnvironmentBody = ({
|
|||||||
);
|
);
|
||||||
refetchFeature();
|
refetchFeature();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Order of strategies updated',
|
text: 'Order of strategies updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -138,9 +138,8 @@ export const FeatureOverviewEnvironmentBody = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy execution order added to draft',
|
text: 'Strategy execution order added to draft',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
refetchChangeRequests();
|
refetchChangeRequests();
|
||||||
};
|
};
|
||||||
|
@ -101,7 +101,7 @@ export const ReleasePlan = ({
|
|||||||
id,
|
id,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Release plan "${name}" has been removed from ${featureName} in ${environment}`,
|
text: `Release plan "${name}" has been removed from ${featureName} in ${environment}`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
@ -121,7 +121,7 @@ export const ReleasePlan = ({
|
|||||||
milestone.id,
|
milestone.id,
|
||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `Milestone "${milestone.name}" has started`,
|
text: `Milestone "${milestone.name}" has started`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -34,7 +34,7 @@ const FeatureSettingsProject = () => {
|
|||||||
if (project) {
|
if (project) {
|
||||||
await changeFeatureProject(projectId, featureId, project);
|
await changeFeatureProject(projectId, featureId, project);
|
||||||
refetchFeature();
|
refetchFeature();
|
||||||
setToastData({ title: 'Project changed', type: 'success' });
|
setToastData({ text: 'Project changed', type: 'success' });
|
||||||
setShowConfirmDialog(false);
|
setShowConfirmDialog(false);
|
||||||
navigate(
|
navigate(
|
||||||
`/projects/${project}/features/${featureId}/settings`,
|
`/projects/${project}/features/${featureId}/settings`,
|
||||||
|
@ -117,7 +117,7 @@ export const FeatureEnvironmentVariants = () => {
|
|||||||
if (error) {
|
if (error) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: error,
|
text: error,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ export const FeatureEnvironmentVariants = () => {
|
|||||||
pushTitle && draftTitle ? '. ' : ''
|
pushTitle && draftTitle ? '. ' : ''
|
||||||
}${draftTitle}`;
|
}${draftTitle}`;
|
||||||
setToastData({
|
setToastData({
|
||||||
title,
|
text: title,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -202,7 +202,7 @@ export const FeatureEnvironmentVariants = () => {
|
|||||||
await updateVariants(selectedEnvironment, updatedVariants);
|
await updateVariants(selectedEnvironment, updatedVariants);
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: selectedEnvironment.crEnabled
|
text: selectedEnvironment.crEnabled
|
||||||
? `Variant changes added to draft`
|
? `Variant changes added to draft`
|
||||||
: 'Variants updated successfully',
|
: 'Variants updated successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -221,7 +221,7 @@ export const FeatureEnvironmentVariants = () => {
|
|||||||
const variants = fromEnvironment.variants ?? [];
|
const variants = fromEnvironment.variants ?? [];
|
||||||
await updateVariants(toEnvironment, variants);
|
await updateVariants(toEnvironment, variants);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: toEnvironment.crEnabled
|
text: toEnvironment.crEnabled
|
||||||
? 'Variants copy added to draft'
|
? 'Variants copy added to draft'
|
||||||
: 'Variants copied successfully',
|
: 'Variants copied successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
@ -224,7 +224,7 @@ export const FeatureView = () => {
|
|||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Could not copy feature name',
|
text: 'Could not copy feature name',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -82,7 +82,7 @@ export const FeatureTypeForm: VFC<FeatureTypeFormProps> = ({
|
|||||||
await updateFeatureTypeLifetime(featureType.id, value);
|
await updateFeatureTypeLifetime(featureType.id, value);
|
||||||
refetch();
|
refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Feature type updated',
|
text: 'Feature type updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
navigate('/feature-toggle-type');
|
navigate('/feature-toggle-type');
|
||||||
|
@ -77,8 +77,7 @@ export const FeedbackCESForm = ({ state, onClose }: IFeedbackCESFormProps) => {
|
|||||||
await sendFeedbackInput(form);
|
await sendFeedbackInput(form);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Feedback sent. Thank you!',
|
text: 'Feedback sent. Thank you!',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -260,7 +260,7 @@ export const FeedbackComponent = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
title: toastTitle,
|
text: toastTitle,
|
||||||
type: toastType,
|
type: toastType,
|
||||||
});
|
});
|
||||||
closeFeedback();
|
closeFeedback();
|
||||||
|
@ -33,8 +33,7 @@ export const IntegrationDelete: VFC<IIntegrationDeleteProps> = ({ id }) => {
|
|||||||
refetchAddons();
|
refetchAddons();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
text: 'Integration deleted',
|
||||||
text: 'Deleted addon successfully',
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -251,15 +251,14 @@ export const IntegrationForm: FC<IntegrationFormProps> = ({
|
|||||||
navigate('/integrations');
|
navigate('/integrations');
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Integration updated successfully',
|
text: 'Integration updated',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await createAddon(formValues as Omit<AddonSchema, 'id'>);
|
await createAddon(formValues as Omit<AddonSchema, 'id'>);
|
||||||
navigate('/integrations');
|
navigate('/integrations');
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
text: 'Integration created',
|
||||||
title: 'Integration created successfully',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -76,10 +76,9 @@ export const IntegrationCardMenu: VFC<IIntegrationCardMenuProps> = ({
|
|||||||
refetchAddons();
|
refetchAddons();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
|
||||||
text: !addon.enabled
|
text: !addon.enabled
|
||||||
? 'Integration is now enabled'
|
? 'Integration enabled'
|
||||||
: 'Integration is now disabled',
|
: 'Integration disabled',
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
@ -92,8 +91,7 @@ export const IntegrationCardMenu: VFC<IIntegrationCardMenuProps> = ({
|
|||||||
refetchAddons();
|
refetchAddons();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Success',
|
text: 'Integration deleted',
|
||||||
text: 'Integration has been deleted',
|
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastApiError(formatUnknownError(error));
|
setToastApiError(formatUnknownError(error));
|
||||||
|
@ -62,7 +62,7 @@ const CopyBlock: FC<{ title: string; code: string }> = ({ title, code }) => {
|
|||||||
copy(data);
|
copy(data);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Copied to clipboard',
|
text: 'Copied to clipboard',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const { setToastData } = useToast();
|
const { setToastData } = useToast();
|
||||||
|
@ -150,7 +150,7 @@ export const AdvancedPlayground: FC<{
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: `Failed to parse URL parameters: ${formatUnknownError(
|
text: `Failed to parse URL parameters: ${formatUnknownError(
|
||||||
error,
|
error,
|
||||||
)}`,
|
)}`,
|
||||||
});
|
});
|
||||||
@ -233,14 +233,12 @@ export const AdvancedPlayground: FC<{
|
|||||||
} else if (error instanceof SyntaxError) {
|
} else if (error instanceof SyntaxError) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: `Error parsing context: ${formatUnknownError(
|
text: `Error parsing context: ${formatUnknownError(error)}`,
|
||||||
error,
|
|
||||||
)}`,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: formatUnknownError(error),
|
text: formatUnknownError(error),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ export const PlaygroundCodeFieldset: VFC<IPlaygroundCodeFieldsetProps> = ({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: `Error parsing context: ${formatUnknownError(error)}`,
|
text: `Error parsing context: ${formatUnknownError(error)}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,9 +29,8 @@ export const ArchiveProjectDialogue = ({
|
|||||||
await archiveProject(project);
|
await archiveProject(project);
|
||||||
refetchProjectOverview();
|
refetchProjectOverview();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Archived project',
|
text: 'Project archived',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
text: 'Successfully archived project',
|
|
||||||
});
|
});
|
||||||
onSuccess?.();
|
onSuccess?.();
|
||||||
} catch (ex: unknown) {
|
} catch (ex: unknown) {
|
||||||
|
@ -178,9 +178,7 @@ export const CreateProjectDialog = ({
|
|||||||
refetchUser();
|
refetchUser();
|
||||||
navigate(`/projects/${createdProject.id}`);
|
navigate(`/projects/${createdProject.id}`);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Project created',
|
text: 'Project created',
|
||||||
text: 'Now you can add flags to this project',
|
|
||||||
confetti: true,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,9 +43,8 @@ export const DeleteProjectDialogue = ({
|
|||||||
refetchProjects();
|
refetchProjects();
|
||||||
refetchProjectArchive();
|
refetchProjectArchive();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Deleted project',
|
text: 'Project deleted',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
text: 'Successfully deleted project',
|
|
||||||
});
|
});
|
||||||
onSuccess?.();
|
onSuccess?.();
|
||||||
} catch (ex: unknown) {
|
} catch (ex: unknown) {
|
||||||
|
@ -89,14 +89,14 @@ export const ImportArea: FC<{
|
|||||||
setActiveTab('code');
|
setActiveTab('code');
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'File uploaded',
|
text: 'File uploaded',
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onError={(error) => {
|
onError={(error) => {
|
||||||
setImportPayload('');
|
setImportPayload('');
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: error,
|
text: error,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onDragStatusChange={setDragActive}
|
onDragStatusChange={setDragActive}
|
||||||
|
@ -80,7 +80,7 @@ export const ImportStage: FC<{
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: formatUnknownError(error),
|
text: formatUnknownError(error),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -124,7 +124,7 @@ export const ValidationStage: FC<{
|
|||||||
setValidJSON(false);
|
setValidJSON(false);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: formatUnknownError(error),
|
text: formatUnknownError(error),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -164,9 +164,7 @@ const CreateFeatureDialogContent = ({
|
|||||||
navigate(`/projects/${project}/features/${name}`);
|
navigate(`/projects/${project}/features/${name}`);
|
||||||
}
|
}
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Flag created successfully',
|
text: 'Flag created successfully',
|
||||||
text: 'Now you can start using your flag.',
|
|
||||||
confetti: true,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
|
@ -235,7 +235,7 @@ export const Project = () => {
|
|||||||
const text = created ? 'Project created' : 'Project updated';
|
const text = created ? 'Project created' : 'Project updated';
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: text,
|
text,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/* eslint-disable-next-line */
|
/* eslint-disable-next-line */
|
||||||
|
@ -81,7 +81,7 @@ export const ActionsCell: VFC<IActionsCellProps> = ({
|
|||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Could not copy feature name',
|
text: 'Could not copy feature name',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -170,8 +170,7 @@ export const useFeatureToggleSwitch: UseFeatureToggleSwitchType = (
|
|||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: `Enabled in ${config.environmentName}`,
|
text: `Enabled in ${config.environmentName}`,
|
||||||
text: `${config.featureId} is now available in ${config.environmentName} based on its defined strategies.`,
|
|
||||||
});
|
});
|
||||||
config.onSuccess?.();
|
config.onSuccess?.();
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -193,8 +192,7 @@ export const useFeatureToggleSwitch: UseFeatureToggleSwitchType = (
|
|||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: `Disabled in ${config.environmentName}`,
|
text: `Disabled in ${config.environmentName}`,
|
||||||
text: `${config.featureId} is unavailable in ${config.environmentName} and its strategies will no longer have any effect.`,
|
|
||||||
});
|
});
|
||||||
config.onSuccess?.();
|
config.onSuccess?.();
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
@ -62,21 +62,19 @@ export const ManageTags: VFC<IManageTagsProps> = ({
|
|||||||
const features = data.map(({ name }) => name);
|
const features = data.map(({ name }) => name);
|
||||||
const payload = { features, tags: { addedTags, removedTags } };
|
const payload = { features, tags: { addedTags, removedTags } };
|
||||||
try {
|
try {
|
||||||
await bulkUpdateTags(payload, projectId);
|
console.log(addedTags, removedTags, features);
|
||||||
const added = addedTags.length
|
const toastText = [
|
||||||
? `Added tags: ${addedTags
|
addedTags.length > 0 &&
|
||||||
.map(({ type, value }) => `${type}:${value}`)
|
`added ${addedTags.length} tag${addedTags.length > 1 ? 's' : ''}`,
|
||||||
.join(', ')}.`
|
removedTags.length > 0 &&
|
||||||
: '';
|
`removed ${removedTags.length} tag${removedTags.length > 1 ? 's' : ''}`,
|
||||||
const removed = removedTags.length
|
]
|
||||||
? `Removed tags: ${removedTags
|
.filter(Boolean)
|
||||||
.map(({ type, value }) => `${type}:${value}`)
|
.join(' and ');
|
||||||
.join(', ')}.`
|
|
||||||
: '';
|
|
||||||
|
|
||||||
|
await bulkUpdateTags(payload, projectId);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Tags updated',
|
text: toastText,
|
||||||
text: `${features.length} feature flags updated. ${added} ${removed}`,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
autoHideDuration: 12000,
|
autoHideDuration: 12000,
|
||||||
});
|
});
|
||||||
|
@ -58,7 +58,6 @@ export const MoreActions: VFC<IMoreActionsProps> = ({
|
|||||||
await staleFeatures(projectId, selectedIds);
|
await staleFeatures(projectId, selectedIds);
|
||||||
onChange?.();
|
onChange?.();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'State updated',
|
|
||||||
text: 'Feature flags marked as stale',
|
text: 'Feature flags marked as stale',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
@ -78,7 +77,6 @@ export const MoreActions: VFC<IMoreActionsProps> = ({
|
|||||||
await staleFeatures(projectId, selectedIds, false);
|
await staleFeatures(projectId, selectedIds, false);
|
||||||
onChange?.();
|
onChange?.();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'State updated',
|
|
||||||
text: 'Feature flags unmarked as stale',
|
text: 'Feature flags unmarked as stale',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
|
@ -96,8 +96,7 @@ export const ChangeRequestTable: VFC = () => {
|
|||||||
);
|
);
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Updated change request status',
|
text: 'Change request status updated',
|
||||||
text: 'Successfully updated change request status.',
|
|
||||||
});
|
});
|
||||||
await refetchChangeRequestConfig();
|
await refetchChangeRequestConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -159,7 +159,7 @@ export const ProjectActionsModal = ({
|
|||||||
await addActionSet(payload);
|
await addActionSet(payload);
|
||||||
}
|
}
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `action ${editing ? 'updated' : 'added'} successfully`,
|
text: `action ${editing ? 'updated' : 'added'} successfully`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -57,7 +57,7 @@ export const ProjectActionsTable = ({
|
|||||||
try {
|
try {
|
||||||
await toggleActionSet(action.id, enabled);
|
await toggleActionSet(action.id, enabled);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `"${action.name}" has been ${
|
text: `"${action.name}" has been ${
|
||||||
enabled ? 'enabled' : 'disabled'
|
enabled ? 'enabled' : 'disabled'
|
||||||
}`,
|
}`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -72,7 +72,7 @@ export const ProjectActionsTable = ({
|
|||||||
try {
|
try {
|
||||||
await removeActionSet(action.id);
|
await removeActionSet(action.id);
|
||||||
setToastData({
|
setToastData({
|
||||||
title: `"${action.name}" has been deleted`,
|
text: `"${action.name}" has been deleted`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
refetch();
|
refetch();
|
||||||
|
@ -107,9 +107,8 @@ const EditDefaultStrategy = () => {
|
|||||||
refetchSavedStrategySegments();
|
refetchSavedStrategySegments();
|
||||||
refetchProjectOverview();
|
refetchProjectOverview();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Default Strategy updated',
|
text: 'Default Strategy updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ export const UpdateEnterpriseSettings = ({
|
|||||||
await editProjectSettings(id, payload);
|
await editProjectSettings(id, payload);
|
||||||
refetch();
|
refetch();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Project information updated',
|
text: 'Project information updated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
trackPattern(featureNamingPattern);
|
trackPattern(featureNamingPattern);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user