@@ -2,7 +2,9 @@ import { inject, injectable } from 'inversify';
22import { Disposable , l10n , Uri , ViewColumn , WebviewPanel , window } from 'vscode' ;
33
44import { IExtensionContext } from '../../../platform/common/types' ;
5+ import * as localize from '../../../platform/common/utils/localize' ;
56import { logger } from '../../../platform/logging' ;
7+ import { LocalizedMessages , SharedMessages } from '../../../messageTypes' ;
68import { IIntegrationStorage , IIntegrationWebviewProvider } from './types' ;
79import { IntegrationConfig , IntegrationStatus , IntegrationWithStatus } from './integrationTypes' ;
810
@@ -24,8 +26,10 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
2426
2527 /**
2628 * Show the integration management webview
29+ * @param integrations Map of integration IDs to their status
30+ * @param selectedIntegrationId Optional integration ID to select/configure immediately
2731 */
28- public async show ( integrations : Map < string , IntegrationWithStatus > ) : Promise < void > {
32+ public async show ( integrations : Map < string , IntegrationWithStatus > , selectedIntegrationId ?: string ) : Promise < void > {
2933 // Update the stored integrations with the latest data
3034 this . integrations = integrations ;
3135
@@ -35,6 +39,11 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
3539 if ( this . currentPanel ) {
3640 this . currentPanel . reveal ( column ) ;
3741 await this . updateWebview ( ) ;
42+
43+ // If a specific integration was requested, show its configuration form
44+ if ( selectedIntegrationId ) {
45+ await this . showConfigurationForm ( selectedIntegrationId ) ;
46+ }
3847 return ;
3948 }
4049
@@ -75,14 +84,73 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
7584 this . disposables
7685 ) ;
7786
87+ await this . sendLocStrings ( ) ;
7888 await this . updateWebview ( ) ;
89+
90+ // If a specific integration was requested, show its configuration form
91+ if ( selectedIntegrationId ) {
92+ await this . showConfigurationForm ( selectedIntegrationId ) ;
93+ }
94+ }
95+
96+ /**
97+ * Send localization strings to the webview
98+ */
99+ private async sendLocStrings ( ) : Promise < void > {
100+ if ( ! this . currentPanel ) {
101+ return ;
102+ }
103+
104+ const locStrings : Partial < LocalizedMessages > = {
105+ integrationsTitle : localize . Integrations . title ,
106+ integrationsNoIntegrationsFound : localize . Integrations . noIntegrationsFound ,
107+ integrationsConnected : localize . Integrations . connected ,
108+ integrationsNotConfigured : localize . Integrations . notConfigured ,
109+ integrationsConfigure : localize . Integrations . configure ,
110+ integrationsReconfigure : localize . Integrations . reconfigure ,
111+ integrationsReset : localize . Integrations . reset ,
112+ integrationsConfirmResetTitle : localize . Integrations . confirmResetTitle ,
113+ integrationsConfirmResetMessage : localize . Integrations . confirmResetMessage ,
114+ integrationsConfirmResetDetails : localize . Integrations . confirmResetDetails ,
115+ integrationsConfigureTitle : localize . Integrations . configureTitle ,
116+ integrationsCancel : localize . Integrations . cancel ,
117+ integrationsSave : localize . Integrations . save ,
118+ integrationsRequiredField : localize . Integrations . requiredField ,
119+ integrationsOptionalField : localize . Integrations . optionalField ,
120+ integrationsPostgresNameLabel : localize . Integrations . postgresNameLabel ,
121+ integrationsPostgresNamePlaceholder : localize . Integrations . postgresNamePlaceholder ,
122+ integrationsPostgresHostLabel : localize . Integrations . postgresHostLabel ,
123+ integrationsPostgresHostPlaceholder : localize . Integrations . postgresHostPlaceholder ,
124+ integrationsPostgresPortLabel : localize . Integrations . postgresPortLabel ,
125+ integrationsPostgresPortPlaceholder : localize . Integrations . postgresPortPlaceholder ,
126+ integrationsPostgresDatabaseLabel : localize . Integrations . postgresDatabaseLabel ,
127+ integrationsPostgresDatabasePlaceholder : localize . Integrations . postgresDatabasePlaceholder ,
128+ integrationsPostgresUsernameLabel : localize . Integrations . postgresUsernameLabel ,
129+ integrationsPostgresUsernamePlaceholder : localize . Integrations . postgresUsernamePlaceholder ,
130+ integrationsPostgresPasswordLabel : localize . Integrations . postgresPasswordLabel ,
131+ integrationsPostgresPasswordPlaceholder : localize . Integrations . postgresPasswordPlaceholder ,
132+ integrationsPostgresSslLabel : localize . Integrations . postgresSslLabel ,
133+ integrationsBigQueryNameLabel : localize . Integrations . bigQueryNameLabel ,
134+ integrationsBigQueryNamePlaceholder : localize . Integrations . bigQueryNamePlaceholder ,
135+ integrationsBigQueryProjectIdLabel : localize . Integrations . bigQueryProjectIdLabel ,
136+ integrationsBigQueryProjectIdPlaceholder : localize . Integrations . bigQueryProjectIdPlaceholder ,
137+ integrationsBigQueryCredentialsLabel : localize . Integrations . bigQueryCredentialsLabel ,
138+ integrationsBigQueryCredentialsPlaceholder : localize . Integrations . bigQueryCredentialsPlaceholder ,
139+ integrationsBigQueryCredentialsRequired : localize . Integrations . bigQueryCredentialsRequired
140+ } ;
141+
142+ await this . currentPanel . webview . postMessage ( {
143+ type : SharedMessages . LocInit ,
144+ locStrings : locStrings
145+ } ) ;
79146 }
80147
81148 /**
82149 * Update the webview with current integration data
83150 */
84151 private async updateWebview ( ) : Promise < void > {
85152 if ( ! this . currentPanel ) {
153+ logger . debug ( 'IntegrationWebviewProvider: No current panel, skipping update' ) ;
86154 return ;
87155 }
88156
@@ -91,6 +159,7 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
91159 id,
92160 status : integration . status
93161 } ) ) ;
162+ logger . debug ( `IntegrationWebviewProvider: Sending ${ integrationsData . length } integrations to webview` ) ;
94163
95164 await this . currentPanel . webview . postMessage ( {
96165 integrations : integrationsData ,
0 commit comments