|
|
@ -40,9 +40,11 @@ export class FormJdbc extends BI.Widget { |
|
|
|
formKeyPath: FormItem; |
|
|
|
formKeyPath: FormItem; |
|
|
|
formKrb5File: FormItem; |
|
|
|
formKrb5File: FormItem; |
|
|
|
labelTips: Label; |
|
|
|
labelTips: Label; |
|
|
|
|
|
|
|
schemaForm: FormItem; |
|
|
|
|
|
|
|
|
|
|
|
form = { |
|
|
|
form = { |
|
|
|
connectionName: null, |
|
|
|
connectionName: null, |
|
|
|
|
|
|
|
version: null, |
|
|
|
driver: null, |
|
|
|
driver: null, |
|
|
|
database: null, |
|
|
|
database: null, |
|
|
|
host: null, |
|
|
|
host: null, |
|
|
@ -138,8 +140,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
} = connectionPoolAttr as ConnectionPoolJDBC; |
|
|
|
} = connectionPoolAttr as ConnectionPoolJDBC; |
|
|
|
const databaseType = getJdbcDatabaseType(database, driver); |
|
|
|
const databaseType = getJdbcDatabaseType(database, driver); |
|
|
|
this.databaseType = databaseType; |
|
|
|
this.databaseType = databaseType; |
|
|
|
|
|
|
|
const { host, port, databaseName, version } = resolveUrlInfo(url, database); |
|
|
|
const { host, port, databaseName } = resolveUrlInfo(url, database); |
|
|
|
this.version = !BI.isUndefined(databaseType.versions) ? (version ?? databaseType.versions[0]) : version; |
|
|
|
const { hgap, vgap } = CONNECTION_LAYOUT; |
|
|
|
const { hgap, vgap } = CONNECTION_LAYOUT; |
|
|
|
|
|
|
|
|
|
|
|
const valueRangeConfig = { |
|
|
|
const valueRangeConfig = { |
|
|
@ -171,6 +173,41 @@ export class FormJdbc extends BI.Widget { |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 版本
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: FormItem.xtype, |
|
|
|
|
|
|
|
name: BI.i18nText('Dec-Basic_Version'), |
|
|
|
|
|
|
|
invisible: BI.isUndefined(databaseType.versions), |
|
|
|
|
|
|
|
forms: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: BI.TextValueCombo.xtype, |
|
|
|
|
|
|
|
width: 300, |
|
|
|
|
|
|
|
value: this.version, |
|
|
|
|
|
|
|
items: () => databaseType.versions.map(item => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
text: BI.i18nText('Dec-Migration_Database_Version', item), |
|
|
|
|
|
|
|
value: item, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
ref: (_ref: TextValueCombo) => { |
|
|
|
|
|
|
|
this.form.version = _ref; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
listeners: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
eventName: BI.TextValueCombo.EVENT_CHANGE, |
|
|
|
|
|
|
|
action: () => { |
|
|
|
|
|
|
|
const version = this.form.version.getValue()[0]; |
|
|
|
|
|
|
|
this.version = version; |
|
|
|
|
|
|
|
this.sslCollapse.setCollapse(true); |
|
|
|
|
|
|
|
this.sslCollapse.setVisible(this.getSslSetEnabled()); |
|
|
|
|
|
|
|
!BI.isUndefined(databaseType.hasSchemas) && this.schemaForm.setVisible(databaseType.hasSchemas[version]); |
|
|
|
|
|
|
|
this.form.driver.setDefaultDrivers(version); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}, |
|
|
|
// 驱动
|
|
|
|
// 驱动
|
|
|
|
{ |
|
|
|
{ |
|
|
|
type: FormItem.xtype, |
|
|
|
type: FormItem.xtype, |
|
|
@ -184,6 +221,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
driver, |
|
|
|
driver, |
|
|
|
driverSource, |
|
|
|
driverSource, |
|
|
|
connectionData, |
|
|
|
connectionData, |
|
|
|
|
|
|
|
version: this.version, |
|
|
|
listeners: [ |
|
|
|
listeners: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: 'EVENT_CHANGE', |
|
|
|
eventName: 'EVENT_CHANGE', |
|
|
@ -405,7 +443,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: FileUpload.EVENT_CHECK_SUCCESS, |
|
|
|
eventName: FileUpload.EVENT_CHECK_SUCCESS, |
|
|
|
action: (value) => { |
|
|
|
action: (value) => { |
|
|
|
const principalsItems = BI.map(value.principals, function(index, item) { |
|
|
|
const principalsItems = BI.map(value.principals, function (index, item) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
text: item, |
|
|
|
text: item, |
|
|
|
value: item |
|
|
|
value: item |
|
|
@ -510,7 +548,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
// 模式
|
|
|
|
// 模式
|
|
|
|
{ |
|
|
|
{ |
|
|
|
type: FormItem.xtype, |
|
|
|
type: FormItem.xtype, |
|
|
|
invisible: !databaseType.hasSchema, |
|
|
|
invisible: BI.isUndefined(databaseType.hasSchemas) ? !databaseType.hasSchema : !databaseType.hasSchemas[this.version], |
|
|
|
height: 64, |
|
|
|
height: 64, |
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), |
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), |
|
|
|
forms: [ |
|
|
|
forms: [ |
|
|
@ -551,6 +589,9 @@ export class FormJdbc extends BI.Widget { |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
ref: (_ref: FormItem) => { |
|
|
|
|
|
|
|
this.schemaForm = _ref; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 分隔线
|
|
|
|
// 分隔线
|
|
|
|
{ |
|
|
|
{ |
|
|
@ -866,6 +907,9 @@ export class FormJdbc extends BI.Widget { |
|
|
|
width: 100, |
|
|
|
width: 100, |
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSL'), |
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSL'), |
|
|
|
invisible: !this.getSslSetEnabled(), |
|
|
|
invisible: !this.getSslSetEnabled(), |
|
|
|
|
|
|
|
ref: (_ref: Collapse) => { |
|
|
|
|
|
|
|
this.sslCollapse = _ref; |
|
|
|
|
|
|
|
}, |
|
|
|
listeners: [ |
|
|
|
listeners: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: EVENT_CHANGE, |
|
|
|
eventName: EVENT_CHANGE, |
|
|
@ -1309,7 +1353,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
|
|
|
|
|
|
|
|
private getSslSetEnabled(): boolean { |
|
|
|
private getSslSetEnabled(): boolean { |
|
|
|
const { databaseType } = this.databaseType; |
|
|
|
const { databaseType } = this.databaseType; |
|
|
|
return databaseType === 'mysql'; |
|
|
|
return databaseType === 'mysql' || this.version === 'mysql'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public setSchemas(schemas: string[]) { |
|
|
|
public setSchemas(schemas: string[]) { |
|
|
@ -1329,7 +1373,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public setKerberos() { |
|
|
|
public setKerberos() { |
|
|
|
const KerberosParams = BI.extend({},{ |
|
|
|
const KerberosParams = BI.extend({}, { |
|
|
|
keytabPath: this.form.keyPath.getValue(), |
|
|
|
keytabPath: this.form.keyPath.getValue(), |
|
|
|
krb5ConfPath: this.form.krb5Path.getValue(), |
|
|
|
krb5ConfPath: this.form.krb5Path.getValue(), |
|
|
|
principal: this.form.principal.getValue()[0] |
|
|
|
principal: this.form.principal.getValue()[0] |
|
|
@ -1341,7 +1385,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
public initPrincipals(keyPath, principal) { |
|
|
|
public initPrincipals(keyPath, principal) { |
|
|
|
let self = this; |
|
|
|
let self = this; |
|
|
|
api.getPrincipals(keyPath).then(res => { |
|
|
|
api.getPrincipals(keyPath).then(res => { |
|
|
|
const principalsItems = BI.map(res.data, function(index, item) { |
|
|
|
const principalsItems = BI.map(res.data, function (index, item) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
text: item, |
|
|
|
text: item, |
|
|
|
value: item |
|
|
|
value: item |
|
|
@ -1354,12 +1398,12 @@ export class FormJdbc extends BI.Widget { |
|
|
|
|
|
|
|
|
|
|
|
public changePrincipal() { |
|
|
|
public changePrincipal() { |
|
|
|
let self = this; |
|
|
|
let self = this; |
|
|
|
const KerberosParams = BI.extend({},{ |
|
|
|
const KerberosParams = BI.extend({}, { |
|
|
|
keytabPath: this.form.keyPath.getValue(), |
|
|
|
keytabPath: this.form.keyPath.getValue(), |
|
|
|
krb5ConfPath: this.form.krb5Path.getValue(), |
|
|
|
krb5ConfPath: this.form.krb5Path.getValue(), |
|
|
|
principal: this.form.principal.getValue()[0] |
|
|
|
principal: this.form.principal.getValue()[0] |
|
|
|
}); |
|
|
|
}); |
|
|
|
api.changePrincipal(KerberosParams).then(res =>{ |
|
|
|
api.changePrincipal(KerberosParams).then(res => { |
|
|
|
self.form.keyPath.setValue(res.data.keytabPath); |
|
|
|
self.form.keyPath.setValue(res.data.keytabPath); |
|
|
|
self.form.krb5Path.setValue(res.data.krb5ConfPath); |
|
|
|
self.form.krb5Path.setValue(res.data.krb5ConfPath); |
|
|
|
}); |
|
|
|
}); |
|
|
|