|
|
@ -16,10 +16,10 @@ export class MaintainForm extends BI.Widget { |
|
|
|
|
|
|
|
|
|
|
|
props = { |
|
|
|
props = { |
|
|
|
connectionType: '', |
|
|
|
connectionType: '', |
|
|
|
} |
|
|
|
}; |
|
|
|
isEdit = false; |
|
|
|
isEdit = false; |
|
|
|
connectionName = ''; |
|
|
|
connectionName = ''; |
|
|
|
|
|
|
|
|
|
|
|
model: MaintainFormModel['model']; |
|
|
|
model: MaintainFormModel['model']; |
|
|
|
store: MaintainFormModel['store']; |
|
|
|
store: MaintainFormModel['store']; |
|
|
|
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
this.store.updateConnection(this.connectionName, value).then(result => { |
|
|
|
this.store.updateConnection(this.connectionName, value).then(result => { |
|
|
|
if (result.errorCode) { |
|
|
|
if (result.errorCode) { |
|
|
|
this.showError(result); |
|
|
|
this.showError(result); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.store.goFirstPage(); |
|
|
|
this.store.goFirstPage(); |
|
|
@ -55,7 +55,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
testEvent: () => { |
|
|
|
testEvent: () => { |
|
|
|
this.testConnection(); |
|
|
|
this.testConnection(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const formData = BI.clone(this.getFormData()); |
|
|
|
const formData = BI.clone(this.getFormData()); |
|
|
@ -63,7 +63,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
formData.connectionName = this.getConnectionName(formData.connectionName); |
|
|
|
formData.connectionName = this.getConnectionName(formData.connectionName); |
|
|
|
this.isEdit = false; |
|
|
|
this.isEdit = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: this.getFormType(), |
|
|
|
type: this.getFormType(), |
|
|
|
formData, |
|
|
|
formData, |
|
|
@ -98,7 +98,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getFormData():Connection { |
|
|
|
private getFormData(): Connection { |
|
|
|
switch (this.options.connectionType) { |
|
|
|
switch (this.options.connectionType) { |
|
|
|
case connectionType.JDBC: |
|
|
|
case connectionType.JDBC: |
|
|
|
return this.getJdbcConnection(); |
|
|
|
return this.getJdbcConnection(); |
|
|
@ -111,7 +111,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getJdbcConnection():Connection { |
|
|
|
private getJdbcConnection(): Connection { |
|
|
|
const connectionName = this.getConnectionName(); |
|
|
|
const connectionName = this.getConnectionName(); |
|
|
|
let editConnection: Connection; |
|
|
|
let editConnection: Connection; |
|
|
|
let connectionData: ConnectionJDBC; |
|
|
|
let connectionData: ConnectionJDBC; |
|
|
@ -122,8 +122,10 @@ export class MaintainForm extends BI.Widget { |
|
|
|
database: this.model.datebaseTypeSelectedOne.databaseType, |
|
|
|
database: this.model.datebaseTypeSelectedOne.databaseType, |
|
|
|
connectionName, |
|
|
|
connectionName, |
|
|
|
connectionPoolAttr: DEFAULT_JDBC_POOL, |
|
|
|
connectionPoolAttr: DEFAULT_JDBC_POOL, |
|
|
|
port:'', |
|
|
|
port: '', |
|
|
|
host: 'localhost', |
|
|
|
host: 'localhost', |
|
|
|
|
|
|
|
fetchSize: this.model.datebaseTypeSelectedOne.fetchSize ?? -1, |
|
|
|
|
|
|
|
identity: BI.UUID(), |
|
|
|
}; |
|
|
|
}; |
|
|
|
editConnection = { |
|
|
|
editConnection = { |
|
|
|
connectionId: '', |
|
|
|
connectionId: '', |
|
|
@ -131,7 +133,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
connectionType: connectionType.JDBC, |
|
|
|
connectionType: connectionType.JDBC, |
|
|
|
connectionName, |
|
|
|
connectionName, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return editConnection; |
|
|
|
return editConnection; |
|
|
|
} |
|
|
|
} |
|
|
|
this.isEdit = true; |
|
|
|
this.isEdit = true; |
|
|
@ -139,11 +141,11 @@ export class MaintainForm extends BI.Widget { |
|
|
|
const connection = BI.clone(this.model.connectionSelectedOne); |
|
|
|
const connection = BI.clone(this.model.connectionSelectedOne); |
|
|
|
const { database, driver } = connection.connectionData as ConnectionJDBC; |
|
|
|
const { database, driver } = connection.connectionData as ConnectionJDBC; |
|
|
|
(connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType; |
|
|
|
(connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType; |
|
|
|
|
|
|
|
|
|
|
|
return connection; |
|
|
|
return connection; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getJndiConnection():Connection { |
|
|
|
private getJndiConnection(): Connection { |
|
|
|
if (this.model.datebaseTypeSelected) { |
|
|
|
if (this.model.datebaseTypeSelected) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
connectionId: '', |
|
|
|
connectionId: '', |
|
|
@ -154,18 +156,18 @@ export class MaintainForm extends BI.Widget { |
|
|
|
} |
|
|
|
} |
|
|
|
this.connectionName = this.model.connectionSelectedOne.connectionName; |
|
|
|
this.connectionName = this.model.connectionSelectedOne.connectionName; |
|
|
|
this.isEdit = true; |
|
|
|
this.isEdit = true; |
|
|
|
|
|
|
|
|
|
|
|
return this.model.connectionSelectedOne; |
|
|
|
return this.model.connectionSelectedOne; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getPluginConnection():Connection { |
|
|
|
private getPluginConnection(): Connection { |
|
|
|
if (!this.model.datebaseTypeSelected) { |
|
|
|
if (!this.model.datebaseTypeSelected) { |
|
|
|
this.connectionName = this.model.connectionSelectedOne.connectionName; |
|
|
|
this.connectionName = this.model.connectionSelectedOne.connectionName; |
|
|
|
this.isEdit = true; |
|
|
|
this.isEdit = true; |
|
|
|
|
|
|
|
|
|
|
|
return this.model.connectionSelectedOne; |
|
|
|
return this.model.connectionSelectedOne; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
connectionId: '', |
|
|
|
connectionId: '', |
|
|
|
connectionType: this.model.datebaseTypeSelectedOne.databaseType, |
|
|
|
connectionType: this.model.datebaseTypeSelectedOne.databaseType, |
|
|
@ -174,27 +176,27 @@ export class MaintainForm extends BI.Widget { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private testValue():boolean { |
|
|
|
private testValue(): boolean { |
|
|
|
const value = this.form.getSubmitValue(); |
|
|
|
const value = this.form.getSubmitValue(); |
|
|
|
if (!value.connectionName) { |
|
|
|
if (!value.connectionName) { |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.connectionName !== value.connectionName) { |
|
|
|
if (this.connectionName !== value.connectionName) { |
|
|
|
const hasNamed = this.model.connections.some(item => item.connectionName === value.connectionName); |
|
|
|
const hasNamed = this.model.connections.some(item => item.connectionName === value.connectionName); |
|
|
|
if (hasNamed) { |
|
|
|
if (hasNamed) { |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (getChartLength(value.connectionName) > NAME_MAX_LENGTH) { |
|
|
|
if (getChartLength(value.connectionName) > NAME_MAX_LENGTH) { |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -204,7 +206,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
BI.Msg.toast(BI.i18nText(result.errorMsg), { |
|
|
|
BI.Msg.toast(BI.i18nText(result.errorMsg), { |
|
|
|
level: 'error', |
|
|
|
level: 'error', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -220,12 +222,12 @@ export class MaintainForm extends BI.Widget { |
|
|
|
const formValue = this.form.getSubmitValue(); |
|
|
|
const formValue = this.form.getSubmitValue(); |
|
|
|
if (!formValue.connectionName) { |
|
|
|
if (!formValue.connectionName) { |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { |
|
|
|
if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); |
|
|
|
this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.isEdit || this.model.isCopy) { |
|
|
|
if (this.isEdit || this.model.isCopy) { |
|
|
@ -256,7 +258,7 @@ export class MaintainForm extends BI.Widget { |
|
|
|
level: 'error', |
|
|
|
level: 'error', |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.store.goFirstPage(); |
|
|
|
this.store.goFirstPage(); |
|
|
|