Skip to content

Commit f263f62

Browse files
committed
fix integration configuration delete/reset button
1 parent 4b38b91 commit f263f62

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

src/notebooks/deepnote/integrations/integrationWebview.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
4646
{
4747
enableScripts: true,
4848
retainContextWhenHidden: true,
49-
localResourceRoots: [this.extensionContext.extensionUri]
49+
localResourceRoots: [this.extensionContext.extensionUri],
50+
enableForms: true
5051
}
5152
);
5253

src/webviews/webview-side/integrations/IntegrationItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ export const IntegrationItem: React.FC<IIntegrationItemProps> = ({ integration,
2626
<button onClick={() => onConfigure(integration.id)}>{configureText}</button>
2727
{integration.config && (
2828
<button className="secondary" onClick={() => onDelete(integration.id)}>
29-
Delete
29+
Reset
3030
</button>
3131
)}
3232
</div>
3333
</div>
3434
);
3535
};
36-

src/webviews/webview-side/integrations/IntegrationPanel.tsx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const IntegrationPanel: React.FC<IIntegrationPanelProps> = ({ baseTheme,
1717
const [selectedIntegrationId, setSelectedIntegrationId] = React.useState<string | null>(null);
1818
const [selectedConfig, setSelectedConfig] = React.useState<IntegrationConfig | null>(null);
1919
const [message, setMessage] = React.useState<{ type: 'success' | 'error'; text: string } | null>(null);
20+
const [confirmDelete, setConfirmDelete] = React.useState<string | null>(null);
2021

2122
// Handle messages from the extension
2223
React.useEffect(() => {
@@ -54,14 +55,23 @@ export const IntegrationPanel: React.FC<IIntegrationPanelProps> = ({ baseTheme,
5455
};
5556

5657
const handleDelete = (integrationId: string) => {
57-
if (confirm('Are you sure you want to delete this integration configuration?')) {
58+
setConfirmDelete(integrationId);
59+
};
60+
61+
const handleConfirmDelete = () => {
62+
if (confirmDelete) {
5863
vscodeApi.postMessage({
5964
type: 'delete',
60-
integrationId
65+
integrationId: confirmDelete
6166
});
67+
setConfirmDelete(null);
6268
}
6369
};
6470

71+
const handleCancelDelete = () => {
72+
setConfirmDelete(null);
73+
};
74+
6575
const handleSave = (config: IntegrationConfig) => {
6676
vscodeApi.postMessage({
6777
type: 'save',
@@ -101,7 +111,30 @@ export const IntegrationPanel: React.FC<IIntegrationPanelProps> = ({ baseTheme,
101111
onCancel={handleCancel}
102112
/>
103113
)}
114+
115+
{confirmDelete && (
116+
<div className="configuration-form-overlay">
117+
<div className="configuration-form-container" style={{ maxWidth: '400px' }}>
118+
<div className="configuration-form-header">
119+
<h2>Confirm Reset</h2>
120+
</div>
121+
<div className="configuration-form-body">
122+
<p>Are you sure you want to reset this integration configuration?</p>
123+
<p style={{ marginTop: '10px', fontSize: '0.9em', opacity: 0.8 }}>
124+
This will remove the stored credentials. You can reconfigure it later.
125+
</p>
126+
</div>
127+
<div className="form-actions">
128+
<button type="button" className="primary" onClick={handleConfirmDelete}>
129+
Reset
130+
</button>
131+
<button type="button" className="secondary" onClick={handleCancelDelete}>
132+
Cancel
133+
</button>
134+
</div>
135+
</div>
136+
</div>
137+
)}
104138
</div>
105139
);
106140
};
107-

0 commit comments

Comments
 (0)