Skip to content

Commit 8e78c67

Browse files
committed
fix opening of integration configuration from status bar
1 parent 38a36e5 commit 8e78c67

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/notebooks/deepnote/integrations/integrationManager.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ import { IExtensionContext } from '../../../platform/common/types';
55
import { Commands } from '../../../platform/common/constants';
66
import { logger } from '../../../platform/logging';
77
import { 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';
915
import { 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

Comments
 (0)