Skip to content

Commit 3ad0f62

Browse files
committed
canonical credential id entry
1 parent ff13b1f commit 3ad0f62

40 files changed

Lines changed: 532 additions & 43 deletions

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credentials/credentials-manager.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { createElement, useEffect, useMemo, useState } from 'react'
44
import { createLogger } from '@sim/logger'
5-
import { AlertTriangle, Plus, RefreshCw, Search, Share2, Trash2 } from 'lucide-react'
5+
import { AlertTriangle, Check, Copy, Plus, RefreshCw, Search, Share2, Trash2 } from 'lucide-react'
66
import { useParams } from 'next/navigation'
77
import {
88
Badge,
@@ -185,6 +185,7 @@ export function CredentialsManager() {
185185
const [selectedDescriptionDraft, setSelectedDescriptionDraft] = useState('')
186186
const [selectedDisplayNameDraft, setSelectedDisplayNameDraft] = useState('')
187187
const [showCreateOAuthRequiredModal, setShowCreateOAuthRequiredModal] = useState(false)
188+
const [copyIdSuccess, setCopyIdSuccess] = useState(false)
188189
const { data: session } = useSession()
189190
const currentUserId = session?.user?.id || ''
190191

@@ -1103,7 +1104,29 @@ export function CredentialsManager() {
11031104
{selectedCredential.type === 'oauth' ? (
11041105
<div className='flex flex-col gap-[10px]'>
11051106
<div>
1106-
<Label htmlFor='credential-display-name'>Display Name</Label>
1107+
<div className='flex items-center gap-[6px]'>
1108+
<Label htmlFor='credential-display-name'>Display Name</Label>
1109+
<Tooltip.Root>
1110+
<Tooltip.Trigger asChild>
1111+
<Button
1112+
variant='ghost'
1113+
className='h-[20px] w-[20px] p-0'
1114+
onClick={() => {
1115+
navigator.clipboard.writeText(selectedCredential.id)
1116+
setCopyIdSuccess(true)
1117+
setTimeout(() => setCopyIdSuccess(false), 2000)
1118+
}}
1119+
>
1120+
{copyIdSuccess ? (
1121+
<Check className='h-[11px] w-[11px]' />
1122+
) : (
1123+
<Copy className='h-[11px] w-[11px]' />
1124+
)}
1125+
</Button>
1126+
</Tooltip.Trigger>
1127+
<Tooltip.Content>Copy credential ID</Tooltip.Content>
1128+
</Tooltip.Root>
1129+
</div>
11071130
<Input
11081131
id='credential-display-name'
11091132
value={selectedDisplayNameDraft}

apps/sim/blocks/blocks/agent.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ Return ONLY the JSON array.`,
142142
title: 'Google Cloud Account',
143143
type: 'oauth-input',
144144
serviceId: 'vertex-ai',
145+
canonicalParamId: 'oauthCredential',
146+
mode: 'basic',
145147
requiredScopes: ['https://www.googleapis.com/auth/cloud-platform'],
146148
placeholder: 'Select Google Cloud account',
147149
required: true,
@@ -150,6 +152,19 @@ Return ONLY the JSON array.`,
150152
value: providers.vertex.models,
151153
},
152154
},
155+
{
156+
id: 'manualCredential',
157+
title: 'Google Cloud Account',
158+
type: 'short-input',
159+
canonicalParamId: 'oauthCredential',
160+
mode: 'advanced',
161+
placeholder: 'Enter credential ID',
162+
required: true,
163+
condition: {
164+
field: 'model',
165+
value: providers.vertex.models,
166+
},
167+
},
153168
{
154169
id: 'reasoningEffort',
155170
title: 'Reasoning Effort',

apps/sim/blocks/blocks/airtable.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export const AirtableBlock: BlockConfig<AirtableResponse> = {
3232
id: 'credential',
3333
title: 'Airtable Account',
3434
type: 'oauth-input',
35+
canonicalParamId: 'oauthCredential',
36+
mode: 'basic',
3537
serviceId: 'airtable',
3638
requiredScopes: [
3739
'data.records:read',
@@ -42,6 +44,15 @@ export const AirtableBlock: BlockConfig<AirtableResponse> = {
4244
placeholder: 'Select Airtable account',
4345
required: true,
4446
},
47+
{
48+
id: 'manualCredential',
49+
title: 'Airtable Account',
50+
type: 'short-input',
51+
canonicalParamId: 'oauthCredential',
52+
mode: 'advanced',
53+
placeholder: 'Enter credential ID',
54+
required: true,
55+
},
4556
{
4657
id: 'baseId',
4758
title: 'Base ID',

apps/sim/blocks/blocks/asana.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,22 @@ export const AsanaBlock: BlockConfig<AsanaResponse> = {
3232
id: 'credential',
3333
title: 'Asana Account',
3434
type: 'oauth-input',
35-
35+
canonicalParamId: 'oauthCredential',
36+
mode: 'basic',
3637
required: true,
3738
serviceId: 'asana',
3839
requiredScopes: ['default'],
3940
placeholder: 'Select Asana account',
4041
},
42+
{
43+
id: 'manualCredential',
44+
title: 'Asana Account',
45+
type: 'short-input',
46+
canonicalParamId: 'oauthCredential',
47+
mode: 'advanced',
48+
placeholder: 'Enter credential ID',
49+
required: true,
50+
},
4151
{
4252
id: 'workspace',
4353
title: 'Workspace GID',

apps/sim/blocks/blocks/calcom.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,20 @@ export const CalComBlock: BlockConfig<ToolResponse> = {
4949
title: 'Cal.com Account',
5050
type: 'oauth-input',
5151
serviceId: 'calcom',
52+
canonicalParamId: 'oauthCredential',
53+
mode: 'basic',
5254
placeholder: 'Select Cal.com account',
5355
required: true,
5456
},
57+
{
58+
id: 'manualCredential',
59+
title: 'Cal.com Account',
60+
type: 'short-input',
61+
canonicalParamId: 'oauthCredential',
62+
mode: 'advanced',
63+
placeholder: 'Enter credential ID',
64+
required: true,
65+
},
5566

5667
// === Create Booking fields ===
5768
{

apps/sim/blocks/blocks/confluence.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export const ConfluenceBlock: BlockConfig<ConfluenceResponse> = {
5151
id: 'credential',
5252
title: 'Confluence Account',
5353
type: 'oauth-input',
54+
canonicalParamId: 'oauthCredential',
55+
mode: 'basic',
5456
serviceId: 'confluence',
5557
requiredScopes: [
5658
'read:confluence-content.all',
@@ -85,6 +87,15 @@ export const ConfluenceBlock: BlockConfig<ConfluenceResponse> = {
8587
placeholder: 'Select Confluence account',
8688
required: true,
8789
},
90+
{
91+
id: 'manualCredential',
92+
title: 'Confluence Account',
93+
type: 'short-input',
94+
canonicalParamId: 'oauthCredential',
95+
mode: 'advanced',
96+
placeholder: 'Enter credential ID',
97+
required: true,
98+
},
8899
{
89100
id: 'pageId',
90101
title: 'Select Page',
@@ -424,6 +435,8 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
424435
id: 'credential',
425436
title: 'Confluence Account',
426437
type: 'oauth-input',
438+
canonicalParamId: 'oauthCredential',
439+
mode: 'basic',
427440
serviceId: 'confluence',
428441
requiredScopes: [
429442
'read:confluence-content.all',
@@ -458,6 +471,15 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
458471
placeholder: 'Select Confluence account',
459472
required: true,
460473
},
474+
{
475+
id: 'manualCredential',
476+
title: 'Confluence Account',
477+
type: 'short-input',
478+
canonicalParamId: 'oauthCredential',
479+
mode: 'advanced',
480+
placeholder: 'Enter credential ID',
481+
required: true,
482+
},
461483
{
462484
id: 'domain',
463485
title: 'Domain',

apps/sim/blocks/blocks/dropbox.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export const DropboxBlock: BlockConfig<DropboxResponse> = {
3838
id: 'credential',
3939
title: 'Dropbox Account',
4040
type: 'oauth-input',
41+
canonicalParamId: 'oauthCredential',
42+
mode: 'basic',
4143
serviceId: 'dropbox',
4244
requiredScopes: [
4345
'account_info.read',
@@ -51,6 +53,15 @@ export const DropboxBlock: BlockConfig<DropboxResponse> = {
5153
placeholder: 'Select Dropbox account',
5254
required: true,
5355
},
56+
{
57+
id: 'manualCredential',
58+
title: 'Dropbox Account',
59+
type: 'short-input',
60+
canonicalParamId: 'oauthCredential',
61+
mode: 'advanced',
62+
placeholder: 'Enter credential ID',
63+
required: true,
64+
},
5465
// Upload operation inputs
5566
{
5667
id: 'path',

apps/sim/blocks/blocks/gmail.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
7676
id: 'credential',
7777
title: 'Gmail Account',
7878
type: 'oauth-input',
79+
canonicalParamId: 'oauthCredential',
80+
mode: 'basic',
7981
serviceId: 'gmail',
8082
requiredScopes: [
8183
'https://www.googleapis.com/auth/gmail.send',
@@ -85,6 +87,15 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
8587
placeholder: 'Select Gmail account',
8688
required: true,
8789
},
90+
{
91+
id: 'manualCredential',
92+
title: 'Gmail Account',
93+
type: 'short-input',
94+
canonicalParamId: 'oauthCredential',
95+
mode: 'advanced',
96+
placeholder: 'Enter credential ID',
97+
required: true,
98+
},
8899
// Send Email Fields
89100
{
90101
id: 'to',
@@ -406,7 +417,7 @@ Return ONLY the search query - no explanations, no extra text.`,
406417
tool: selectGmailToolId,
407418
params: (params) => {
408419
const {
409-
credential,
420+
oauthCredential,
410421
folder,
411422
addLabelIds,
412423
removeLabelIds,
@@ -467,7 +478,7 @@ Return ONLY the search query - no explanations, no extra text.`,
467478

468479
return {
469480
...rest,
470-
credential,
481+
credential: oauthCredential,
471482
...(normalizedAttachments && { attachments: normalizedAttachments }),
472483
}
473484
},

apps/sim/blocks/blocks/google_calendar.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,22 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
3939
id: 'credential',
4040
title: 'Google Calendar Account',
4141
type: 'oauth-input',
42+
canonicalParamId: 'oauthCredential',
43+
mode: 'basic',
4244
required: true,
4345
serviceId: 'google-calendar',
4446
requiredScopes: ['https://www.googleapis.com/auth/calendar'],
4547
placeholder: 'Select Google Calendar account',
4648
},
49+
{
50+
id: 'manualCredential',
51+
title: 'Google Calendar Account',
52+
type: 'short-input',
53+
canonicalParamId: 'oauthCredential',
54+
mode: 'advanced',
55+
placeholder: 'Enter credential ID',
56+
required: true,
57+
},
4758
// Calendar selector (basic mode) - not needed for list_calendars
4859
{
4960
id: 'calendarId',
@@ -576,7 +587,7 @@ Return ONLY the natural language event text - no explanations.`,
576587
}
577588

578589
return {
579-
credential,
590+
credential: oauthCredential,
580591
...processedParams,
581592
}
582593
},

apps/sim/blocks/blocks/google_docs.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
3232
id: 'credential',
3333
title: 'Google Account',
3434
type: 'oauth-input',
35+
canonicalParamId: 'oauthCredential',
36+
mode: 'basic',
3537
required: true,
3638
serviceId: 'google-docs',
3739
requiredScopes: [
@@ -40,6 +42,15 @@ export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
4042
],
4143
placeholder: 'Select Google account',
4244
},
45+
{
46+
id: 'manualCredential',
47+
title: 'Google Account',
48+
type: 'short-input',
49+
canonicalParamId: 'oauthCredential',
50+
mode: 'advanced',
51+
placeholder: 'Enter credential ID',
52+
required: true,
53+
},
4354
// Document selector (basic mode)
4455
{
4556
id: 'documentId',
@@ -157,7 +168,7 @@ Return ONLY the document content - no explanations, no extra text.`,
157168
}
158169
},
159170
params: (params) => {
160-
const { credential, documentId, folderId, ...rest } = params
171+
const { oauthCredential, documentId, folderId, ...rest } = params
161172

162173
const effectiveDocumentId = documentId ? String(documentId).trim() : ''
163174
const effectiveFolderId = folderId ? String(folderId).trim() : ''
@@ -166,7 +177,7 @@ Return ONLY the document content - no explanations, no extra text.`,
166177
...rest,
167178
documentId: effectiveDocumentId || undefined,
168179
folderId: effectiveFolderId || undefined,
169-
credential,
180+
credential: oauthCredential,
170181
}
171182
},
172183
},

0 commit comments

Comments
 (0)