Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
d7f363e9
提交
d7f363e9
authored
8月 16, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 数据源高级参数设置
上级
ede4ebde
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
173 行增加
和
37 行删除
+173
-37
JdbcDTO.java
...end/src/main/java/io/dataease/datasource/dto/JdbcDTO.java
+8
-0
JdbcProvider.java
...in/java/io/dataease/datasource/provider/JdbcProvider.java
+14
-7
DatasourceService.java
...ava/io/dataease/datasource/service/DatasourceService.java
+6
-1
ExcelFileData.java
.../src/main/java/io/dataease/dto/dataset/ExcelFileData.java
+0
-2
en.js
frontend/src/lang/en.js
+15
-1
tw.js
frontend/src/lang/tw.js
+15
-1
zh.js
frontend/src/lang/zh.js
+15
-1
demo.css
frontend/src/styles/deicon/demo.css
+17
-17
form.vue
frontend/src/views/system/datasource/form.vue
+83
-7
没有找到文件。
backend/src/main/java/io/dataease/datasource/dto/JdbcDTO.java
浏览文件 @
d7f363e9
...
@@ -14,4 +14,12 @@ public class JdbcDTO {
...
@@ -14,4 +14,12 @@ public class JdbcDTO {
private
String
dataBase
;
private
String
dataBase
;
private
String
schema
;
private
String
schema
;
private
String
dataSourceType
=
"jdbc"
;
private
String
dataSourceType
=
"jdbc"
;
private
int
initialPoolSize
=
5
;
private
int
minPoolSize
=
5
;
private
int
maxPoolSize
=
50
;
private
int
maxIdleTime
=
30
;
private
int
acquireIncrement
=
5
;
private
int
idleConnectionTestPeriod
=
5
;
private
int
connectTimeout
=
5
;
}
}
backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java
浏览文件 @
d7f363e9
...
@@ -373,12 +373,12 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -373,12 +373,12 @@ public class JdbcProvider extends DatasourceProvider {
private
void
addToPool
(
DatasourceRequest
datasourceRequest
)
throws
PropertyVetoException
{
private
void
addToPool
(
DatasourceRequest
datasourceRequest
)
throws
PropertyVetoException
{
ComboPooledDataSource
dataSource
;
ComboPooledDataSource
dataSource
;
dataSource
=
new
ComboPooledDataSource
();
dataSource
=
new
ComboPooledDataSource
();
setCredential
(
datasourceRequest
,
dataSource
);
JdbcDTO
jdbcDTO
=
setCredential
(
datasourceRequest
,
dataSource
);
dataSource
.
setMaxIdleTime
(
30
);
// 最大空闲时间
dataSource
.
setMaxIdleTime
(
jdbcDTO
.
getMaxIdleTime
()
);
// 最大空闲时间
dataSource
.
setAcquireIncrement
(
5
);
// 增长数
dataSource
.
setAcquireIncrement
(
jdbcDTO
.
getAcquireIncrement
()
);
// 增长数
dataSource
.
setInitialPoolSize
(
initPoolSize
);
// 初始连接数
dataSource
.
setInitialPoolSize
(
jdbcDTO
.
getInitialPoolSize
()
);
// 初始连接数
dataSource
.
setMinPoolSize
(
initPoolSize
);
// 最小连接数
dataSource
.
setMinPoolSize
(
jdbcDTO
.
getMinPoolSize
()
);
// 最小连接数
dataSource
.
setMaxPoolSize
(
maxConnections
);
// 最大连接数
dataSource
.
setMaxPoolSize
(
jdbcDTO
.
getMaxPoolSize
()
);
// 最大连接数
dataSource
.
setAcquireRetryAttempts
(
30
);
// 获取连接重试次数
dataSource
.
setAcquireRetryAttempts
(
30
);
// 获取连接重试次数
dataSource
.
setIdleConnectionTestPeriod
(
60
);
// 每60s检查数据库空闲连接
dataSource
.
setIdleConnectionTestPeriod
(
60
);
// 每60s检查数据库空闲连接
dataSource
.
setMaxStatements
(
0
);
// c3p0全局的PreparedStatements缓存的大小
dataSource
.
setMaxStatements
(
0
);
// c3p0全局的PreparedStatements缓存的大小
...
@@ -449,8 +449,9 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -449,8 +449,9 @@ public class JdbcProvider extends DatasourceProvider {
}
}
private
void
setCredential
(
DatasourceRequest
datasourceRequest
,
ComboPooledDataSource
dataSource
)
throws
PropertyVetoException
{
private
JdbcDTO
setCredential
(
DatasourceRequest
datasourceRequest
,
ComboPooledDataSource
dataSource
)
throws
PropertyVetoException
{
DatasourceTypes
datasourceType
=
DatasourceTypes
.
valueOf
(
datasourceRequest
.
getDatasource
().
getType
());
DatasourceTypes
datasourceType
=
DatasourceTypes
.
valueOf
(
datasourceRequest
.
getDatasource
().
getType
());
JdbcDTO
jdbcDTO
=
new
JdbcDTO
();
switch
(
datasourceType
)
{
switch
(
datasourceType
)
{
case
mysql:
case
mysql:
MysqlConfigration
mysqlConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
MysqlConfigration
.
class
);
MysqlConfigration
mysqlConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
MysqlConfigration
.
class
);
...
@@ -458,6 +459,7 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -458,6 +459,7 @@ public class JdbcProvider extends DatasourceProvider {
dataSource
.
setDriverClass
(
mysqlConfigration
.
getDriver
());
dataSource
.
setDriverClass
(
mysqlConfigration
.
getDriver
());
dataSource
.
setPassword
(
mysqlConfigration
.
getPassword
());
dataSource
.
setPassword
(
mysqlConfigration
.
getPassword
());
dataSource
.
setJdbcUrl
(
mysqlConfigration
.
getJdbc
());
dataSource
.
setJdbcUrl
(
mysqlConfigration
.
getJdbc
());
jdbcDTO
=
mysqlConfigration
;
break
;
break
;
case
doris:
case
doris:
MysqlConfigration
dorisConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
MysqlConfigration
.
class
);
MysqlConfigration
dorisConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
MysqlConfigration
.
class
);
...
@@ -465,6 +467,7 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -465,6 +467,7 @@ public class JdbcProvider extends DatasourceProvider {
dataSource
.
setDriverClass
(
dorisConfigration
.
getDriver
());
dataSource
.
setDriverClass
(
dorisConfigration
.
getDriver
());
dataSource
.
setPassword
(
dorisConfigration
.
getPassword
());
dataSource
.
setPassword
(
dorisConfigration
.
getPassword
());
dataSource
.
setJdbcUrl
(
dorisConfigration
.
getJdbc
());
dataSource
.
setJdbcUrl
(
dorisConfigration
.
getJdbc
());
jdbcDTO
=
dorisConfigration
;
break
;
break
;
case
sqlServer:
case
sqlServer:
SqlServerConfigration
sqlServerConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
SqlServerConfigration
.
class
);
SqlServerConfigration
sqlServerConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
SqlServerConfigration
.
class
);
...
@@ -472,6 +475,7 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -472,6 +475,7 @@ public class JdbcProvider extends DatasourceProvider {
dataSource
.
setDriverClass
(
sqlServerConfigration
.
getDriver
());
dataSource
.
setDriverClass
(
sqlServerConfigration
.
getDriver
());
dataSource
.
setPassword
(
sqlServerConfigration
.
getPassword
());
dataSource
.
setPassword
(
sqlServerConfigration
.
getPassword
());
dataSource
.
setJdbcUrl
(
sqlServerConfigration
.
getJdbc
());
dataSource
.
setJdbcUrl
(
sqlServerConfigration
.
getJdbc
());
jdbcDTO
=
sqlServerConfigration
;
break
;
break
;
case
oracle:
case
oracle:
OracleConfigration
oracleConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
OracleConfigration
.
class
);
OracleConfigration
oracleConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
OracleConfigration
.
class
);
...
@@ -479,6 +483,7 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -479,6 +483,7 @@ public class JdbcProvider extends DatasourceProvider {
dataSource
.
setDriverClass
(
oracleConfigration
.
getDriver
());
dataSource
.
setDriverClass
(
oracleConfigration
.
getDriver
());
dataSource
.
setPassword
(
oracleConfigration
.
getPassword
());
dataSource
.
setPassword
(
oracleConfigration
.
getPassword
());
dataSource
.
setJdbcUrl
(
oracleConfigration
.
getJdbc
());
dataSource
.
setJdbcUrl
(
oracleConfigration
.
getJdbc
());
jdbcDTO
=
oracleConfigration
;
break
;
break
;
case
pg:
case
pg:
PgConfigration
pgConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
PgConfigration
.
class
);
PgConfigration
pgConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
PgConfigration
.
class
);
...
@@ -486,10 +491,12 @@ public class JdbcProvider extends DatasourceProvider {
...
@@ -486,10 +491,12 @@ public class JdbcProvider extends DatasourceProvider {
dataSource
.
setDriverClass
(
pgConfigration
.
getDriver
());
dataSource
.
setDriverClass
(
pgConfigration
.
getDriver
());
dataSource
.
setPassword
(
pgConfigration
.
getPassword
());
dataSource
.
setPassword
(
pgConfigration
.
getPassword
());
dataSource
.
setJdbcUrl
(
pgConfigration
.
getJdbc
());
dataSource
.
setJdbcUrl
(
pgConfigration
.
getJdbc
());
jdbcDTO
=
pgConfigration
;
break
;
break
;
default
:
default
:
break
;
break
;
}
}
return
jdbcDTO
;
}
}
private
String
getDatabase
(
DatasourceRequest
datasourceRequest
)
{
private
String
getDatabase
(
DatasourceRequest
datasourceRequest
)
{
...
...
backend/src/main/java/io/dataease/datasource/service/DatasourceService.java
浏览文件 @
d7f363e9
...
@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
...
@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.xml.crypto.Data
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
...
@@ -77,7 +78,11 @@ public class DatasourceService {
...
@@ -77,7 +78,11 @@ public class DatasourceService {
public
List
<
DatasourceDTO
>
getDatasourceList
(
DatasourceUnionRequest
request
)
throws
Exception
{
public
List
<
DatasourceDTO
>
getDatasourceList
(
DatasourceUnionRequest
request
)
throws
Exception
{
request
.
setSort
(
"update_time desc"
);
request
.
setSort
(
"update_time desc"
);
return
extDataSourceMapper
.
queryUnion
(
request
);
List
<
DatasourceDTO
>
datasourceDTOS
=
extDataSourceMapper
.
queryUnion
(
request
);
datasourceDTOS
.
forEach
(
datasourceDTO
->
{
datasourceDTO
.
getType
();
});
return
datasourceDTOS
;
}
}
public
List
<
DatasourceDTO
>
gridQuery
(
BaseGridRequest
request
)
{
public
List
<
DatasourceDTO
>
gridQuery
(
BaseGridRequest
request
)
{
...
...
backend/src/main/java/io/dataease/dto/dataset/ExcelFileData.java
浏览文件 @
d7f363e9
package
io
.
dataease
.
dto
.
dataset
;
package
io
.
dataease
.
dto
.
dataset
;
import
io.dataease.datasource.dto.TableFiled
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Data
@Data
public
class
ExcelFileData
{
public
class
ExcelFileData
{
...
...
frontend/src/lang/en.js
浏览文件 @
d7f363e9
...
@@ -1044,7 +1044,21 @@ export default {
...
@@ -1044,7 +1044,21 @@ export default {
get_schema
:
'Get Schema'
,
get_schema
:
'Get Schema'
,
schema
:
'Database Schema'
,
schema
:
'Database Schema'
,
please_choose_schema
:
'Please select Schema'
,
please_choose_schema
:
'Please select Schema'
,
in_valid
:
'Invalid datasource'
in_valid
:
'Invalid datasource'
,
initial_pool_size
:
'Initial connections'
,
min_pool_size
:
'Minimum of connections'
,
max_pool_size
:
'Maximum connection'
,
max_idle_time
:
'Maximum idle (seconds)'
,
acquire_increment
:
'Growth number'
,
connect_timeout
:
'Connection timeout (seconds)'
,
please_input_initial_pool_size
:
'Please enter the number of initial connections'
,
please_input_min_pool_size
:
'Please enter the minimum number of connections'
,
please_input_max_pool_size
:
'Please enter the maximum number of connections'
,
please_input_max_idle_time
:
'Please enter the maximum idle (seconds)'
,
please_input_acquire_increment
:
'Please enter the growth number'
,
please_input_connect_timeout
:
'Please enter the connection timeout (seconds)'
,
no_less_then_0
:
'Parameters in advanced settings cannot be less than zero'
,
priority
:
'Advanced setting'
},
},
pblink
:
{
pblink
:
{
key_pwd
:
'Please enter the password to open the link'
,
key_pwd
:
'Please enter the password to open the link'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
d7f363e9
...
@@ -1044,7 +1044,21 @@ export default {
...
@@ -1044,7 +1044,21 @@ export default {
get_schema
:
'獲取 Schema'
,
get_schema
:
'獲取 Schema'
,
schema
:
'數據庫 Schema'
,
schema
:
'數據庫 Schema'
,
please_choose_schema
:
'請選擇數據庫 Schema'
,
please_choose_schema
:
'請選擇數據庫 Schema'
,
in_valid
:
'無效數據源'
in_valid
:
'無效數據源'
,
initial_pool_size
:
'初始連結數'
,
min_pool_size
:
'最小連結數'
,
max_pool_size
:
'最大連結數'
,
max_idle_time
:
'最大空閒(秒)'
,
acquire_increment
:
'增長數'
,
connect_timeout
:
'連接超時(秒)'
,
please_input_initial_pool_size
:
'請輸入初始連結數'
,
please_input_min_pool_size
:
'請輸入最小連結數'
,
please_input_max_pool_size
:
'請輸入最大連結數'
,
please_input_max_idle_time
:
'請輸入最大空閒(秒)'
,
please_input_acquire_increment
:
'請輸入增長數'
,
please_input_connect_timeout
:
'請輸入連接超時(秒)'
,
no_less_then_0
:
'高級設置中的參數不能小於零'
,
priority
:
'高級設置'
},
},
pblink
:
{
pblink
:
{
key_pwd
:
'請輸入密碼打開鏈接'
,
key_pwd
:
'請輸入密碼打開鏈接'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
d7f363e9
...
@@ -1046,7 +1046,21 @@ export default {
...
@@ -1046,7 +1046,21 @@ export default {
schema
:
'数据库 Schema'
,
schema
:
'数据库 Schema'
,
please_choose_schema
:
'请选择数据库 Schema'
,
please_choose_schema
:
'请选择数据库 Schema'
,
edit_datasource_msg
:
'修改数据源信息,可能会导致改数据源下的数据集不可用,确认修改?'
,
edit_datasource_msg
:
'修改数据源信息,可能会导致改数据源下的数据集不可用,确认修改?'
,
in_valid
:
'无效数据源'
in_valid
:
'无效数据源'
,
initial_pool_size
:
'初始连接数'
,
min_pool_size
:
'最小连接数'
,
max_pool_size
:
'最大连接数'
,
max_idle_time
:
'最大空闲(秒)'
,
acquire_increment
:
'增长数'
,
connect_timeout
:
'连接超时(秒)'
,
please_input_initial_pool_size
:
'请输入初始连接数'
,
please_input_min_pool_size
:
'请输入最小连接数'
,
please_input_max_pool_size
:
'请输入最大连接数'
,
please_input_max_idle_time
:
'请输入最大空闲(秒)'
,
please_input_acquire_increment
:
'请输入增长数'
,
please_input_connect_timeout
:
'请输入连接超时(秒)'
,
no_less_then_0
:
'高级设置中的参数不能小于零'
,
priority
:
'高级设置'
},
},
pblink
:
{
pblink
:
{
key_pwd
:
'请输入密码打开链接'
,
key_pwd
:
'请输入密码打开链接'
,
...
...
frontend/src/styles/deicon/demo.css
浏览文件 @
d7f363e9
...
@@ -215,35 +215,35 @@
...
@@ -215,35 +215,35 @@
margin
:
1em
0
;
margin
:
1em
0
;
}
}
.markdown
>
p
,
.markdown
>
p
,
.markdown
>
blockquote
,
.markdown
>
blockquote
,
.markdown
>
.highlight
,
.markdown
>
.highlight
,
.markdown
>
ol
,
.markdown
>
ol
,
.markdown
>
ul
{
.markdown
>
ul
{
width
:
80%
;
width
:
80%
;
}
}
.markdown
ul
>
li
{
.markdown
ul
>
li
{
list-style
:
circle
;
list-style
:
circle
;
}
}
.markdown
>
ul
li
,
.markdown
>
ul
li
,
.markdown
blockquote
ul
>
li
{
.markdown
blockquote
ul
>
li
{
margin-left
:
20px
;
margin-left
:
20px
;
padding-left
:
4px
;
padding-left
:
4px
;
}
}
.markdown
>
ul
li
p
,
.markdown
>
ul
li
p
,
.markdown
>
ol
li
p
{
.markdown
>
ol
li
p
{
margin
:
0.6em
0
;
margin
:
0.6em
0
;
}
}
.markdown
ol
>
li
{
.markdown
ol
>
li
{
list-style
:
decimal
;
list-style
:
decimal
;
}
}
.markdown
>
ol
li
,
.markdown
>
ol
li
,
.markdown
blockquote
ol
>
li
{
.markdown
blockquote
ol
>
li
{
margin-left
:
20px
;
margin-left
:
20px
;
padding-left
:
4px
;
padding-left
:
4px
;
}
}
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
font-weight
:
600
;
font-weight
:
600
;
}
}
.markdown
>
table
{
.markdown
>
table
{
border-collapse
:
collapse
;
border-collapse
:
collapse
;
border-spacing
:
0px
;
border-spacing
:
0px
;
empty-cells
:
show
;
empty-cells
:
show
;
...
@@ -269,14 +269,14 @@
...
@@ -269,14 +269,14 @@
margin-bottom
:
24px
;
margin-bottom
:
24px
;
}
}
.markdown
>
table
th
{
.markdown
>
table
th
{
white-space
:
nowrap
;
white-space
:
nowrap
;
color
:
#333
;
color
:
#333
;
font-weight
:
600
;
font-weight
:
600
;
}
}
.markdown
>
table
th
,
.markdown
>
table
th
,
.markdown
>
table
td
{
.markdown
>
table
td
{
border
:
1px
solid
#e9e9e9
;
border
:
1px
solid
#e9e9e9
;
padding
:
8px
16px
;
padding
:
8px
16px
;
text-align
:
left
;
text-align
:
left
;
...
...
frontend/src/views/system/datasource/form.vue
浏览文件 @
d7f363e9
...
@@ -11,8 +11,7 @@
...
@@ -11,8 +11,7 @@
<el-input
v-model=
"form.name"
autocomplete=
"off"
/>
<el-input
v-model=
"form.name"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
<el-form-item
:label=
"$t('commons.description')"
prop=
"desc"
>
<el-form-item
:label=
"$t('commons.description')"
prop=
"desc"
>
<el-input
v-model=
"form.desc"
autocomplete=
"off"
/>
<el-input
v-model=
"form.desc"
autocomplete=
"off"
type=
"textarea"
/>
</el-form-item>
</el-form-item>
<el-form-item
:label=
"$t('datasource.type')"
prop=
"type"
>
<el-form-item
:label=
"$t('datasource.type')"
prop=
"type"
>
<el-select
v-model=
"form.type"
:placeholder=
"$t('datasource.please_choose_type')"
class=
"select-width"
:disabled=
"formType=='modify' || (formType==='add' && params && !!params.type)"
@
change=
"changeType()"
>
<el-select
v-model=
"form.type"
:placeholder=
"$t('datasource.please_choose_type')"
class=
"select-width"
:disabled=
"formType=='modify' || (formType==='add' && params && !!params.type)"
@
change=
"changeType()"
>
...
@@ -62,7 +61,30 @@
...
@@ -62,7 +61,30 @@
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-collapse
>
<el-collapse-item
:title=
"$t('datasource.priority')"
name=
"1"
>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.initial_pool_size')"
prop=
"configuration.initialPoolSize"
>
<el-input
v-model=
"form.configuration.initialPoolSize"
autocomplete=
"off"
type=
"number"
min=
"0"
size=
"small"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.min_pool_size')"
prop=
"configuration.minPoolSize"
>
<el-input
v-model=
"form.configuration.minPoolSize"
autocomplete=
"off"
type=
"number"
min=
"0"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.max_pool_size')"
prop=
"configuration.maxPoolSize"
>
<el-input
v-model=
"form.configuration.maxPoolSize"
autocomplete=
"off"
type=
"number"
min=
"0"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.max_idle_time')"
prop=
"configuration.maxIdleTime"
>
<el-input
v-model=
"form.configuration.maxIdleTime"
autocomplete=
"off"
type=
"number"
min=
"0"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.acquire_increment')"
prop=
"configuration.acquireIncrement"
>
<el-input
v-model=
"form.configuration.acquireIncrement"
autocomplete=
"off"
type=
"number"
min=
"0"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.connect_timeout')"
prop=
"configuration.connectTimeout"
>
<el-input
v-model=
"form.configuration.connectTimeout"
autocomplete=
"off"
type=
"number"
min=
"0"
/>
</el-form-item>
</el-collapse-item>
</el-collapse>
</el-form>
</el-form>
<div
v-if=
"canEdit"
slot=
"footer"
class=
"dialog-footer"
>
<div
v-if=
"canEdit"
slot=
"footer"
class=
"dialog-footer"
>
<el-button
v-if=
"formType==='add'?true: hasDataPermission('manage',params.privileges)"
@
click=
"validaDatasource"
>
{{ $t('commons.validate') }}
</el-button>
<el-button
v-if=
"formType==='add'?true: hasDataPermission('manage',params.privileges)"
@
click=
"validaDatasource"
>
{{ $t('commons.validate') }}
</el-button>
...
@@ -92,7 +114,15 @@ export default {
...
@@ -92,7 +114,15 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
form
:
{
configuration
:
{}},
form
:
{
configuration
:
{
initialPoolSize
:
5
,
minPoolSize
:
5
,
maxPoolSize
:
50
,
maxIdleTime
:
30
,
acquireIncrement
:
5
,
idleConnectionTestPeriod
:
5
,
connectTimeout
:
5
}},
rule
:
{
rule
:
{
name
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.input_name'
),
trigger
:
'blur'
},
name
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.input_name'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
25
,
message
:
this
.
$t
(
'datasource.input_limit_2_25'
,
[
2
,
25
]),
trigger
:
'blur'
}],
{
min
:
2
,
max
:
25
,
message
:
this
.
$t
(
'datasource.input_limit_2_25'
,
[
2
,
25
]),
trigger
:
'blur'
}],
...
@@ -103,7 +133,13 @@ export default {
...
@@ -103,7 +133,13 @@ export default {
'configuration.username'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_user_name'
),
trigger
:
'blur'
}],
'configuration.username'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_user_name'
),
trigger
:
'blur'
}],
'configuration.password'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_password'
),
trigger
:
'change'
}],
'configuration.password'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_password'
),
trigger
:
'change'
}],
'configuration.host'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_host'
),
trigger
:
'change'
}],
'configuration.host'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_host'
),
trigger
:
'change'
}],
'configuration.port'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_port'
),
trigger
:
'change'
}]
'configuration.port'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_port'
),
trigger
:
'change'
}],
'configuration.initialPoolSize'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_initial_pool_size'
),
trigger
:
'change'
}],
'configuration.minPoolSize'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_min_pool_size'
),
trigger
:
'change'
}],
'configuration.maxPoolSize'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_max_pool_size'
),
trigger
:
'change'
}],
'configuration.maxIdleTime'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_max_idle_time'
),
trigger
:
'change'
}],
'configuration.acquireIncrement'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_acquire_increment'
),
trigger
:
'change'
}],
'configuration.connectTimeout'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_connect_timeout'
),
trigger
:
'change'
}]
},
},
allTypes
:
[{
name
:
'mysql'
,
label
:
'MySQL'
,
type
:
'jdbc'
},
allTypes
:
[{
name
:
'mysql'
,
label
:
'MySQL'
,
type
:
'jdbc'
},
{
name
:
'oracle'
,
label
:
'Oracle'
,
type
:
'jdbc'
},
{
name
:
'oracle'
,
label
:
'Oracle'
,
type
:
'jdbc'
},
...
@@ -131,9 +167,16 @@ export default {
...
@@ -131,9 +167,16 @@ export default {
methods
:
{
methods
:
{
setType
()
{
setType
()
{
this
.
form
.
type
=
this
.
params
.
type
this
.
form
.
type
=
this
.
params
.
type
this
.
form
.
configuration
=
{}
this
.
form
.
configuration
=
{
initialPoolSize
:
5
,
minPoolSize
:
5
,
maxPoolSize
:
50
,
maxIdleTime
:
30
,
acquireIncrement
:
5
,
idleConnectionTestPeriod
:
5
,
connectTimeout
:
5
}
this
.
changeType
()
this
.
changeType
()
console
.
log
(
this
.
form
)
},
},
changeEdit
()
{
changeEdit
()
{
this
.
canEdit
=
true
this
.
canEdit
=
true
...
@@ -148,16 +191,42 @@ export default {
...
@@ -148,16 +191,42 @@ export default {
this
.
form
=
Object
.
assign
({},
row
)
this
.
form
=
Object
.
assign
({},
row
)
this
.
originConfiguration
=
this
.
form
.
configuration
this
.
originConfiguration
=
this
.
form
.
configuration
this
.
form
.
configuration
=
JSON
.
parse
(
this
.
form
.
configuration
)
this
.
form
.
configuration
=
JSON
.
parse
(
this
.
form
.
configuration
)
if
(
!
this
.
form
.
configuration
.
initialPoolSize
){
this
.
form
.
configuration
.
initialPoolSize
=
5
}
if
(
!
this
.
form
.
configuration
.
minPoolSize
){
this
.
form
.
configuration
.
minPoolSize
=
5
}
if
(
!
this
.
form
.
configuration
.
maxPoolSize
){
this
.
form
.
configuration
.
maxPoolSize
=
50
}
if
(
!
this
.
form
.
configuration
.
maxIdleTime
){
this
.
form
.
configuration
.
maxIdleTime
=
30
}
if
(
!
this
.
form
.
configuration
.
acquireIncrement
){
this
.
form
.
configuration
.
acquireIncrement
=
5
}
if
(
!
this
.
form
.
configuration
.
idleConnectionTestPeriod
){
this
.
form
.
configuration
.
idleConnectionTestPeriod
=
5
}
if
(
!
this
.
form
.
configuration
.
connectTimeout
){
this
.
form
.
configuration
.
connectTimeout
=
5
}
},
},
reset
()
{
reset
()
{
this
.
$refs
.
dsForm
.
resetFields
()
this
.
$refs
.
dsForm
.
resetFields
()
},
},
save
()
{
save
()
{
if
(
!
this
.
form
.
configuration
.
schema
&&
this
.
form
.
type
===
'oracle'
)
{
if
(
!
this
.
form
.
configuration
.
schema
&&
(
this
.
form
.
type
===
'oracle'
||
this
.
form
.
type
===
'sqlServer'
)
)
{
this
.
$message
.
error
(
this
.
$t
(
'datasource.please_choose_schema'
))
this
.
$message
.
error
(
this
.
$t
(
'datasource.please_choose_schema'
))
return
return
}
}
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
.
$message
.
error
(
this
.
$t
(
'datasource.no_less_then_0'
))
return
}
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
const
method
=
this
.
formType
===
'add'
?
addDs
:
editDs
const
method
=
this
.
formType
===
'add'
?
addDs
:
editDs
...
@@ -244,4 +313,11 @@ export default {
...
@@ -244,4 +313,11 @@ export default {
transform
:
scale
(
0
.85
);
transform
:
scale
(
0
.85
);
}
}
}
}
.el-input
{
width
:
300px
;
}
.el-select
{
width
:
300px
;
}
</
style
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论