@@ -178,6 +178,10 @@ export class GLIntegrationsChip extends LitElement {
178178 return this . _state . ai ;
179179 }
180180
181+ private get aiEnabled ( ) {
182+ return this . _state . orgSettings ?. ai ?? true ;
183+ }
184+
181185 private get integrations ( ) {
182186 return this . _state . integrations ;
183187 }
@@ -322,52 +326,58 @@ export class GLIntegrationsChip extends LitElement {
322326
323327 private renderAIStatus ( ) {
324328 return html `< span
325- class ="integration status-- ${ this . ai ?. model != null ? 'connected' : 'disconnected' } "
329+ class ="integration status-- ${ this . aiEnabled && this . ai ?. model != null ? 'connected' : 'disconnected' } "
326330 slot ="anchor "
327331 >
328- < code-icon icon ="${ this . ai ?. model != null ? 'sparkle-filled' : 'sparkle' } "> </ code-icon >
332+ < code-icon icon ="${ this . aiEnabled && this . ai ?. model != null ? 'sparkle-filled' : 'sparkle' } "> </ code-icon >
329333 </ span > ` ;
330334 }
331335
332336 private renderAIRow ( ) {
333337 const { model } = this . ai ;
334338
335- const connected = model != null ;
336- const showLock = false ;
339+ const connectedAndEnabled = this . aiEnabled && model != null ;
340+ const showLock = ! this . aiEnabled ;
337341 const showProBadge = false ;
338- const icon = connected ? 'sparkle-filled' : 'sparkle' ; // TODO: Provider?
342+ const icon = connectedAndEnabled ? 'sparkle-filled' : 'sparkle' ; // TODO: Provider?
339343
340344 return html `< div
341- class ="integration-row integration-row--ai status-- ${ connected ? 'connected' : 'disconnected' } ${ showLock
342- ? ' is-locked '
343- : '' } "
345+ class ="integration-row integration-row--ai status-- ${ connectedAndEnabled
346+ ? 'connected '
347+ : 'disconnected' } ${ showLock ? ' is-locked' : ' '} "
344348 >
345349 < span class ="integration__icon "> < code-icon icon ="${ icon } "> </ code-icon > </ span >
346- < span class ="integration__content ">
347- < span class ="integration__title ">
348- < span > ${ model ?. provider . name ?? 'AI' } </ span >
349- ${ showProBadge
350- ? html ` < gl-feature-badge
351- placement ="right "
352- .source =${ { source : 'home' , detail : 'integrations' } as const }
353- cloud
354- > </ gl-feature-badge > `
355- : nothing }
356- </ span >
357- ${ model ?. name ? html `< span class ="integration__details "> ${ model . name } </ span > ` : nothing }
358- </ span >
359- < span class ="integration__actions ">
360- < gl-button
361- appearance ="toolbar "
362- href ="${ createCommandLink < Source > ( 'gitlens.switchAIModel' , {
363- source : 'home' ,
364- detail : 'integrations' ,
365- } ) } "
366- tooltip ="Switch AI Model "
367- aria-label ="Switch AI Model "
368- > < code-icon icon ="arrow-swap "> </ code-icon
369- > </ gl-button >
370- </ span >
350+ ${ this . aiEnabled
351+ ? html `< span class ="integration__content ">
352+ < span class ="integration__title ">
353+ < span > ${ model ?. provider . name ?? 'AI' } </ span >
354+ ${ showProBadge
355+ ? html ` < gl-feature-badge
356+ placement ="right "
357+ .source =${ { source : 'home' , detail : 'integrations' } as const }
358+ cloud
359+ > </ gl-feature-badge > `
360+ : nothing }
361+ </ span >
362+ ${ model ?. name ? html `< span class ="integration__details "> ${ model . name } </ span > ` : nothing }
363+ </ span >
364+ < span class ="integration__actions ">
365+ < gl-button
366+ appearance ="toolbar "
367+ href ="${ createCommandLink < Source > ( 'gitlens.switchAIModel' , {
368+ source : 'home' ,
369+ detail : 'integrations' ,
370+ } ) } "
371+ tooltip ="Switch AI Model "
372+ aria-label ="Switch AI Model "
373+ > < code-icon icon ="arrow-swap "> </ code-icon
374+ > </ gl-button >
375+ </ span > `
376+ : html `< span class ="integration__content ">
377+ < span class ="integration_details "
378+ > GitLens AI features have been disabled by your GitKraken admin</ span
379+ >
380+ </ span > ` }
371381 </ div > ` ;
372382 }
373383}
0 commit comments