Skip to content

Commit 67d2557

Browse files
committed
refactor: replace method with map
1 parent fff1e71 commit 67d2557

File tree

1 file changed

+21
-42
lines changed

1 file changed

+21
-42
lines changed

src/notebooks/deepnote/sqlCellStatusBarProvider.ts

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ interface LocalQuickPickItem extends QuickPickItem {
3636
id: string;
3737
}
3838

39+
const integrationTypeLabels: Record<ConfigurableDatabaseIntegrationType, string> = {
40+
alloydb: l10n.t('AlloyDB'),
41+
athena: l10n.t('Amazon Athena'),
42+
'big-query': l10n.t('BigQuery'),
43+
clickhouse: l10n.t('ClickHouse'),
44+
databricks: l10n.t('Databricks'),
45+
dremio: l10n.t('Dremio'),
46+
mariadb: l10n.t('MariaDB'),
47+
materialize: l10n.t('Materialize'),
48+
mindsdb: l10n.t('MindsDB'),
49+
mongodb: l10n.t('MongoDB'),
50+
mysql: l10n.t('MySQL'),
51+
pgsql: l10n.t('PostgreSQL'),
52+
redshift: l10n.t('Amazon Redshift'),
53+
snowflake: l10n.t('Snowflake'),
54+
spanner: l10n.t('Google Cloud Spanner'),
55+
'sql-server': l10n.t('SQL Server'),
56+
trino: l10n.t('Trino')
57+
};
58+
3959
/**
4060
* Provides status bar items for SQL cells showing the integration name and variable name
4161
*/
@@ -354,7 +374,7 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
354374

355375
const typeLabel =
356376
integrationType && (databaseIntegrationTypes as readonly string[]).includes(integrationType)
357-
? this.getIntegrationTypeLabel(integrationType)
377+
? integrationTypeLabels[integrationType] ?? integrationType
358378
: projectIntegration.type;
359379

360380
const item: LocalQuickPickItem = {
@@ -437,45 +457,4 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
437457
// Trigger status bar update
438458
this._onDidChangeCellStatusBarItems.fire();
439459
}
440-
441-
private getIntegrationTypeLabel(type: ConfigurableDatabaseIntegrationType): string {
442-
switch (type) {
443-
case 'alloydb':
444-
return l10n.t('AlloyDB');
445-
case 'athena':
446-
return l10n.t('Amazon Athena');
447-
case 'big-query':
448-
return l10n.t('BigQuery');
449-
case 'clickhouse':
450-
return l10n.t('ClickHouse');
451-
case 'databricks':
452-
return l10n.t('Databricks');
453-
case 'dremio':
454-
return l10n.t('Dremio');
455-
case 'mariadb':
456-
return l10n.t('MariaDB');
457-
case 'materialize':
458-
return l10n.t('Materialize');
459-
case 'mindsdb':
460-
return l10n.t('MindsDB');
461-
case 'mongodb':
462-
return l10n.t('MongoDB');
463-
case 'mysql':
464-
return l10n.t('MySQL');
465-
case 'pgsql':
466-
return l10n.t('PostgreSQL');
467-
case 'redshift':
468-
return l10n.t('Amazon Redshift');
469-
case 'snowflake':
470-
return l10n.t('Snowflake');
471-
case 'spanner':
472-
return l10n.t('Google Cloud Spanner');
473-
case 'sql-server':
474-
return l10n.t('SQL Server');
475-
case 'trino':
476-
return l10n.t('Trino');
477-
default:
478-
return String(type);
479-
}
480-
}
481460
}

0 commit comments

Comments
 (0)