Browse Source

fix: DEC-9777 修改其他jdbc默认url,且不同驱动匹配不同url

qufenxi
alan 5 years ago
parent
commit
201c72f544
  1. 3
      src/modules/app.typings.d.ts
  2. 22
      src/modules/constants/constant.ts
  3. 15
      src/modules/pages/maintain/forms/components/form.jdbc.ts

3
src/modules/app.typings.d.ts vendored

@ -10,4 +10,7 @@ export interface DatabaseType {
hasSchema?: boolean; hasSchema?: boolean;
kerberos?: boolean; kerberos?: boolean;
iconUrl?: string; iconUrl?: string;
urls?: {
[key: string]: string;
}
} }

22
src/modules/constants/constant.ts

@ -189,6 +189,10 @@ export const DATA_BASE_TYPES = [
type: 'jdbc', type: 'jdbc',
hasSchema: true, hasSchema: true,
kerberos: false, 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', text: 'APACHE IMPALA',
@ -412,6 +416,10 @@ export const DATA_BASE_TYPES = [
type: 'jdbc', type: 'jdbc',
hasSchema: false, hasSchema: false,
kerberos: false, kerberos: false,
urls: {
'com.mysql.jdbc.Driver': 'jdbc:mysql://localhost/dbname',
'org.gjt.mm.mysql.Driver': 'jdbc:mysql://localhost/dbname',
},
}, },
{ {
text: 'Oracle', text: 'Oracle',
@ -428,12 +436,17 @@ export const DATA_BASE_TYPES = [
text: 'Pivotal Greenplum Database', text: 'Pivotal Greenplum Database',
databaseType: 'pivotal-greenplum-database', databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver', driver: 'org.postgresql.Driver',
drivers: ['org.postgresql.Driver', 'com.pivotal.jdbc.GreenplumDriver'],
url: 'jdbc:postgresql://hostname:port/database', url: 'jdbc:postgresql://hostname:port/database',
commonly: false, commonly: false,
internal: true, internal: true,
type: 'jdbc', type: 'jdbc',
hasSchema: true, hasSchema: true,
kerberos: false, kerberos: false,
urls: {
'org.postgresql.Driver': 'jdbc:postgresql://hostname:port/dbname',
'com.pivotal.jdbc.GreenplumDriver': 'jdbc:pivotal:greenplum://hostname:port;dbname',
},
}, { }, {
text: 'Postgresql', text: 'Postgresql',
databaseType: 'postgresql', databaseType: 'postgresql',
@ -528,14 +541,19 @@ export const DATA_BASE_TYPES = [
{ {
text: BI.i18nText('Dec-Dcm_Connection_JDBC_Other'), text: BI.i18nText('Dec-Dcm_Connection_JDBC_Other'),
databaseType: 'other', databaseType: 'other',
driver: 'org.ha.Driver', driver: 'org.h2.Driver',
drivers: ['org.ha.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'],
url: 'jdbc:h2://hostname:port/database', url: 'jdbc:h2://hostname:port/database',
commonly: false, commonly: false,
internal: true, internal: true,
type: 'other', type: 'other',
hasSchema: true, hasSchema: true,
kerberos: false, 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 => { ...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).map(item => {
return { return {

15
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -108,6 +108,21 @@ export class FormJdbc extends BI.Widget {
hasNext: false, 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);
}
},
}],
}], }],
}, },
{ {

Loading…
Cancel
Save