|
|
|
@ -3,8 +3,8 @@ import { MaintainFormModelXtype, MaintainFormModel } from './form.model';
|
|
|
|
|
import { FormJdbc, FormJdbcXtype } from './components/form.jdbc'; |
|
|
|
|
import { FormJndiXtype } from './components/form.jndi'; |
|
|
|
|
import { FormPluginXtype } from './components/form.plugin'; |
|
|
|
|
import { connectionType } from '@constants/env'; |
|
|
|
|
import { ConnectionJDBC, Connection } from 'src/modules/crud/crud.typings'; |
|
|
|
|
import { connectionType, errorCode } from '@constants/env'; |
|
|
|
|
import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.typings'; |
|
|
|
|
import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant'; |
|
|
|
|
import { getJdbcDatabaseType, getChartLength } from '../../../app.service'; |
|
|
|
|
export const MaintainFormXtype = 'dec.dcm.maintain.form'; |
|
|
|
@ -33,7 +33,7 @@ export class MaintainForm extends BI.Widget {
|
|
|
|
|
(value.connectionData as ConnectionJDBC).creator = BI.get(this.getFormData().connectionData, 'creator'); |
|
|
|
|
this.store.updateConnection(this.connectionName, value).then(result => { |
|
|
|
|
if (result.errorCode) { |
|
|
|
|
this.setFromError(BI.i18nText(result.errorMsg)); |
|
|
|
|
this.showError(result); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -44,7 +44,7 @@ export class MaintainForm extends BI.Widget {
|
|
|
|
|
form.connectionId = this.connectionName; |
|
|
|
|
this.store.addConnection(form).then(result => { |
|
|
|
|
if (result.errorCode) { |
|
|
|
|
this.setFromError(BI.i18nText(result.errorMsg)); |
|
|
|
|
this.showError(result); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -199,6 +199,16 @@ export class MaintainForm extends BI.Widget {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private showError(result: ResultType) { |
|
|
|
|
result.errorCode === errorCode.DUPLICATE_NAMES ? |
|
|
|
|
this.setFromError(BI.i18nText(result.errorMsg)) : |
|
|
|
|
BI.Msg.toast(BI.i18nText(result.errorMsg), { |
|
|
|
|
level: 'error', |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private setFromError(errMsg: string) { |
|
|
|
|
this.form.setError ? this.form.setError(errMsg) : null; |
|
|
|
|
} |
|
|
|
|