Skip to content

The open alternative to Salesforce, designed for AI.

Show uninstall progress from 10% instead of 0% (#28002)

martmull6e2a555ef69a
diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx
index 3709d6e373c..50af3c67026 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx
@@ -10,6 +10,8 @@ import { IconTrash } from 'twenty-ui/icon';
import { Button } from 'twenty-ui/primitives/input';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
+const MINIMUM_DISPLAYED_UNINSTALL_PROGRESS = 10;
+
type SettingsApplicationUninstallButtonProps = {
onUninstall: () => void;
isUninstalling?: boolean;
@@ -28,7 +30,7 @@ export const SettingsApplicationUninstallButton = ({
const confirmationValue = t`yes`;
const displayedUninstallProgress = formatQueueJobProgressLabel(
- uninstallProgress ?? 0,
+ Math.max(uninstallProgress ?? 0, MINIMUM_DISPLAYED_UNINSTALL_PROGRESS),
);
const isDisabled = isNonEmptyString(disabledReason);
diff --git a/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsx b/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsx
index 8a6dcf83ed7..4e643ac54ca 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsx
@@ -22,14 +22,20 @@ const DISABLED_REASON =
const renderUninstallButton = ({
disabledReason,
+ isUninstalling,
+ uninstallProgress,
}: {
disabledReason?: string;
+ isUninstalling?: boolean;
+ uninstallProgress?: number;
} = {}) =>
render(
<I18nProvider i18n={i18n}>
<SettingsApplicationUninstallButton
onUninstall={jest.fn()}
disabledReason={disabledReason}
+ isUninstalling={isUninstalling}
+ uninstallProgress={uninstallProgress}
/>
</I18nProvider>,
);
@@ -84,4 +90,28 @@ describe('SettingsApplicationUninstallButton', () => {
DISABLED_REASON,
);
});
+
+ it('starts the uninstall progress at 10% before the first progress event', () => {
+ renderUninstallButton({ isUninstalling: true });
+
+ expect(
+ screen.getByRole('button', { name: 'Uninstalling (10%)' }),
+ ).toBeInTheDocument();
+ });
+
+ it('keeps the uninstall progress at 10% while the job reports less', () => {
+ renderUninstallButton({ isUninstalling: true, uninstallProgress: 0 });
+
+ expect(
+ screen.getByRole('button', { name: 'Uninstalling (10%)' }),
+ ).toBeInTheDocument();
+ });
+
+ it('shows the uninstall progress once it passes 10%', () => {
+ renderUninstallButton({ isUninstalling: true, uninstallProgress: 60 });
+
+ expect(
+ screen.getByRole('button', { name: 'Uninstalling (60%)' }),
+ ).toBeInTheDocument();
+ });
});