@@ -123,10 +123,18 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
123123 integrationsConfigure : localize . Integrations . configure ,
124124 integrationsReconfigure : localize . Integrations . reconfigure ,
125125 integrationsReset : localize . Integrations . reset ,
126+ integrationsDelete : localize . Integrations . deleteIntegration ,
126127 integrationsConfirmResetTitle : localize . Integrations . confirmResetTitle ,
127128 integrationsConfirmResetMessage : localize . Integrations . confirmResetMessage ,
128129 integrationsConfirmResetDetails : localize . Integrations . confirmResetDetails ,
130+ integrationsConfirmDeleteTitle : localize . Integrations . confirmDeleteTitle ,
131+ integrationsConfirmDeleteMessage : localize . Integrations . confirmDeleteMessage ,
132+ integrationsConfirmDeleteDetails : localize . Integrations . confirmDeleteDetails ,
129133 integrationsConfigureTitle : localize . Integrations . configureTitle ,
134+ integrationsAddNewIntegration : localize . Integrations . addNewIntegration ,
135+ integrationsDatabase : localize . Integrations . database ,
136+ integrationsDataWarehousesLakes : localize . Integrations . dataWarehousesLakes ,
137+ integrationsDatabases : localize . Integrations . databases ,
130138 integrationsPostgresTypeLabel : localize . Integrations . postgresTypeLabel ,
131139 integrationsBigQueryTypeLabel : localize . Integrations . bigQueryTypeLabel ,
132140 integrationsSnowflakeTypeLabel : localize . Integrations . snowflakeTypeLabel ,
@@ -373,6 +381,7 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
373381 integrationsCaCertificateText : localize . Integrations . caCertificateText ,
374382 integrationsCaCertificateTextPlaceholder : localize . Integrations . caCertificateTextPlaceholder ,
375383 integrationsUnnamedIntegration : localize . Integrations . unnamedIntegration ( '{0}' ) ,
384+ integrationsDefaultName : localize . Integrations . defaultName ( '{0}' ) ,
376385 integrationsUnsupportedIntegrationType : localize . Integrations . unsupportedIntegrationType ( '{0}' )
377386 } ;
378387
@@ -400,8 +409,16 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
400409 } ) ) ;
401410 logger . debug ( `IntegrationWebviewProvider: Sending ${ integrationsData . length } integrations to webview` ) ;
402411
412+ // Get the project name from the notebook manager
413+ let projectName : string | undefined ;
414+ if ( this . projectId ) {
415+ const project = this . notebookManager . getOriginalProject ( this . projectId ) ;
416+ projectName = project ?. project . name ;
417+ }
418+
403419 await this . currentPanel . webview . postMessage ( {
404420 integrations : integrationsData ,
421+ projectName,
405422 type : 'update'
406423 } ) ;
407424 }
@@ -425,6 +442,11 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
425442 await this . saveConfiguration ( message . integrationId , message . config ) ;
426443 }
427444 break ;
445+ case 'reset' :
446+ if ( message . integrationId ) {
447+ await this . resetConfiguration ( message . integrationId ) ;
448+ }
449+ break ;
428450 case 'delete' :
429451 if ( message . integrationId ) {
430452 await this . deleteConfiguration ( message . integrationId ) ;
@@ -464,9 +486,20 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
464486 // Update local state
465487 const integration = this . integrations . get ( integrationId ) ;
466488 if ( integration ) {
489+ // Existing integration - update it
467490 integration . config = config ;
468491 integration . status = IntegrationStatus . Connected ;
492+ integration . integrationName = config . name ;
493+ integration . integrationType = config . type ;
469494 this . integrations . set ( integrationId , integration ) ;
495+ } else {
496+ // New integration - add it to the map
497+ this . integrations . set ( integrationId , {
498+ config,
499+ status : IntegrationStatus . Connected ,
500+ integrationName : config . name ,
501+ integrationType : config . type
502+ } ) ;
470503 }
471504
472505 // Update the project's integrations list
@@ -490,9 +523,9 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
490523 }
491524
492525 /**
493- * Delete the configuration for an integration
526+ * Reset the configuration for an integration (clears credentials but keeps the integration entry)
494527 */
495- private async deleteConfiguration ( integrationId : string ) : Promise < void > {
528+ private async resetConfiguration ( integrationId : string ) : Promise < void > {
496529 try {
497530 await this . integrationStorage . delete ( integrationId ) ;
498531
@@ -509,14 +542,44 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
509542
510543 await this . updateWebview ( ) ;
511544 await this . currentPanel ?. webview . postMessage ( {
512- message : l10n . t ( 'Configuration deleted successfully' ) ,
545+ message : l10n . t ( 'Configuration reset successfully' ) ,
546+ type : 'success'
547+ } ) ;
548+ } catch ( error ) {
549+ logger . error ( 'Failed to reset integration configuration' , error ) ;
550+ await this . currentPanel ?. webview . postMessage ( {
551+ message : l10n . t (
552+ 'Failed to reset configuration: {0}' ,
553+ error instanceof Error ? error . message : 'Unknown error'
554+ ) ,
555+ type : 'error'
556+ } ) ;
557+ }
558+ }
559+
560+ /**
561+ * Delete the integration completely (removes credentials and integration entry)
562+ */
563+ private async deleteConfiguration ( integrationId : string ) : Promise < void > {
564+ try {
565+ await this . integrationStorage . delete ( integrationId ) ;
566+
567+ // Remove from local state
568+ this . integrations . delete ( integrationId ) ;
569+
570+ // Update the project's integrations list
571+ await this . updateProjectIntegrationsList ( ) ;
572+
573+ await this . updateWebview ( ) ;
574+ await this . currentPanel ?. webview . postMessage ( {
575+ message : l10n . t ( 'Integration deleted successfully' ) ,
513576 type : 'success'
514577 } ) ;
515578 } catch ( error ) {
516- logger . error ( 'Failed to delete integration configuration ' , error ) ;
579+ logger . error ( 'Failed to delete integration' , error ) ;
517580 await this . currentPanel ?. webview . postMessage ( {
518581 message : l10n . t (
519- 'Failed to delete configuration : {0}' ,
582+ 'Failed to delete integration : {0}' ,
520583 error instanceof Error ? error . message : 'Unknown error'
521584 ) ,
522585 type : 'error'
@@ -590,16 +653,6 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
590653 'index.js'
591654 )
592655 ) ;
593- const styleUri = webview . asWebviewUri (
594- Uri . joinPath (
595- this . extensionContext . extensionUri ,
596- 'dist' ,
597- 'webviews' ,
598- 'webview-side' ,
599- 'integrations' ,
600- 'integrations.css'
601- )
602- ) ;
603656 const codiconUri = webview . asWebviewUri (
604657 Uri . joinPath (
605658 this . extensionContext . extensionUri ,
@@ -617,9 +670,8 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
617670<head>
618671 <meta charset="UTF-8">
619672 <meta name="viewport" content="width=device-width, initial-scale=1.0">
620- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${ webview . cspSource } 'unsafe-inline'; script-src 'nonce-${ nonce } '; font-src ${ webview . cspSource } ;">
673+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src ${ webview . cspSource } data:; style-src ${ webview . cspSource } 'unsafe-inline'; script-src 'nonce-${ nonce } '; font-src ${ webview . cspSource } ;">
621674 <link rel="stylesheet" href="${ codiconUri } ">
622- <link rel="stylesheet" href="${ styleUri } ">
623675 <title>Deepnote Integrations</title>
624676</head>
625677<body>
0 commit comments