diff --git a/src/modules/app.typings.d.ts b/src/modules/app.typings.d.ts index 2d48bd8..67a5665 100644 --- a/src/modules/app.typings.d.ts +++ b/src/modules/app.typings.d.ts @@ -10,4 +10,7 @@ export interface DatabaseType { hasSchema?: boolean; kerberos?: boolean; iconUrl?: string; + urls?: { + [key: string]: string; + } } diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 1ededbe..993a0df 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -189,6 +189,10 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: true, kerberos: false, + urls: { + 'com.amazon.redshift.jdbc4.Driver': 'jdbc:redshift://endpoint:port/database', + 'com.amazon.redshift.jdbc41.Driver': 'jdbc:postgresql://endpoint:port/database', + }, }, { text: 'APACHE IMPALA', @@ -412,6 +416,10 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: false, kerberos: false, + urls: { + 'com.mysql.jdbc.Driver': 'jdbc:mysql://localhost/dbname', + 'org.gjt.mm.mysql.Driver': 'jdbc:mysql://localhost/dbname', + }, }, { text: 'Oracle', @@ -428,12 +436,17 @@ export const DATA_BASE_TYPES = [ text: 'Pivotal Greenplum Database', databaseType: 'pivotal-greenplum-database', driver: 'org.postgresql.Driver', + drivers: ['org.postgresql.Driver', 'com.pivotal.jdbc.GreenplumDriver'], url: 'jdbc:postgresql://hostname:port/database', commonly: false, internal: true, type: 'jdbc', hasSchema: true, kerberos: false, + urls: { + 'org.postgresql.Driver': 'jdbc:postgresql://hostname:port/dbname', + 'com.pivotal.jdbc.GreenplumDriver': 'jdbc:pivotal:greenplum://hostname:port;dbname', + }, }, { text: 'Postgresql', databaseType: 'postgresql', @@ -528,14 +541,19 @@ export const DATA_BASE_TYPES = [ { text: BI.i18nText('Dec-Dcm_Connection_JDBC_Other'), databaseType: 'other', - driver: 'org.ha.Driver', - drivers: ['org.ha.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], + driver: 'org.h2.Driver', + drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], url: 'jdbc:h2://hostname:port/database', commonly: false, internal: true, type: 'other', hasSchema: true, kerberos: false, + urls: { + 'org.h2.Driver': 'jdbc:h2://hostname:port/database', + 'com.fr.third.org.hsqldb.jdbcDriver': 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]', + 'org.sqlite.JDBC': 'jdbc:sqlite:[PATH_TO_DB_FILES]', + }, }, ...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).map(item => { return { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index bd5590a..c4a7dc9 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -108,6 +108,21 @@ export class FormJdbc extends BI.Widget { hasNext: false, }); }, + listeners: [{ + eventName: BI.SingleSelectInsertCombo.EVENT_CONFIRM, + action: () => { + const value = this.form.driver.getValue(); + const connectionData = this.options.formData.connectionData as ConnectionJDBC; + const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); + if (connectionType.urls) { + this.form.url.setValue(connectionType.urls[value]); + const urlInfo = resolveUrlInfo(connectionType.urls[value]); + this.form.host.setValue(urlInfo.host); + this.form.database.setValue(urlInfo.databaseName); + this.form.port.setValue(urlInfo.port); + } + }, + }], }], }, {