|
3 | 3 | import { useParams } from 'next/navigation' |
4 | 4 | import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' |
5 | 5 | import { getEnv } from '@/lib/env' |
| 6 | +import { getProviderIdFromServiceId } from '@/lib/oauth' |
6 | 7 | import { |
7 | 8 | ConfluenceFileSelector, |
8 | 9 | DiscordChannelSelector, |
@@ -73,8 +74,12 @@ export function FileSelectorInput({ |
73 | 74 | const [botTokenValue] = useSubBlockValue(blockId, 'botToken') |
74 | 75 |
|
75 | 76 | // Determine if the persisted credential belongs to the current viewer |
| 77 | + // Use service providerId where available (e.g., onedrive/sharepoint) instead of base provider ("microsoft") |
| 78 | + const foreignCheckProvider = subBlock.serviceId |
| 79 | + ? getProviderIdFromServiceId(subBlock.serviceId) |
| 80 | + : (subBlock.provider as string) || '' |
76 | 81 | const { isForeignCredential } = useForeignCredential( |
77 | | - subBlock.provider || subBlock.serviceId || '', |
| 82 | + foreignCheckProvider, |
78 | 83 | (connectedCredential as string) || '' |
79 | 84 | ) |
80 | 85 |
|
@@ -224,12 +229,6 @@ export function FileSelectorInput({ |
224 | 229 | } |
225 | 230 | onChange={(issueKey) => { |
226 | 231 | collaborativeSetSubblockValue(blockId, subBlock.id, issueKey) |
227 | | - // Clear related fields when a new issue is selected |
228 | | - collaborativeSetSubblockValue(blockId, 'summary', '') |
229 | | - collaborativeSetSubblockValue(blockId, 'description', '') |
230 | | - if (!issueKey) { |
231 | | - collaborativeSetSubblockValue(blockId, 'manualIssueKey', '') |
232 | | - } |
233 | 232 | }} |
234 | 233 | domain={domain} |
235 | 234 | provider='jira' |
@@ -353,7 +352,7 @@ export function FileSelectorInput({ |
353 | 352 | requiredScopes={subBlock.requiredScopes || []} |
354 | 353 | serviceId={subBlock.serviceId} |
355 | 354 | label={subBlock.placeholder || 'Select SharePoint site'} |
356 | | - disabled={disabled || !credential} |
| 355 | + disabled={finalDisabled} |
357 | 356 | showPreview={true} |
358 | 357 | workflowId={activeWorkflowId || ''} |
359 | 358 | credentialId={credential} |
@@ -389,7 +388,7 @@ export function FileSelectorInput({ |
389 | 388 | requiredScopes={subBlock.requiredScopes || []} |
390 | 389 | serviceId='microsoft-planner' |
391 | 390 | label={subBlock.placeholder || 'Select task'} |
392 | | - disabled={disabled || !credential || !planId} |
| 391 | + disabled={finalDisabled} |
393 | 392 | showPreview={true} |
394 | 393 | planId={planId} |
395 | 394 | workflowId={activeWorkflowId || ''} |
@@ -447,7 +446,7 @@ export function FileSelectorInput({ |
447 | 446 | requiredScopes={subBlock.requiredScopes || []} |
448 | 447 | serviceId={subBlock.serviceId} |
449 | 448 | label={subBlock.placeholder || 'Select Teams message location'} |
450 | | - disabled={disabled || !credential} |
| 449 | + disabled={finalDisabled} |
451 | 450 | showPreview={true} |
452 | 451 | credential={credential} |
453 | 452 | selectionType={selectionType} |
@@ -490,7 +489,7 @@ export function FileSelectorInput({ |
490 | 489 | requiredScopes={subBlock.requiredScopes || []} |
491 | 490 | serviceId={subBlock.serviceId} |
492 | 491 | label={subBlock.placeholder || `Select ${itemType}`} |
493 | | - disabled={disabled || !credential} |
| 492 | + disabled={finalDisabled} |
494 | 493 | showPreview={true} |
495 | 494 | credentialId={credential} |
496 | 495 | itemType={itemType} |
@@ -531,7 +530,7 @@ export function FileSelectorInput({ |
531 | 530 | provider={provider} |
532 | 531 | requiredScopes={subBlock.requiredScopes || []} |
533 | 532 | label={subBlock.placeholder || 'Select file'} |
534 | | - disabled={disabled || !credential} |
| 533 | + disabled={finalDisabled} |
535 | 534 | serviceId={subBlock.serviceId} |
536 | 535 | mimeTypeFilter={subBlock.mimeType} |
537 | 536 | showPreview={true} |
|
0 commit comments