fix: 限制数据源端口号

This commit is contained in:
taojinlong 2021-10-11 15:06:18 +08:00
parent 2e57eb8768
commit a4157ca8f2
4 changed files with 9 additions and 2 deletions

View File

@ -1154,6 +1154,7 @@ export default {
please_input_acquire_increment: 'Please enter the growth number', please_input_acquire_increment: 'Please enter the growth number',
please_input_connect_timeout: 'Please enter the connection timeout (seconds)', please_input_connect_timeout: 'Please enter the connection timeout (seconds)',
no_less_then_0: 'Parameters in advanced settings cannot be less than zero', no_less_then_0: 'Parameters in advanced settings cannot be less than zero',
port_no_less_then_0: 'Port cannot be less than zero',
priority: 'Advanced setting', priority: 'Advanced setting',
extra_params: 'Extra JDBC connection string' extra_params: 'Extra JDBC connection string'
}, },

View File

@ -1157,6 +1157,7 @@ export default {
please_input_acquire_increment: '請輸入增長數', please_input_acquire_increment: '請輸入增長數',
please_input_connect_timeout: '請輸入連接超時(秒)', please_input_connect_timeout: '請輸入連接超時(秒)',
no_less_then_0: '高級設置中的參數不能小于零', no_less_then_0: '高級設置中的參數不能小于零',
port_no_less_then_0: '端口不能小於零',
priority: '高級設置', priority: '高級設置',
extra_params: '額外的JDBC連接字符串' extra_params: '額外的JDBC連接字符串'
}, },

View File

@ -1158,6 +1158,7 @@ export default {
please_input_acquire_increment: '请输入增长数', please_input_acquire_increment: '请输入增长数',
please_input_connect_timeout: '请输入连接超时(秒)', please_input_connect_timeout: '请输入连接超时(秒)',
no_less_then_0: '高级设置中的参数不能小于零', no_less_then_0: '高级设置中的参数不能小于零',
port_no_less_then_0: '端口不能小于零',
priority: '高级设置', priority: '高级设置',
data_mode: '数据模式', data_mode: '数据模式',
direct: '直连模式', direct: '直连模式',

View File

@ -57,7 +57,7 @@
</el-form-item> </el-form-item>
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.port')" prop="configuration.port" > <el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.port')" prop="configuration.port" >
<el-input v-model="form.configuration.port" autocomplete="off" /> <el-input v-model="form.configuration.port" autocomplete="off" type="number" min="0" />
</el-form-item> </el-form-item>
<el-form-item v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg'"> <el-form-item v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg'">
<el-button icon="el-icon-plus" size="mini" @click="getSchema()"> <el-button icon="el-icon-plus" size="mini" @click="getSchema()">
@ -225,6 +225,10 @@ export default {
this.$message.error(this.$t('datasource.please_choose_schema')) this.$message.error(this.$t('datasource.please_choose_schema'))
return return
} }
if (this.form.configuration.dataSourceType === 'jdbc' && this.form.configuration.port <= 0) {
this.$message.error(this.$t('datasource.port_no_less_then_0'))
return
}
if (this.form.configuration.initialPoolSize < 0 || this.form.configuration.minPoolSize < 0 || this.form.configuration.maxPoolSize < 0 || this.form.configuration.maxIdleTime < 0 || if (this.form.configuration.initialPoolSize < 0 || this.form.configuration.minPoolSize < 0 || this.form.configuration.maxPoolSize < 0 || this.form.configuration.maxIdleTime < 0 ||
this.form.configuration.acquireIncrement < 0 || this.form.configuration.idleConnectionTestPeriod < 0 || this.form.configuration.connectTimeout < 0) { this.form.configuration.acquireIncrement < 0 || this.form.configuration.idleConnectionTestPeriod < 0 || this.form.configuration.connectTimeout < 0) {
this.$message.error(this.$t('datasource.no_less_then_0')) this.$message.error(this.$t('datasource.no_less_then_0'))