Skip to content

Commit a7b7fd5

Browse files
committed
rename fields for clarity
1 parent 01697cc commit a7b7fd5

File tree

9 files changed

+52
-50
lines changed

9 files changed

+52
-50
lines changed

src/notebooks/deepnote/integrations/integrationDetector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export class IntegrationDetector implements IIntegrationDetector {
6161
const status: IntegrationWithStatus = {
6262
config: config || null,
6363
status: config ? IntegrationStatus.Connected : IntegrationStatus.Disconnected,
64-
// Include project metadata for prefilling when config is null
65-
projectName: projectIntegration.name,
66-
projectType: integrationType
64+
// Include integration metadata from project for prefilling when config is null
65+
integrationName: projectIntegration.name,
66+
integrationType: integrationType
6767
};
6868

6969
integrations.set(integrationId, status);

src/notebooks/deepnote/integrations/integrationWebview.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
174174
const integrationsData = Array.from(this.integrations.entries()).map(([id, integration]) => ({
175175
config: integration.config,
176176
id,
177-
projectName: integration.projectName,
178-
projectType: integration.projectType,
177+
integrationName: integration.integrationName,
178+
integrationType: integration.integrationType,
179179
status: integration.status
180180
}));
181181
logger.debug(`IntegrationWebviewProvider: Sending ${integrationsData.length} integrations to webview`);
@@ -225,8 +225,8 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
225225
await this.currentPanel?.webview.postMessage({
226226
config: integration.config,
227227
integrationId,
228-
projectName: integration.projectName,
229-
projectType: integration.projectType,
228+
integrationName: integration.integrationName,
229+
integrationType: integration.integrationType,
230230
type: 'showForm'
231231
});
232232
}
@@ -313,8 +313,8 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
313313
// Build the integrations list from current integrations
314314
const projectIntegrations = Array.from(this.integrations.entries())
315315
.map(([id, integration]) => {
316-
// Get the integration type from config or project metadata
317-
const type = integration.config?.type || integration.projectType;
316+
// Get the integration type from config or integration metadata
317+
const type = integration.config?.type || integration.integrationType;
318318
if (!type) {
319319
logger.warn(`IntegrationWebviewProvider: No type found for integration ${id}, skipping`);
320320
return null;
@@ -329,7 +329,7 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
329329

330330
return {
331331
id,
332-
name: integration.config?.name || integration.projectName || id,
332+
name: integration.config?.name || integration.integrationName || id,
333333
type: deepnoteType
334334
};
335335
})

src/platform/notebooks/deepnote/integrationTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ export interface IntegrationWithStatus {
9393
/**
9494
* Name from the project's integrations list (used for prefilling when config is null)
9595
*/
96-
projectName?: string;
96+
integrationName?: string;
9797
/**
9898
* Type from the project's integrations list (used for prefilling when config is null)
9999
*/
100-
projectType?: IntegrationType;
100+
integrationType?: IntegrationType;
101101
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ import { BigQueryIntegrationConfig } from './types';
55
export interface IBigQueryFormProps {
66
integrationId: string;
77
existingConfig: BigQueryIntegrationConfig | null;
8-
projectName?: string;
8+
integrationName?: string;
99
onSave: (config: BigQueryIntegrationConfig) => void;
1010
onCancel: () => void;
1111
}
1212

1313
export const BigQueryForm: React.FC<IBigQueryFormProps> = ({
1414
integrationId,
1515
existingConfig,
16-
projectName,
16+
integrationName,
1717
onSave,
1818
onCancel
1919
}) => {
20-
const [name, setName] = React.useState(existingConfig?.name || projectName || '');
20+
const [name, setName] = React.useState(existingConfig?.name || integrationName || '');
2121
const [projectId, setProjectId] = React.useState(existingConfig?.projectId || '');
2222
const [credentials, setCredentials] = React.useState(existingConfig?.credentials || '');
2323
const [credentialsError, setCredentialsError] = React.useState<string | null>(null);
2424

25-
// Update form fields when existingConfig or projectName changes
25+
// Update form fields when existingConfig or integrationName changes
2626
React.useEffect(() => {
2727
if (existingConfig) {
2828
setName(existingConfig.name || '');
2929
setProjectId(existingConfig.projectId || '');
3030
setCredentials(existingConfig.credentials || '');
3131
setCredentialsError(null);
3232
} else {
33-
setName(projectName || '');
33+
setName(integrationName || '');
3434
setProjectId('');
3535
setCredentials('');
3636
setCredentialsError(null);
3737
}
38-
}, [existingConfig, projectName]);
38+
}, [existingConfig, integrationName]);
3939

4040
const validateCredentials = (value: string): boolean => {
4141
if (!value.trim()) {

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ import { IntegrationConfig, IntegrationType } from './types';
77
export interface IConfigurationFormProps {
88
integrationId: string;
99
existingConfig: IntegrationConfig | null;
10-
projectName?: string;
11-
projectType?: IntegrationType;
10+
integrationName?: string;
11+
integrationType?: IntegrationType;
1212
onSave: (config: IntegrationConfig) => void;
1313
onCancel: () => void;
1414
}
1515

1616
export const ConfigurationForm: React.FC<IConfigurationFormProps> = ({
1717
integrationId,
1818
existingConfig,
19-
projectName,
20-
projectType,
19+
integrationName,
20+
integrationType,
2121
onSave,
2222
onCancel
2323
}) => {
24-
// Determine integration type from existing config, project metadata, or ID
24+
// Determine integration type from existing config, integration metadata from project, or ID
2525
const getIntegrationType = (): 'postgres' | 'bigquery' => {
2626
if (existingConfig) {
2727
return existingConfig.type;
2828
}
29-
// Use project type if available
30-
if (projectType) {
31-
return projectType;
29+
// Use integration type from project if available
30+
if (integrationType) {
31+
return integrationType;
3232
}
3333
// Infer from integration ID
3434
if (integrationId.includes('postgres')) {
@@ -41,7 +41,7 @@ export const ConfigurationForm: React.FC<IConfigurationFormProps> = ({
4141
return 'postgres';
4242
};
4343

44-
const integrationType = getIntegrationType();
44+
const selectedIntegrationType = getIntegrationType();
4545

4646
const title = getLocString('integrationsConfigureTitle', 'Configure Integration: {0}').replace(
4747
'{0}',
@@ -59,19 +59,19 @@ export const ConfigurationForm: React.FC<IConfigurationFormProps> = ({
5959
</div>
6060

6161
<div className="configuration-form-body">
62-
{integrationType === 'postgres' ? (
62+
{selectedIntegrationType === 'postgres' ? (
6363
<PostgresForm
6464
integrationId={integrationId}
6565
existingConfig={existingConfig?.type === 'postgres' ? existingConfig : null}
66-
projectName={projectName}
66+
integrationName={integrationName}
6767
onSave={onSave}
6868
onCancel={onCancel}
6969
/>
7070
) : (
7171
<BigQueryForm
7272
integrationId={integrationId}
7373
existingConfig={existingConfig?.type === 'bigquery' ? existingConfig : null}
74-
projectName={projectName}
74+
integrationName={integrationName}
7575
onSave={onSave}
7676
onCancel={onCancel}
7777
/>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export const IntegrationItem: React.FC<IIntegrationItemProps> = ({ integration,
2929
? getLocString('integrationsReconfigure', 'Reconfigure')
3030
: getLocString('integrationsConfigure', 'Configure');
3131

32-
// Get the name: prefer config name, then project name, then ID
33-
const name = integration.config?.name || integration.projectName || integration.id;
32+
// Get the name: prefer config name, then integration name from project, then ID
33+
const name = integration.config?.name || integration.integrationName || integration.id;
3434

35-
// Get the type: prefer config type, then project type
36-
const type = integration.config?.type || integration.projectType;
35+
// Get the type: prefer config type, then integration type from project
36+
const type = integration.config?.type || integration.integrationType;
3737

3838
// Build display name with type
3939
const displayName = type ? `${name} (${getIntegrationTypeLabel(type)})` : name;

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ export const IntegrationPanel: React.FC<IIntegrationPanelProps> = ({ baseTheme,
1414
const [integrations, setIntegrations] = React.useState<IntegrationWithStatus[]>([]);
1515
const [selectedIntegrationId, setSelectedIntegrationId] = React.useState<string | null>(null);
1616
const [selectedConfig, setSelectedConfig] = React.useState<IntegrationConfig | null>(null);
17-
const [selectedProjectName, setSelectedProjectName] = React.useState<string | undefined>(undefined);
18-
const [selectedProjectType, setSelectedProjectType] = React.useState<IntegrationType | undefined>(undefined);
17+
const [selectedIntegrationName, setSelectedIntegrationName] = React.useState<string | undefined>(undefined);
18+
const [selectedIntegrationType, setSelectedIntegrationType] = React.useState<IntegrationType | undefined>(
19+
undefined
20+
);
1921
const [message, setMessage] = React.useState<{ type: 'success' | 'error'; text: string } | null>(null);
2022
const [confirmDelete, setConfirmDelete] = React.useState<string | null>(null);
2123

@@ -53,8 +55,8 @@ export const IntegrationPanel: React.FC<IIntegrationPanelProps> = ({ baseTheme,
5355
case 'showForm':
5456
setSelectedIntegrationId(msg.integrationId);
5557
setSelectedConfig(msg.config);
56-
setSelectedProjectName(msg.projectName);
57-
setSelectedProjectType(msg.projectType);
58+
setSelectedIntegrationName(msg.integrationName);
59+
setSelectedIntegrationType(msg.integrationType);
5860
break;
5961

6062
case 'success':
@@ -148,8 +150,8 @@ export const IntegrationPanel: React.FC<IIntegrationPanelProps> = ({ baseTheme,
148150
<ConfigurationForm
149151
integrationId={selectedIntegrationId}
150152
existingConfig={selectedConfig}
151-
projectName={selectedProjectName}
152-
projectType={selectedProjectType}
153+
integrationName={selectedIntegrationName}
154+
integrationType={selectedIntegrationType}
153155
onSave={handleSave}
154156
onCancel={handleCancel}
155157
/>

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ import { PostgresIntegrationConfig } from './types';
55
export interface IPostgresFormProps {
66
integrationId: string;
77
existingConfig: PostgresIntegrationConfig | null;
8-
projectName?: string;
8+
integrationName?: string;
99
onSave: (config: PostgresIntegrationConfig) => void;
1010
onCancel: () => void;
1111
}
1212

1313
export const PostgresForm: React.FC<IPostgresFormProps> = ({
1414
integrationId,
1515
existingConfig,
16-
projectName,
16+
integrationName,
1717
onSave,
1818
onCancel
1919
}) => {
20-
const [name, setName] = React.useState(existingConfig?.name || projectName || '');
20+
const [name, setName] = React.useState(existingConfig?.name || integrationName || '');
2121
const [host, setHost] = React.useState(existingConfig?.host || '');
2222
const [port, setPort] = React.useState(existingConfig?.port?.toString() || '5432');
2323
const [database, setDatabase] = React.useState(existingConfig?.database || '');
2424
const [username, setUsername] = React.useState(existingConfig?.username || '');
2525
const [password, setPassword] = React.useState(existingConfig?.password || '');
2626
const [ssl, setSsl] = React.useState(existingConfig?.ssl || false);
2727

28-
// Update form fields when existingConfig or projectName changes
28+
// Update form fields when existingConfig or integrationName changes
2929
React.useEffect(() => {
3030
if (existingConfig) {
3131
setName(existingConfig.name || '');
@@ -36,15 +36,15 @@ export const PostgresForm: React.FC<IPostgresFormProps> = ({
3636
setPassword(existingConfig.password || '');
3737
setSsl(existingConfig.ssl || false);
3838
} else {
39-
setName(projectName || '');
39+
setName(integrationName || '');
4040
setHost('');
4141
setPort('5432');
4242
setDatabase('');
4343
setUsername('');
4444
setPassword('');
4545
setSsl(false);
4646
}
47-
}, [existingConfig, projectName]);
47+
}, [existingConfig, integrationName]);
4848

4949
const handleSubmit = (e: React.FormEvent) => {
5050
e.preventDefault();

src/webviews/webview-side/integrations/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export interface IntegrationWithStatus {
3030
id: string;
3131
config: IntegrationConfig | null;
3232
status: IntegrationStatus;
33-
projectName?: string;
34-
projectType?: IntegrationType;
33+
integrationName?: string;
34+
integrationType?: IntegrationType;
3535
}
3636

3737
export interface IVsCodeMessage {
@@ -49,8 +49,8 @@ export interface ShowFormMessage {
4949
type: 'showForm';
5050
integrationId: string;
5151
config: IntegrationConfig | null;
52-
projectName?: string;
53-
projectType?: IntegrationType;
52+
integrationName?: string;
53+
integrationType?: IntegrationType;
5454
}
5555

5656
export interface StatusMessage {

0 commit comments

Comments
 (0)