Skip to content

The open alternative to Salesforce, designed for AI.

Show the import progress of an account on the App preferences rows (#28997)

nitin853c2b28a44f
diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsx
index d0accd32fbc..96043fad9f8 100644
--- a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsx
@@ -17,9 +17,10 @@ import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';
import { themeCssVariables, useTheme } from 'twenty-ui/theme';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
-const SYNC_STATUSES_NEEDING_ACTION: ReadonlySet<SyncStatus> = new Set([
+const DISPLAYED_SYNC_STATUSES: ReadonlySet<SyncStatus> = new Set([
SyncStatus.FAILED,
SyncStatus.PENDING_CONFIGURATION,
+ SyncStatus.IMPORTING,
]);
type SettingsAccountGroupTableRowProps = {
@@ -43,10 +44,10 @@ export const SettingsAccountGroupTableRow = ({
const { messageChannel, calendarChannel } =
getConnectedAccountSettingsChannels(builtInAccount);
const hasSettings = isDefined(messageChannel) || isDefined(calendarChannel);
- const needsAction =
+ const shouldShowSyncStatus =
isDefined(builtInAccount) &&
(isDefined(builtInAccount.archivedAt) ||
- SYNC_STATUSES_NEEDING_ACTION.has(
+ DISPLAYED_SYNC_STATUSES.has(
computeSyncStatus(
builtInAccount.messageChannels[0],
builtInAccount.calendarChannels[0],
@@ -61,7 +62,7 @@ export const SettingsAccountGroupTableRow = ({
>
<ProviderIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />
<OverflowingTextWithTooltip text={group.handle} />
- {needsAction && (
+ {shouldShowSyncStatus && (
<SettingsConnectedAccountSyncStatus account={builtInAccount} />
)}
</TableCell>
diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsBuiltInAccountApp.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsBuiltInAccountApp.tsx
index a144b2fa839..1bce1a5f760 100644
--- a/packages/twenty-front/src/pages/settings/accounts/SettingsBuiltInAccountApp.tsx
+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsBuiltInAccountApp.tsx
@@ -10,6 +10,7 @@ import { useEnabledBuiltInAccountApps } from '@/settings/app-preferences/hooks/u
import { useMyAccountGroups } from '@/settings/app-preferences/hooks/useMyAccountGroups';
import { getConnectedAccountSettingsChannels } from '@/settings/app-preferences/utils/getConnectedAccountSettingsChannels';
import { getBuiltInAccountAppChannelTabsVisibility } from '@/settings/app-preferences/utils/getBuiltInAccountAppChannelTabsVisibility';
+import { SettingsAccountsMessageChannelsSSEEffect } from '@/settings/accounts/components/SettingsAccountsMessageChannelsSSEEffect';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';
import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';
@@ -195,6 +196,7 @@ export const SettingsBuiltInAccountApp = () => {
/>
}
>
+ <SettingsAccountsMessageChannelsSSEEffect />
<SettingsPageContainer>{renderContent()}</SettingsPageContainer>
</SettingsPageLayout>
);
diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx
index 0faac44424b..161086005af 100644
--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx
+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx
@@ -7,6 +7,7 @@ import {
type PageDecoratorArgs,
} from '~/testing/decorators/PageDecorator';
+import { dispatchMetadataOperationBrowserEvent } from '@/browser-event/utils/dispatchMetadataOperationBrowserEvent';
import { isMicrosoftCalendarEnabledState } from '@/client-config/states/isMicrosoftCalendarEnabledState';
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
import { SettingsBuiltInAccountApp } from '~/pages/settings/accounts/SettingsBuiltInAccountApp';
@@ -17,6 +18,8 @@ import {
CALENDAR_CHANNELS,
CONNECTED_ACCOUNTS,
GOOGLE_ACCOUNT_ID,
+ GOOGLE_MESSAGE_CHANNEL_ID,
+ MESSAGE_CHANNELS,
MICROSOFT_ACCOUNT_ID,
seedAccountGroupsStory,
} from '~/pages/settings/accounts/__stories__/mockedAccountGroups';
@@ -329,3 +332,48 @@ export const ReconnectReturnsToTheAppPage: Story = {
);
},
};
+
+export const ImportingAccountShowsLiveProgress: Story = {
+ parameters: {
+ msw: {
+ handlers: [
+ graphql.query('MyMessageChannels', () =>
+ HttpResponse.json({
+ data: {
+ myMessageChannels: MESSAGE_CHANNELS.map((channel) =>
+ channel.connectedAccountId === GOOGLE_ACCOUNT_ID
+ ? { ...channel, syncStatus: 'ONGOING', importProgress: 42 }
+ : channel,
+ ),
+ },
+ }),
+ ),
+ ...ACCOUNT_GROUPS_GRAPHQL_HANDLERS,
+ ],
+ },
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ await userEvent.click(
+ await canvas.findByTestId('tab-general', undefined, { timeout: 3000 }),
+ );
+
+ expect(await canvas.findByText('Importing 42%')).toBeVisible();
+
+ dispatchMetadataOperationBrowserEvent({
+ metadataName: 'messageChannel',
+ operation: {
+ type: 'update',
+ updatedRecord: {
+ id: GOOGLE_MESSAGE_CHANNEL_ID,
+ syncStatus: 'ONGOING',
+ syncStage: 'MESSAGES_IMPORT_ONGOING',
+ importProgress: 43,
+ },
+ },
+ });
+
+ expect(await canvas.findByText('Importing 43%')).toBeVisible();
+ },
+};
diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.ts b/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.ts
index 4dd990c53ae..487276cac3c 100644
--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.ts
+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.ts
@@ -27,6 +27,7 @@ const CREATED_AT = '2026-09-01T00:00:00.000Z';
export const GOOGLE_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000011';
export const MICROSOFT_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000014';
+export const GOOGLE_MESSAGE_CHANNEL_ID = '20202020-1a2b-4c3d-8e4f-000000000031';
export const FATHOM_ONLY_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000013';
const FATHOM_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000012';
const MY_SHARED_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000015';
@@ -85,6 +86,7 @@ const buildMessageChannel = (
syncStatus: 'ACTIVE',
syncStage: 'MESSAGE_LIST_FETCH_PENDING',
syncStageStartedAt: null,
+ importProgress: null,
connectedAccountId,
connectedAccount: {
__typename: 'ConnectedAccountHandleDTO',
@@ -187,11 +189,8 @@ export const CONNECTED_ACCOUNTS = [
}),
];
-const MESSAGE_CHANNELS = [
- buildMessageChannel(
- '20202020-1a2b-4c3d-8e4f-000000000031',
- GOOGLE_ACCOUNT_ID,
- ),
+export const MESSAGE_CHANNELS = [
+ buildMessageChannel(GOOGLE_MESSAGE_CHANNEL_ID, GOOGLE_ACCOUNT_ID),
buildMessageChannel(
'20202020-1a2b-4c3d-8e4f-000000000032',
FATHOM_ONLY_ACCOUNT_ID,