Skip to content

Commit 5d8451f

Browse files
committed
conslidate unnamed integration strings
1 parent 1ae43d1 commit 5d8451f

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

src/messageTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ export type LocalizedMessages = {
231231
integrationsSnowflakeRolePlaceholder: string;
232232
integrationsSnowflakeWarehouseLabel: string;
233233
integrationsSnowflakeWarehousePlaceholder: string;
234-
integrationsSnowflakeUnnamedIntegration: string;
235234
// Common form strings
236235
integrationsRequiredField: string;
237236
integrationsOptionalField: string;
237+
integrationsUnnamedIntegration: string;
238238
};
239239
// Map all messages to specific payloads
240240
export class IInteractiveWindowMapping {

src/notebooks/deepnote/integrations/integrationWebview.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
181181
integrationsSnowflakeRoleLabel: localize.Integrations.snowflakeRoleLabel,
182182
integrationsSnowflakeRolePlaceholder: localize.Integrations.snowflakeRolePlaceholder,
183183
integrationsSnowflakeWarehouseLabel: localize.Integrations.snowflakeWarehouseLabel,
184-
integrationsSnowflakeWarehousePlaceholder: localize.Integrations.snowflakeWarehousePlaceholder
184+
integrationsSnowflakeWarehousePlaceholder: localize.Integrations.snowflakeWarehousePlaceholder,
185+
integrationsUnnamedIntegration: localize.Integrations.unnamedIntegration('{0}')
185186
};
186187

187188
await this.currentPanel.webview.postMessage({

src/platform/common/utils/localize.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ export namespace Integrations {
830830
export const save = l10n.t('Save');
831831
export const requiredField = l10n.t('*');
832832
export const optionalField = l10n.t('(optional)');
833+
export const unnamedIntegration = (id: string) => l10n.t('Unnamed Integration ({0})', id);
833834

834835
// Integration type labels
835836
export const postgresTypeLabel = l10n.t('PostgreSQL');
@@ -850,7 +851,6 @@ export namespace Integrations {
850851
export const postgresPasswordLabel = l10n.t('Password');
851852
export const postgresPasswordPlaceholder = l10n.t('••••••••');
852853
export const postgresSslLabel = l10n.t('Use SSL');
853-
export const postgresUnnamedIntegration = (id: string) => l10n.t('Unnamed PostgreSQL Integration ({0})', id);
854854

855855
// BigQuery form strings
856856
export const bigQueryNameLabel = l10n.t('Name (optional)');
@@ -861,7 +861,6 @@ export namespace Integrations {
861861
export const bigQueryCredentialsPlaceholder = l10n.t('{"type": "service_account", ...}');
862862
export const bigQueryCredentialsRequired = l10n.t('Credentials are required');
863863
export const bigQueryInvalidJson = (message: string) => l10n.t('Invalid JSON: {0}', message);
864-
export const bigQueryUnnamedIntegration = (id: string) => l10n.t('Unnamed BigQuery Integration ({0})', id);
865864

866865
// Snowflake form strings
867866
export const snowflakeNameLabel = l10n.t('Name (optional)');
@@ -899,7 +898,6 @@ export namespace Integrations {
899898
export const snowflakeRolePlaceholder = l10n.t('');
900899
export const snowflakeWarehouseLabel = l10n.t('Warehouse (optional)');
901900
export const snowflakeWarehousePlaceholder = l10n.t('');
902-
export const snowflakeUnnamedIntegration = (id: string) => l10n.t('Unnamed Snowflake Integration ({0})', id);
903901
}
904902

905903
export namespace Deprecated {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export const BigQueryForm: React.FC<IBigQueryFormProps> = ({
7171
return;
7272
}
7373

74-
const unnamedIntegration = format('Unnamed BigQuery Integration ({0})', integrationId);
74+
const unnamedIntegration = getLocString('integrationsUnnamedIntegration', 'Unnamed Integration ({0})');
7575

7676
const config: BigQueryIntegrationConfig = {
7777
id: integrationId,
78-
name: (name || unnamedIntegration).trim(),
78+
name: (name || format(unnamedIntegration, integrationId)).trim(),
7979
type: 'bigquery',
8080
projectId: projectId.trim(),
8181
credentials: trimmedCredentials

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export const PostgresForm: React.FC<IPostgresFormProps> = ({
4949
const handleSubmit = (e: React.FormEvent) => {
5050
e.preventDefault();
5151

52-
const unnamedIntegration = format('Unnamed PostgreSQL Integration ({0})', integrationId);
52+
const unnamedIntegration = getLocString('integrationsUnnamedIntegration', 'Unnamed Integration ({0})');
5353

5454
const config: PostgresIntegrationConfig = {
5555
id: integrationId,
56-
name: (name || unnamedIntegration).trim(),
56+
name: (name || format(unnamedIntegration, integrationId)).trim(),
5757
type: 'postgres',
5858
host,
5959
port: parseInt(port, 10),

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ export const SnowflakeForm: React.FC<ISnowflakeFormProps> = ({
107107
const handleSubmit = (e: React.FormEvent) => {
108108
e.preventDefault();
109109

110-
const unnamedIntegration = getLocString(
111-
'integrationsSnowflakeUnnamedIntegration',
112-
'Unnamed Snowflake Integration ({0})'
113-
);
110+
const unnamedIntegration = getLocString('integrationsUnnamedIntegration', 'Unnamed Integration ({0})');
114111

115112
let config: SnowflakeIntegrationConfig;
116113

0 commit comments

Comments
 (0)