@@ -5,8 +5,15 @@ import { IExtensionContext } from '../../../platform/common/types';
55import { Commands } from '../../../platform/common/constants' ;
66import { logger } from '../../../platform/logging' ;
77import { IIntegrationDetector , IIntegrationManager , IIntegrationStorage , IIntegrationWebviewProvider } from './types' ;
8- import { IntegrationStatus , IntegrationWithStatus } from '../../../platform/notebooks/deepnote/integrationTypes' ;
8+ import {
9+ DEEPNOTE_TO_INTEGRATION_TYPE ,
10+ IntegrationStatus ,
11+ IntegrationType ,
12+ IntegrationWithStatus ,
13+ RawIntegrationType
14+ } from '../../../platform/notebooks/deepnote/integrationTypes' ;
915import { BlockWithIntegration , scanBlocksForIntegrations } from './integrationUtils' ;
16+ import { IDeepnoteNotebookManager } from '../../types' ;
1017
1118/**
1219 * Manages integration UI and commands for Deepnote notebooks
@@ -21,7 +28,8 @@ export class IntegrationManager implements IIntegrationManager {
2128 @inject ( IExtensionContext ) private readonly extensionContext : IExtensionContext ,
2229 @inject ( IIntegrationDetector ) private readonly integrationDetector : IIntegrationDetector ,
2330 @inject ( IIntegrationStorage ) private readonly integrationStorage : IIntegrationStorage ,
24- @inject ( IIntegrationWebviewProvider ) private readonly webviewProvider : IIntegrationWebviewProvider
31+ @inject ( IIntegrationWebviewProvider ) private readonly webviewProvider : IIntegrationWebviewProvider ,
32+ @inject ( IDeepnoteNotebookManager ) private readonly notebookManager : IDeepnoteNotebookManager
2533 ) { }
2634
2735 public activate ( ) : void {
@@ -150,9 +158,25 @@ export class IntegrationManager implements IIntegrationManager {
150158 if ( selectedIntegrationId && ! integrations . has ( selectedIntegrationId ) ) {
151159 logger . debug ( `IntegrationManager: Adding requested integration ${ selectedIntegrationId } to the map` ) ;
152160 const config = await this . integrationStorage . getIntegrationConfig ( selectedIntegrationId ) ;
161+
162+ // Try to get integration metadata from the project
163+ const project = this . notebookManager . getOriginalProject ( projectId ) ;
164+ const projectIntegration = project ?. project . integrations ?. find ( ( i ) => i . id === selectedIntegrationId ) ;
165+
166+ let integrationName : string | undefined ;
167+ let integrationType : IntegrationType | undefined ;
168+
169+ if ( projectIntegration ) {
170+ integrationName = projectIntegration . name ;
171+ // Map the Deepnote integration type to our IntegrationType
172+ integrationType = DEEPNOTE_TO_INTEGRATION_TYPE [ projectIntegration . type as RawIntegrationType ] ;
173+ }
174+
153175 integrations . set ( selectedIntegrationId , {
154176 config : config || null ,
155- status : config ? IntegrationStatus . Connected : IntegrationStatus . Disconnected
177+ status : config ? IntegrationStatus . Connected : IntegrationStatus . Disconnected ,
178+ integrationName,
179+ integrationType
156180 } ) ;
157181 }
158182
0 commit comments