@@ -91,6 +91,7 @@ export interface ConnectorSettingsFieldsProps {
9191 hasMaxAccess : boolean
9292 isSaving : boolean
9393 error : string | null
94+ saveBlockedReason ?: string
9495 access : ConnectorAccessSelection
9596 onAccessChange : ( access : ConnectorAccessSelection ) => void
9697 canAdmin : boolean
@@ -133,6 +134,7 @@ export function ConnectorSettingsFields({
133134 hasMaxAccess,
134135 isSaving,
135136 error,
137+ saveBlockedReason,
136138 access,
137139 onAccessChange,
138140 canAdmin,
@@ -204,7 +206,9 @@ export function ConnectorSettingsFields({
204206 } )
205207 useCredentialRefreshTriggers ( refetchCredentials , providerId ?? '' , scope )
206208 const [ browseCredentialId , setBrowseCredentialId ] = useState < string | null > ( null )
207- const selectorCredentialId = syncsPerMember ? browseCredentialId : credentialId
209+ const selectorCredentialId = syncsPerMember
210+ ? browseCredentialId
211+ : ( workspaceCredentialId ?? credentialId )
208212 const selectorCredential = rawCredentials . find ( ( item ) => item . id === selectorCredentialId )
209213 const installations = rawCredentials . filter (
210214 ( credential ) => credential . provider === GITHUB_INSTALLATION_PROVIDER_ID
@@ -228,6 +232,7 @@ export function ConnectorSettingsFields({
228232 [ rawCredentials , connectorConfig , access . accessMode ]
229233 )
230234
235+ const hideFixedAccessMode = isSearchIndex && needsWorkspaceCredential && canAdmin && allowAdmin
231236 const hiddenCapFieldIds = derivedAclCapFieldIds ( connectorConfig , access . accessMode )
232237 const isOptionalSetupField = ( field : ConnectorConfigField ) =>
233238 Boolean ( gitlabPermissions && connectorConfig ) &&
@@ -330,70 +335,67 @@ export function ConnectorSettingsFields({
330335 disabled = { isSaving || ! canAdmin }
331336 />
332337 ) }
333- { connectorConfig && showAccessField && ! isGitHubInstallationSource && (
334- < ConnectorAccessField
335- scope = { scope }
336- connectorConfig = { connectorConfig }
337- value = { access }
338- onChange = { onAccessChange }
339- canAdmin = { canAdmin }
340- lockAccessMode = { isSearchIndex }
341- isAvailabilityReady = { availability . isReady }
342- allowMembers = { allowMembers }
343- allowAdmin = { allowAdmin }
344- allowWorkspace = { allowWorkspace }
345- disabled = { isSaving }
346- footer = {
347- canReenableMemberSync ? (
348- < div className = 'flex flex-col gap-2' >
349- < div >
350- < Chip
351- variant = 'primary'
352- onClick = { onApplyAccess }
353- disabled = { ! accessComplete || isSaving }
354- >
355- { isSwitchingAccess ? 'Re-enabling…' : 'Re-enable per-member sync' }
356- </ Chip >
357- </ div >
358- < p className = 'text-[var(--text-muted)] text-caption leading-snug' >
359- Members and their documents are kept; the next sync restores their access.
360- </ p >
361- </ div >
362- ) : accessDirty ? (
363- < div className = 'flex flex-col gap-2' >
364- < div className = 'flex items-center gap-2' >
365- < Chip
366- variant = 'primary'
367- onClick = { onApplyAccess }
368- disabled = { ! accessComplete || isSaving }
369- >
370- { isSwitchingAccess
371- ? 'Switching…'
372- : isContentCredentialChange
373- ? isSearchIndex
374- ? requiresServiceAccount
375- ? 'Change service account'
376- : 'Change account'
377- : 'Change indexing account'
378- : 'Apply connection method' }
379- </ Chip >
380- < Chip onClick = { onResetAccess } disabled = { isSaving } >
381- { accessSetupHint ? 'Edit settings' : 'Cancel' }
382- </ Chip >
338+ { connectorConfig &&
339+ showAccessField &&
340+ ! isGitHubInstallationSource &&
341+ ! hideFixedAccessMode && (
342+ < ConnectorAccessField
343+ scope = { scope }
344+ connectorConfig = { connectorConfig }
345+ value = { access }
346+ onChange = { onAccessChange }
347+ canAdmin = { canAdmin }
348+ lockAccessMode = { isSearchIndex }
349+ isAvailabilityReady = { availability . isReady }
350+ allowMembers = { allowMembers }
351+ allowAdmin = { allowAdmin }
352+ allowWorkspace = { allowWorkspace }
353+ disabled = { isSaving }
354+ footer = {
355+ canReenableMemberSync ? (
356+ < div className = 'flex flex-col gap-2' >
357+ < div >
358+ < Chip
359+ variant = 'primary'
360+ onClick = { onApplyAccess }
361+ disabled = { ! accessComplete || isSaving }
362+ >
363+ { isSwitchingAccess ? 'Re-enabling…' : 'Re-enable per-member sync' }
364+ </ Chip >
365+ </ div >
366+ < p className = 'text-[var(--text-muted)] text-caption leading-snug' >
367+ Members and their documents are kept; the next sync restores their access.
368+ </ p >
383369 </ div >
384- < p className = 'text-[var(--text-muted)] text-caption leading-snug' >
385- { accessSetupHint ??
386- ( isContentCredentialChange
387- ? syncsPerMember
370+ ) : accessDirty && ( ! isContentCredentialChange || syncsPerMember ) ? (
371+ < div className = 'flex flex-col gap-2' >
372+ < div className = 'flex items-center gap-2' >
373+ < Chip
374+ variant = 'primary'
375+ onClick = { onApplyAccess }
376+ disabled = { ! accessComplete || isSaving }
377+ >
378+ { isSwitchingAccess
379+ ? 'Switching…'
380+ : isContentCredentialChange
381+ ? 'Change indexing account'
382+ : 'Apply connection method' }
383+ </ Chip >
384+ < Chip onClick = { onResetAccess } disabled = { isSaving } >
385+ { accessSetupHint ? 'Edit settings' : 'Cancel' }
386+ </ Chip >
387+ </ div >
388+ < p className = 'text-[var(--text-muted)] text-caption leading-snug' >
389+ { accessSetupHint ??
390+ ( isContentCredentialChange
388391 ? 'The next sync uses this account. Members keep their connected accounts and source permissions.'
389- : 'The next sync uses this account and refreshes source permissions.'
390- : SWITCH_NOTICE [ access . accessMode ] ) }
391- </ p >
392- </ div >
393- ) : undefined
394- }
395- />
396- ) }
392+ : SWITCH_NOTICE [ access . accessMode ] ) }
393+ </ p >
394+ </ div >
395+ ) : undefined
396+ }
397+ />
398+ ) }
397399
398400 { connectorConfig && needsWorkspaceCredential && canAdmin && (
399401 < ChipModalField
@@ -551,6 +553,11 @@ export function ConnectorSettingsFields({
551553 </ ChipModalField >
552554 ) }
553555
556+ { saveBlockedReason && (
557+ < p role = 'status' className = 'px-2 text-[var(--text-muted)] text-caption' >
558+ { saveBlockedReason }
559+ </ p >
560+ ) }
554561 < ChipModalError > { error } </ ChipModalError >
555562 </ >
556563 )
0 commit comments