Skip to content

Commit 77c61c3

Browse files
committed
refactor: use interface injection for IntegrationWebviewProvider
1 parent 6ce699c commit 77c61c3

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

src/notebooks/deepnote/integrations/integrationManager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { commands, NotebookDocument, window, workspace } from 'vscode';
44
import { IExtensionContext } from '../../../platform/common/types';
55
import { Commands } from '../../../platform/common/constants';
66
import { logger } from '../../../platform/logging';
7-
import { IntegrationWebviewProvider } from './integrationWebview';
8-
import { IIntegrationDetector, IIntegrationStorage } from './types';
7+
import { IIntegrationDetector, IIntegrationStorage, IIntegrationWebviewProvider } from './types';
98
import { IntegrationStatus, IntegrationWithStatus } from './integrationTypes';
109
import { BlockWithIntegration, scanBlocksForIntegrations } from './integrationUtils';
1110

@@ -22,7 +21,7 @@ export class IntegrationManager {
2221
@inject(IExtensionContext) private readonly extensionContext: IExtensionContext,
2322
@inject(IIntegrationDetector) private readonly integrationDetector: IIntegrationDetector,
2423
@inject(IIntegrationStorage) private readonly integrationStorage: IIntegrationStorage,
25-
@inject(IntegrationWebviewProvider) private readonly webviewProvider: IntegrationWebviewProvider
24+
@inject(IIntegrationWebviewProvider) private readonly webviewProvider: IIntegrationWebviewProvider
2625
) {}
2726

2827
public activate(): void {

src/notebooks/deepnote/integrations/integrationWebview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { Disposable, ViewColumn, WebviewPanel, window } from 'vscode';
33

44
import { IExtensionContext } from '../../../platform/common/types';
55
import { logger } from '../../../platform/logging';
6-
import { IIntegrationStorage } from './types';
6+
import { IIntegrationStorage, IIntegrationWebviewProvider } from './types';
77
import { IntegrationConfig, IntegrationStatus, IntegrationWithStatus } from './integrationTypes';
88

99
/**
1010
* Manages the webview panel for integration configuration
1111
*/
1212
@injectable()
13-
export class IntegrationWebviewProvider {
13+
export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
1414
private currentPanel: WebviewPanel | undefined;
1515

1616
private readonly disposables: Disposable[] = [];

src/notebooks/deepnote/integrations/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ export interface IIntegrationDetector {
2222
*/
2323
hasUnconfiguredIntegrations(projectId: string): Promise<boolean>;
2424
}
25+
26+
export const IIntegrationWebviewProvider = Symbol('IIntegrationWebviewProvider');
27+
export interface IIntegrationWebviewProvider {
28+
/**
29+
* Show the integration management webview
30+
*/
31+
show(integrations: Map<string, IntegrationWithStatus>): Promise<void>;
32+
}

src/notebooks/serviceRegistry.node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { IntegrationStorage } from './deepnote/integrations/integrationStorage';
4747
import { IntegrationDetector } from './deepnote/integrations/integrationDetector';
4848
import { IntegrationManager } from './deepnote/integrations/integrationManager';
4949
import { IntegrationWebviewProvider } from './deepnote/integrations/integrationWebview';
50-
import { IIntegrationDetector, IIntegrationStorage } from './deepnote/integrations/types';
50+
import { IIntegrationDetector, IIntegrationStorage, IIntegrationWebviewProvider } from './deepnote/integrations/types';
5151
import {
5252
IDeepnoteToolkitInstaller,
5353
IDeepnoteServerStarter,
@@ -133,7 +133,7 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea
133133
serviceManager.addSingleton<IDeepnoteNotebookManager>(IDeepnoteNotebookManager, DeepnoteNotebookManager);
134134
serviceManager.addSingleton<IIntegrationStorage>(IIntegrationStorage, IntegrationStorage);
135135
serviceManager.addSingleton<IIntegrationDetector>(IIntegrationDetector, IntegrationDetector);
136-
serviceManager.addSingleton<IntegrationWebviewProvider>(IntegrationWebviewProvider, IntegrationWebviewProvider);
136+
serviceManager.addSingleton<IIntegrationWebviewProvider>(IIntegrationWebviewProvider, IntegrationWebviewProvider);
137137
serviceManager.addSingleton<IntegrationManager>(IntegrationManager, IntegrationManager);
138138

139139
// Deepnote kernel services

src/notebooks/serviceRegistry.web.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { IntegrationStorage } from './deepnote/integrations/integrationStorage';
4242
import { IntegrationDetector } from './deepnote/integrations/integrationDetector';
4343
import { IntegrationManager } from './deepnote/integrations/integrationManager';
4444
import { IntegrationWebviewProvider } from './deepnote/integrations/integrationWebview';
45-
import { IIntegrationDetector, IIntegrationStorage } from './deepnote/integrations/types';
45+
import { IIntegrationDetector, IIntegrationStorage, IIntegrationWebviewProvider } from './deepnote/integrations/types';
4646

4747
export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) {
4848
registerControllerTypes(serviceManager, isDevMode);
@@ -99,7 +99,7 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea
9999
serviceManager.addSingleton<IDeepnoteNotebookManager>(IDeepnoteNotebookManager, DeepnoteNotebookManager);
100100
serviceManager.addSingleton<IIntegrationStorage>(IIntegrationStorage, IntegrationStorage);
101101
serviceManager.addSingleton<IIntegrationDetector>(IIntegrationDetector, IntegrationDetector);
102-
serviceManager.addSingleton<IntegrationWebviewProvider>(IntegrationWebviewProvider, IntegrationWebviewProvider);
102+
serviceManager.addSingleton<IIntegrationWebviewProvider>(IIntegrationWebviewProvider, IntegrationWebviewProvider);
103103
serviceManager.addSingleton<IntegrationManager>(IntegrationManager, IntegrationManager);
104104

105105
serviceManager.addSingleton<IExportBase>(IExportBase, ExportBase);

0 commit comments

Comments
 (0)