Skip to content

Commit 7686476

Browse files
committed
refactor(sso): keep provider deletion in details
1 parent d4e62c2 commit 7686476

3 files changed

Lines changed: 5 additions & 32 deletions

File tree

apps/sim/ee/sso/components/sso-provider-list.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client'
22

33
import type { SsoProviderView } from '@/lib/api/contracts/auth'
4-
import { RowActionsMenu } from '@/app/workspace/[workspaceId]/settings/components/row-actions-menu'
54
import { SettingsPanel } from '@/app/workspace/[workspaceId]/settings/components/settings-panel'
65
import {
76
RESOURCE_LIST_STACK,
@@ -15,21 +14,19 @@ interface SsoProviderListProps {
1514
docsLink: string
1615
onAdd: () => void
1716
onOpen: (providerId: string) => void
18-
onDelete: (providerId: string) => void
1917
}
2018

2119
/**
2220
* The organization's identity providers.
2321
*
2422
* One provider serves each verified domain, so the rows read as a routing table:
25-
* which domain signs in where. The caller owns deletion and its confirmation.
23+
* which domain signs in where.
2624
*/
2725
export function SsoProviderList({
2826
providers,
2927
active,
3028
onAdd,
3129
onOpen,
32-
onDelete,
3330
docsLink,
3431
}: SsoProviderListProps) {
3532
return (
@@ -53,14 +50,6 @@ export function SsoProviderList({
5350
onClick={() => onOpen(providerId)}
5451
clickLabel={`Open ${providerId}`}
5552
navigable
56-
trailing={
57-
<RowActionsMenu
58-
label={`${providerId} actions`}
59-
actions={[
60-
{ label: 'Delete', onSelect: () => onDelete(providerId), destructive: true },
61-
]}
62-
/>
63-
}
6453
/>
6554
)
6655
})}

apps/sim/ee/sso/components/sso-settings.test.tsx

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,17 @@ vi.mock('@/ee/sso/hooks/sso', () => ({
224224
useSSOProviders: mockUseSSOProviders,
225225
}))
226226

227-
/** The resource row is design-system chrome; here it is a labelled button carrying its text and trailing menu. */
227+
/** The resource row is design-system chrome; here it is a labelled button carrying its text. */
228228
vi.mock('@/app/workspace/[workspaceId]/settings/components/settings-resource-row', () => ({
229229
RESOURCE_LIST_STACK: '',
230230
SettingsResourceRow: ({
231231
title,
232232
description,
233-
trailing,
234233
clickLabel,
235234
onClick,
236235
}: {
237236
title: ReactNode
238237
description?: ReactNode
239-
trailing?: ReactNode
240238
clickLabel?: string
241239
onClick?: () => void
242240
}) => (
@@ -245,24 +243,10 @@ vi.mock('@/app/workspace/[workspaceId]/settings/components/settings-resource-row
245243
{title}
246244
{description}
247245
</button>
248-
{trailing}
249246
</div>
250247
),
251248
}))
252249

253-
/** The row menu is a dropdown; here each action is a plain button so the delete path is reachable. */
254-
vi.mock('@/app/workspace/[workspaceId]/settings/components/row-actions-menu', () => ({
255-
RowActionsMenu: ({ actions }: { actions: Array<{ label: string; onSelect: () => void }> }) => (
256-
<span>
257-
{actions.map((action) => (
258-
<button key={action.label} type='button' onClick={action.onSelect}>
259-
{action.label}
260-
</button>
261-
))}
262-
</span>
263-
),
264-
}))
265-
266250
vi.mock('@/hooks/queries/organization', () => ({
267251
useOrganizationBilling: mockUseOrganizationBilling,
268252
}))
@@ -765,11 +749,12 @@ describe('SSO provider list', () => {
765749
expect(findButton('Identity providers')).toBeUndefined()
766750
})
767751

768-
it('deletes a provider after confirmation', async () => {
752+
it('deletes a provider from its details after confirmation', async () => {
769753
const mutateAsync = vi.fn().mockResolvedValue({ success: true })
770754
mockUseDeleteSSOProvider.mockReturnValue({ isPending: false, mutateAsync })
771755
renderSso('org-a')
772756

757+
openProvider('provider-a')
773758
act(() => findButton('Delete')?.click())
774759
expect(container.querySelector('[role="dialog"]')).toHaveTextContent('Delete identity provider')
775760

@@ -781,7 +766,7 @@ describe('SSO provider list', () => {
781766
expect(mutateAsync).toHaveBeenCalledWith('provider-a')
782767
})
783768

784-
it('offers delete on the provider detail as well', () => {
769+
it('offers delete on the provider detail', () => {
785770
renderSso('org-a')
786771
openProvider('provider-a')
787772

apps/sim/ee/sso/components/sso-settings.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
125125
docsLink={DOCS_LINKS['sign-in']}
126126
onAdd={() => void setParams({ provider: null, createProvider: true })}
127127
onOpen={(providerId) => void setParams({ provider: providerId, createProvider: null })}
128-
onDelete={setPendingDeleteId}
129128
/>
130129
) : (
131130
<SsoProviderSettings

0 commit comments

Comments
 (0)