Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
ad01a695
提交
ad01a695
authored
5月 19, 2022
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 支持数据源驱动管理
上级
1c0c09ac
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
975 行增加
和
60 行删除
+975
-60
DriverMgmController.java
...o/dataease/controller/datasource/DriverMgmController.java
+91
-0
DriverDTO.java
backend/src/main/java/io/dataease/dto/DriverDTO.java
+9
-0
ProviderFactory.java
...d/src/main/java/io/dataease/provider/ProviderFactory.java
+1
-2
JdbcProvider.java
...in/java/io/dataease/provider/datasource/JdbcProvider.java
+0
-0
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+1
-1
DatasourceService.java
...ava/io/dataease/service/datasource/DatasourceService.java
+9
-2
DriverService.java
...in/java/io/dataease/service/datasource/DriverService.java
+175
-0
V35__1.11.sql
backend/src/main/resources/db/migration/V35__1.11.sql
+22
-0
datasource.js
frontend/src/api/system/datasource.js
+55
-0
en.js
frontend/src/lang/en.js
+15
-0
tw.js
frontend/src/lang/tw.js
+15
-0
zh.js
frontend/src/lang/zh.js
+15
-0
DriverForm.vue
frontend/src/views/system/datasource/DriverForm.vue
+294
-0
DsConfiguration.vue
frontend/src/views/system/datasource/DsConfiguration.vue
+73
-25
DsForm.vue
frontend/src/views/system/datasource/DsForm.vue
+37
-5
DsMain.vue
frontend/src/views/system/datasource/DsMain.vue
+8
-1
DsTree.vue
frontend/src/views/system/datasource/DsTree.vue
+155
-23
index.vue
frontend/src/views/system/plugin/index.vue
+0
-1
没有找到文件。
backend/src/main/java/io/dataease/controller/datasource/DriverMgmController.java
0 → 100644
浏览文件 @
ad01a695
package
io
.
dataease
.
controller
.
datasource
;
import
io.dataease.dto.DriverDTO
;
import
io.dataease.plugins.common.base.domain.DeDriver
;
import
io.dataease.plugins.common.base.domain.DeDriverDetails
;
import
io.dataease.service.datasource.DriverService
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.security.core.parameters.P
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@ApiIgnore
@RequestMapping
(
"driver"
)
@RestController
public
class
DriverMgmController
{
@Resource
private
DriverService
driverService
;
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"驱动列表"
)
@PostMapping
(
"/list"
)
public
List
<
DriverDTO
>
listDeDriver
()
throws
Exception
{
return
driverService
.
list
();
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"删除驱动"
)
@PostMapping
(
"/delete/{id}"
)
public
void
delete
(
@PathVariable
String
id
)
throws
Exception
{
driverService
.
delete
(
id
);
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"驱动列表"
)
@GetMapping
(
"/list/{type}"
)
public
List
<
DriverDTO
>
listDeDriver
(
@PathVariable
String
type
)
throws
Exception
{
return
listDeDriver
().
stream
().
filter
(
driverDTO
->
driverDTO
.
getType
().
equalsIgnoreCase
(
type
)).
collect
(
Collectors
.
toList
());
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"添加驱动"
)
@PostMapping
(
"/save"
)
public
DeDriver
save
(
@RequestBody
DeDriver
deDriver
)
throws
Exception
{
return
driverService
.
save
(
deDriver
);
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"更新驱动"
)
@PostMapping
(
"/update"
)
public
DeDriver
update
(
@RequestBody
DeDriver
deDriver
)
throws
Exception
{
return
driverService
.
update
(
deDriver
);
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"驱动文件列表"
)
@GetMapping
(
"/listDriverDetails/{id}"
)
public
List
<
DeDriverDetails
>
listDriverDetails
(
@PathVariable
String
id
)
throws
Exception
{
return
driverService
.
listDriverDetails
(
id
);
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"删除驱动文件"
)
@PostMapping
(
"/deleteDriverFile/{id}"
)
public
void
deleteDriverFile
(
@PathVariable
String
id
)
throws
Exception
{
driverService
.
deleteDriverFile
(
id
);
}
@RequiresPermissions
(
"datasource:read"
)
@ApiOperation
(
"驱动文件上传"
)
@PostMapping
(
"file/upload"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"file"
,
value
=
"文件"
,
required
=
true
,
dataType
=
"MultipartFile"
),
@ApiImplicitParam
(
name
=
"id"
,
value
=
"驱动D"
,
required
=
true
,
dataType
=
"String"
)
})
public
void
excelUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"id"
)
String
id
)
throws
Exception
{
driverService
.
saveJar
(
file
,
id
);
}
}
backend/src/main/java/io/dataease/dto/DriverDTO.java
0 → 100644
浏览文件 @
ad01a695
package
io
.
dataease
.
dto
;
import
io.dataease.plugins.common.base.domain.DeDriver
;
import
lombok.Data
;
@Data
public
class
DriverDTO
extends
DeDriver
{
private
String
typeDesc
;
}
backend/src/main/java/io/dataease/provider/ProviderFactory.java
浏览文件 @
ad01a695
package
io
.
dataease
.
provider
;
package
io
.
dataease
.
provider
;
import
com.google.gson.Gson
;
import
io.dataease.plugins.common.constants.DatasourceTypes
;
import
io.dataease.plugins.common.constants.DatasourceTypes
;
import
io.dataease.plugins.common.dto.datasource.DataSourceType
;
import
io.dataease.plugins.common.dto.datasource.DataSourceType
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
io.dataease.plugins.config.SpringContextUtil
;
...
@@ -25,7 +24,7 @@ public class ProviderFactory implements ApplicationContextAware {
...
@@ -25,7 +24,7 @@ public class ProviderFactory implements ApplicationContextAware {
for
(
final
DatasourceTypes
d:
DatasourceTypes
.
values
())
{
for
(
final
DatasourceTypes
d:
DatasourceTypes
.
values
())
{
final
ConfigurableListableBeanFactory
beanFactory
=
((
ConfigurableApplicationContext
)
context
).
getBeanFactory
();
final
ConfigurableListableBeanFactory
beanFactory
=
((
ConfigurableApplicationContext
)
context
).
getBeanFactory
();
if
(
d
.
isDatasource
()){
if
(
d
.
isDatasource
()){
DataSourceType
dataSourceType
=
new
DataSourceType
(
d
.
getType
(),
d
.
getName
(),
false
,
d
.
getExtraParams
(),
d
.
getCalculationMode
());
DataSourceType
dataSourceType
=
new
DataSourceType
(
d
.
getType
(),
d
.
getName
(),
false
,
d
.
getExtraParams
(),
d
.
getCalculationMode
()
,
d
.
isJdbc
()
);
if
(
dataSourceType
.
getType
().
equalsIgnoreCase
(
"oracle"
)){
if
(
dataSourceType
.
getType
().
equalsIgnoreCase
(
"oracle"
)){
dataSourceType
.
setCharset
(
d
.
getCharset
());
dataSourceType
.
setCharset
(
d
.
getCharset
());
}
}
...
...
backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java
浏览文件 @
ad01a695
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
ad01a695
...
@@ -2270,7 +2270,7 @@ public class DataSetTableService {
...
@@ -2270,7 +2270,7 @@ public class DataSetTableService {
record
.
setSyncStatus
(
JobStatus
.
Error
.
name
());
record
.
setSyncStatus
(
JobStatus
.
Error
.
name
());
example
.
clear
();
example
.
clear
();
example
.
createCriteria
().
andSyncStatusEqualTo
(
JobStatus
.
Underway
.
name
())
example
.
createCriteria
().
andSyncStatusEqualTo
(
JobStatus
.
Underway
.
name
())
.
andIdIn
(
datasetTableTasks
.
stream
().
map
(
DatasetTableTask:
:
getTable
Id
).
collect
(
Collectors
.
toList
()));
.
andIdIn
(
jobStoppeddDatasetTables
.
stream
().
map
(
DatasetTable:
:
get
Id
).
collect
(
Collectors
.
toList
()));
datasetTableMapper
.
updateByExampleSelective
(
record
,
example
);
datasetTableMapper
.
updateByExampleSelective
(
record
,
example
);
//TaskLog
//TaskLog
...
...
backend/src/main/java/io/dataease/service/datasource/DatasourceService.java
浏览文件 @
ad01a695
...
@@ -27,11 +27,13 @@ import io.dataease.i18n.Translator;
...
@@ -27,11 +27,13 @@ import io.dataease.i18n.Translator;
import
io.dataease.plugins.common.base.domain.*
;
import
io.dataease.plugins.common.base.domain.*
;
import
io.dataease.plugins.common.base.mapper.DatasetTableMapper
;
import
io.dataease.plugins.common.base.mapper.DatasetTableMapper
;
import
io.dataease.plugins.common.base.mapper.DatasourceMapper
;
import
io.dataease.plugins.common.base.mapper.DatasourceMapper
;
import
io.dataease.plugins.common.constants.DatasourceCalculationMode
;
import
io.dataease.plugins.common.constants.DatasourceTypes
;
import
io.dataease.plugins.common.constants.DatasourceTypes
;
import
io.dataease.plugins.common.dto.datasource.DataSourceType
;
import
io.dataease.plugins.common.dto.datasource.DataSourceType
;
import
io.dataease.plugins.common.dto.datasource.TableDesc
;
import
io.dataease.plugins.common.dto.datasource.TableDesc
;
import
io.dataease.plugins.common.request.datasource.DatasourceRequest
;
import
io.dataease.plugins.common.request.datasource.DatasourceRequest
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
io.dataease.plugins.datasource.entity.JdbcConfiguration
;
import
io.dataease.plugins.datasource.provider.Provider
;
import
io.dataease.plugins.datasource.provider.Provider
;
import
io.dataease.provider.ProviderFactory
;
import
io.dataease.provider.ProviderFactory
;
import
io.dataease.provider.datasource.ApiProvider
;
import
io.dataease.provider.datasource.ApiProvider
;
...
@@ -41,10 +43,8 @@ import io.dataease.service.sys.SysAuthService;
...
@@ -41,10 +43,8 @@ import io.dataease.service.sys.SysAuthService;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -131,6 +131,13 @@ public class DatasourceService {
...
@@ -131,6 +131,13 @@ public class DatasourceService {
datasourceDTO
.
setCalculationMode
(
dataSourceType
.
getCalculationMode
());
datasourceDTO
.
setCalculationMode
(
dataSourceType
.
getCalculationMode
());
}
}
});
});
if
(!
datasourceDTO
.
getType
().
equalsIgnoreCase
(
DatasourceTypes
.
api
.
toString
())){
JdbcConfiguration
configuration
=
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
JdbcConfiguration
.
class
);
if
(
StringUtils
.
isNotEmpty
(
configuration
.
getCustomDriver
())
&&
!
configuration
.
getCustomDriver
().
equalsIgnoreCase
(
"default"
)){
datasourceDTO
.
setCalculationMode
(
DatasourceCalculationMode
.
DIRECT
);
}
}
if
(
datasourceDTO
.
getType
().
equalsIgnoreCase
(
DatasourceTypes
.
mysql
.
toString
())){
if
(
datasourceDTO
.
getType
().
equalsIgnoreCase
(
DatasourceTypes
.
mysql
.
toString
())){
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
MysqlConfiguration
.
class
))
);
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
MysqlConfiguration
.
class
))
);
}
}
...
...
backend/src/main/java/io/dataease/service/datasource/DriverService.java
0 → 100644
浏览文件 @
ad01a695
package
io
.
dataease
.
service
.
datasource
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.commons.utils.DeFileUtils
;
import
io.dataease.dto.DriverDTO
;
import
io.dataease.plugins.common.base.domain.DeDriver
;
import
io.dataease.plugins.common.base.domain.DeDriverDetails
;
import
io.dataease.plugins.common.base.domain.DeDriverDetailsExample
;
import
io.dataease.plugins.common.base.mapper.DeDriverDetailsMapper
;
import
io.dataease.plugins.common.base.mapper.DeDriverMapper
;
import
io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.lang.reflect.Modifier
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarFile
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Service
public
class
DriverService
{
private
static
String
DRIVER_PATH
=
"/opt/dataease/drivers/custom/"
;
@Resource
private
DeDriverMapper
deDriverMapper
;
@Resource
private
DeDriverDetailsMapper
deDriverDetailsMapper
;
@Resource
private
DatasourceService
datasourceService
;
public
List
<
DriverDTO
>
list
()
throws
Exception
{
List
<
DriverDTO
>
driverDTOS
=
new
ArrayList
<>();
deDriverMapper
.
selectByExample
(
null
).
forEach
(
deDriver
->
{
DriverDTO
driverDTO
=
new
DriverDTO
();
BeanUtils
.
copyBean
(
driverDTO
,
deDriver
);
datasourceService
.
types
().
forEach
(
dataSourceType
->
{
if
(
dataSourceType
.
getType
().
equalsIgnoreCase
(
deDriver
.
getType
()))
{
driverDTO
.
setTypeDesc
(
dataSourceType
.
getName
());
}
});
driverDTOS
.
add
(
driverDTO
);
});
return
driverDTOS
;
}
public
void
delete
(
String
driverId
)
{
deDriverMapper
.
deleteByPrimaryKey
(
driverId
);
DeDriverDetailsExample
example
=
new
DeDriverDetailsExample
();
example
.
createCriteria
().
andDeDriverIdEqualTo
(
driverId
);
deDriverDetailsMapper
.
deleteByExample
(
example
);
DeFileUtils
.
deleteFile
(
DRIVER_PATH
+
driverId
+
"/"
);
}
public
DeDriver
save
(
DeDriver
deDriver
)
{
deDriver
.
setCreateTime
(
System
.
currentTimeMillis
());
deDriver
.
setId
(
UUID
.
randomUUID
().
toString
());
deDriverMapper
.
insert
(
deDriver
);
return
deDriver
;
}
public
DeDriver
update
(
DeDriver
deDriver
)
{
deDriverMapper
.
updateByPrimaryKey
(
deDriver
);
return
deDriver
;
}
public
List
<
DeDriverDetails
>
listDriverDetails
(
String
driverId
)
{
DeDriverDetailsExample
example
=
new
DeDriverDetailsExample
();
example
.
createCriteria
().
andDeDriverIdEqualTo
(
driverId
);
return
deDriverDetailsMapper
.
selectByExampleWithBLOBs
(
example
);
}
public
void
deleteDriverFile
(
String
driverFileId
)
{
DeDriverDetails
deDriverDetails
=
deDriverDetailsMapper
.
selectByPrimaryKey
(
driverFileId
);
DeFileUtils
.
deleteFile
(
DRIVER_PATH
+
deDriverDetails
.
getDeDriverId
()
+
"/"
+
deDriverDetails
.
getFileName
());
deDriverDetailsMapper
.
deleteByPrimaryKey
(
driverFileId
);
}
public
void
saveJar
(
MultipartFile
file
,
String
driverId
)
throws
Exception
{
String
filename
=
file
.
getOriginalFilename
();
String
dirPath
=
DRIVER_PATH
+
driverId
+
"/"
;
String
filePath
=
dirPath
+
filename
;
saveFile
(
file
,
dirPath
,
filePath
);
List
<
String
>
jdbcList
=
new
ArrayList
<>();
String
version
=
""
;
// ExtendedJdbcClassLoader extendedJdbcClassLoader = new ExtendedJdbcClassLoader(new URL[]{new File(filePath).toURI().toURL()}, null);
// for (String className : getClassNameFrom(filePath)) {
// if (isChildClass(className, java.sql.Driver.class, extendedJdbcClassLoader)) {
// jdbcList.add(className);
// version = classVersion(extendedJdbcClassLoader, className);
// }
// }
DeDriverDetails
deDriverDetails
=
new
DeDriverDetails
();
deDriverDetails
.
setId
(
UUID
.
randomUUID
().
toString
());
deDriverDetails
.
setDeDriverId
(
driverId
);
deDriverDetails
.
setVersion
(
version
);
deDriverDetails
.
setFileName
(
filename
);
deDriverDetails
.
setDriverClass
(
String
.
join
(
","
,
jdbcList
));
deDriverDetailsMapper
.
insert
(
deDriverDetails
);
}
private
List
<
String
>
getClassNameFrom
(
String
jarName
)
{
List
<
String
>
fileList
=
new
ArrayList
<
String
>();
try
{
JarFile
jarFile
=
new
JarFile
(
new
File
(
jarName
));
Enumeration
<
JarEntry
>
en
=
jarFile
.
entries
();
// 枚举获得JAR文件内的实体,即相对路径
while
(
en
.
hasMoreElements
())
{
String
name1
=
en
.
nextElement
().
getName
();
if
(!
name1
.
endsWith
(
".class"
))
{
//不是class文件
continue
;
}
String
name2
=
name1
.
substring
(
0
,
name1
.
lastIndexOf
(
".class"
));
String
name3
=
name2
.
replaceAll
(
"/"
,
"."
);
fileList
.
add
(
name3
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
fileList
;
}
public
boolean
isChildClass
(
String
className
,
Class
parentClazz
,
ExtendedJdbcClassLoader
extendedJdbcClassLoader
)
{
if
(
className
==
null
)
return
false
;
Class
clazz
=
null
;
try
{
clazz
=
extendedJdbcClassLoader
.
loadClass
(
className
);
if
(
Modifier
.
isAbstract
(
clazz
.
getModifiers
()))
{
//抽象类忽略
return
false
;
}
if
(
Modifier
.
isInterface
(
clazz
.
getModifiers
()))
{
//接口忽略
return
false
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
return
parentClazz
.
isAssignableFrom
(
clazz
);
}
private
String
classVersion
(
ExtendedJdbcClassLoader
extendedJdbcClassLoader
,
String
className
)
throws
Exception
{
Class
clazz
=
extendedJdbcClassLoader
.
loadClass
(
className
);
return
clazz
.
getPackage
().
getImplementationVersion
();
}
private
String
saveFile
(
MultipartFile
file
,
String
dirPath
,
String
filePath
)
throws
Exception
{
File
p
=
new
File
(
dirPath
);
if
(!
p
.
exists
())
{
p
.
mkdirs
();
}
File
f
=
new
File
(
filePath
);
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
f
);
fileOutputStream
.
write
(
file
.
getBytes
());
fileOutputStream
.
flush
();
fileOutputStream
.
close
();
return
filePath
;
}
}
backend/src/main/resources/db/migration/V35__1.11.sql
浏览文件 @
ad01a695
ALTER
TABLE
`panel_group`
ALTER
TABLE
`panel_group`
ADD
COLUMN
`status`
varchar
(
255
)
NULL
DEFAULT
'publish'
COMMENT
'1.publish--发布 2.unpublished--未发布'
AFTER
`mobile_layout`
;
ADD
COLUMN
`status`
varchar
(
255
)
NULL
DEFAULT
'publish'
COMMENT
'1.publish--发布 2.unpublished--未发布'
AFTER
`mobile_layout`
;
CREATE
TABLE
`de_driver`
(
`id`
varchar
(
50
)
NOT
NULL
COMMENT
'主键'
,
`name`
varchar
(
50
)
NOT
NULL
COMMENT
'用户ID'
,
`create_time`
bigint
(
13
)
NOT
NULL
COMMENT
'创健时间'
,
`type`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'数据源类型'
,
`driver_class`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'驱动类'
,
`desc`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'描述'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'驱动'
;
CREATE
TABLE
`de_driver_details`
(
`id`
varchar
(
50
)
NOT
NULL
COMMENT
'主键'
,
`de_driver_id`
varchar
(
50
)
NOT
NULL
COMMENT
'驱动主键'
,
`file_name`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'名称'
,
`version`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'版本'
,
`driver_class`
longtext
DEFAULT
NULL
COMMENT
'驱动类'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'驱动详情'
;
\ No newline at end of file
frontend/src/api/system/datasource.js
浏览文件 @
ad01a695
...
@@ -15,6 +15,13 @@ export function listDatasource() {
...
@@ -15,6 +15,13 @@ export function listDatasource() {
method
:
'get'
method
:
'get'
})
})
}
}
export
function
listDrivers
()
{
return
request
({
url
:
'/driver/list'
,
loading
:
true
,
method
:
'post'
})
}
export
function
listDatasourceType
()
{
export
function
listDatasourceType
()
{
return
request
({
return
request
({
url
:
'/datasource/types'
,
url
:
'/datasource/types'
,
...
@@ -29,6 +36,13 @@ export function listDatasourceByType(type) {
...
@@ -29,6 +36,13 @@ export function listDatasourceByType(type) {
method
:
'get'
method
:
'get'
})
})
}
}
export
function
listDriverByType
(
type
)
{
return
request
({
url
:
'/driver/list/'
+
type
,
loading
:
true
,
method
:
'get'
})
}
export
function
addDs
(
data
)
{
export
function
addDs
(
data
)
{
return
request
({
return
request
({
url
:
'datasource/add/'
,
url
:
'datasource/add/'
,
...
@@ -90,4 +104,45 @@ export function checkApiDatasource(data){
...
@@ -90,4 +104,45 @@ export function checkApiDatasource(data){
})
})
}
}
export
function
addDriver
(
data
)
{
return
request
({
url
:
'/driver/save'
,
method
:
'post'
,
loading
:
true
,
data
})
}
export
function
listDriverDetails
(
id
)
{
return
request
({
url
:
'/driver/listDriverDetails/'
+
id
,
method
:
'get'
,
loading
:
true
})
}
export
function
deleteDriverFile
(
id
)
{
return
request
({
url
:
'/driver/deleteDriverFile/'
+
id
,
method
:
'post'
,
loading
:
true
})
}
export
function
delDriver
(
id
)
{
return
request
({
url
:
'driver/delete/'
+
id
,
loading
:
true
,
method
:
'post'
})
}
export
function
updateDriver
(
data
)
{
return
request
({
url
:
'driver/update/'
,
loading
:
true
,
method
:
'post'
,
data
})
}
export
default
{
dsGrid
,
addDs
,
editDs
,
delDs
,
validateDs
,
listDatasource
,
getSchema
}
export
default
{
dsGrid
,
addDs
,
editDs
,
delDs
,
validateDs
,
listDatasource
,
getSchema
}
frontend/src/lang/en.js
浏览文件 @
ad01a695
...
@@ -1328,7 +1328,22 @@ export default {
...
@@ -1328,7 +1328,22 @@ export default {
sql_ds_union_error
:
'Direct connect SQL dataset can not be union'
,
sql_ds_union_error
:
'Direct connect SQL dataset can not be union'
,
api_data
:
'API dataset'
api_data
:
'API dataset'
},
},
driver
:{
driver
:
'Driver'
,
please_choose_driver
:
'Please choose driver'
,
mgm
:
'Driver'
,
add
:
'ADD Driver'
,
modify
:
'Modify'
,
show_info
:
'Driver info'
,
file_name
:
'File name'
,
version
:
'version'
},
datasource
:
{
datasource
:
{
auth_method
:
'Auth method'
,
passwd
:
'UserName Password'
,
kerbers_info
:
'Please make sure krb5 Conf, KeyTab key, added to path: /opt/dataease/conf'
,
client_principal
:
'Client Principal'
,
keytab_Key_path
:
'Keytab Key Path'
,
datasource
:
'Data Source'
,
datasource
:
'Data Source'
,
please_select_left
:
'Please select the data source from the left'
,
please_select_left
:
'Please select the data source from the left'
,
show_info
:
'Data Source Info'
,
show_info
:
'Data Source Info'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
ad01a695
...
@@ -1328,7 +1328,22 @@ export default {
...
@@ -1328,7 +1328,22 @@ export default {
sql_ds_union_error
:
'直連模式下SQL數據集,不支持關聯'
,
sql_ds_union_error
:
'直連模式下SQL數據集,不支持關聯'
,
api_data
:
'API 數據集'
api_data
:
'API 數據集'
},
},
driver
:{
driver
:
'驅動'
,
please_choose_driver
:
'青選擇驅動'
,
mgm
:
'驅動管理'
,
add
:
'添加驅動'
,
modify
:
'修改'
,
show_info
:
'驅動信息'
,
file_name
:
'文件名'
,
version
:
'版本'
},
datasource
:
{
datasource
:
{
auth_method
:
'認證方式'
,
passwd
:
'用户名密码'
,
kerbers_info
:
'请确保 krb5.Conf、Keytab Key,已经添加到路径:/opt/dataease/conf'
,
client_principal
:
'Client Principal'
,
keytab_Key_path
:
'Keytab Key Path'
,
datasource
:
'數據源'
,
datasource
:
'數據源'
,
please_select_left
:
'請從左側選擇數據源'
,
please_select_left
:
'請從左側選擇數據源'
,
show_info
:
'數據源信息'
,
show_info
:
'數據源信息'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
ad01a695
...
@@ -1330,7 +1330,22 @@ export default {
...
@@ -1330,7 +1330,22 @@ export default {
sql_ds_union_error
:
'直连模式下SQL数据集,不支持关联'
,
sql_ds_union_error
:
'直连模式下SQL数据集,不支持关联'
,
api_data
:
'API 数据集'
api_data
:
'API 数据集'
},
},
driver
:{
driver
:
'驱动'
,
please_choose_driver
:
'请选择驱动'
,
mgm
:
'驱动管理'
,
add
:
'添加驱动'
,
modify
:
'修改'
,
show_info
:
'驱动信息'
,
file_name
:
'文件名'
,
version
:
'版本'
},
datasource
:
{
datasource
:
{
auth_method
:
'认证方式'
,
passwd
:
'用户名密码'
,
kerbers_info
:
'请确保 krb5.Conf、Keytab Key,已经添加到路径:/opt/dataease/conf'
,
client_principal
:
'Client Principal'
,
keytab_Key_path
:
'Keytab Key Path'
,
datasource
:
'数据源'
,
datasource
:
'数据源'
,
please_select_left
:
'请从左侧选择数据源'
,
please_select_left
:
'请从左侧选择数据源'
,
show_info
:
'数据源信息'
,
show_info
:
'数据源信息'
,
...
...
frontend/src/views/system/datasource/DriverForm.vue
0 → 100644
浏览文件 @
ad01a695
<
template
>
<layout-content>
<template
v-slot:header
>
<el-icon
name=
"back"
class=
"back-button"
@
click
.
native=
"backToList"
/>
{{
params
&&
params
.
id
&&
params
.
showModel
&&
params
.
showModel
===
'show'
&&
!
canEdit
?
$t
(
'driver.show_info'
)
:
$t
(
'driver.modify'
)
}}
<el-button
v-if=
"canEdit"
size=
"mini"
style=
"float: right;"
type=
"primary"
@
click=
"save"
>
{{
$t
(
'commons.save'
)
}}
</el-button>
<el-button
v-else
size=
"mini"
style=
"float: right;"
type=
"primary"
@
click=
"changeEdit"
>
{{
$t
(
'commons.edit'
)
}}
</el-button>
</
template
>
<div>
<el-form
ref=
"driverForm"
:model=
"driverForm"
:rules=
"rule"
size=
"small"
:disabled=
"params && params.id && params.showModel && params.showModel === 'show' && !canEdit"
label-width=
"180px"
label-position=
"right"
>
<el-form-item
:label=
"$t('commons.name')"
prop=
"name"
>
<el-input
v-model=
"driverForm.name"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
:label=
"$t('commons.description')"
prop=
"desc"
>
<el-input
v-model=
"driverForm.desc"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
:label=
"$t('datasource.type')"
prop=
"type"
>
<el-select
v-model=
"driverForm.type"
:placeholder=
"$t('datasource.please_choose_type')"
class=
"select-width"
disabled
filterable
>
<el-option
v-for=
"item in dsTypes"
:key=
"item.type"
:label=
"item.name"
:value=
"item.type"
/>
</el-select>
</el-form-item>
<!-- <el-form-item :label="$t('driver.driver')" >-->
<!-- <el-select-->
<!-- v-model="driverForm.driverClass"-->
<!-- :placeholder="$t('driver.please_choose_driver')"-->
<!-- class="select-width"-->
<!-- filterable-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in driverClassList"-->
<!-- :key="item"-->
<!-- :label="item"-->
<!-- :value="item"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item
:label=
"$t('driver.driver')"
>
<el-input
v-model=
"driverForm.driverClass"
autocomplete=
"off"
/>
</el-form-item>
</el-form>
<el-upload
:action=
"baseUrl+'driver/file/upload'"
:multiple=
"true"
:show-file-list=
"false"
:file-list=
"fileList"
:data=
"params"
accept=
".jar"
:before-upload=
"beforeUpload"
:on-success=
"uploadSuccess"
:on-error=
"uploadFail"
name=
"file"
:headers=
"headers"
style=
"float: right;"
>
<el-button
size=
"mini"
type=
"primary"
style=
"float: right;"
:disabled=
"uploading"
>
<span
v-if=
"!uploading"
style=
"font-size: 12px;"
>
{{ $t('dataset.upload_file') }}
</span>
<span
v-if=
"uploading"
style=
"font-size: 12px;"
><i
class=
"el-icon-loading"
/>
{{ $t('dataset.uploading') }}
</span>
</el-button>
</el-upload>
<fu-table
:data=
"driverFiles"
>
<el-table-column
prop=
"fileName"
:label=
"$t('driver.file_name')"
/>
<el-table-column
prop=
"version"
:label=
"$t('driver.version')"
/>
<fu-table-operations
:buttons=
"buttons"
:label=
"$t('commons.operating')"
fix
/>
</fu-table>
</div>
</layout-content>
</template>
<
script
>
import
LayoutContent
from
'@/components/business/LayoutContent'
import
i18n
from
'@/lang/index'
import
ApiHttpRequestForm
from
'@/views/system/datasource/ApiHttpRequestForm'
import
DsConfiguration
from
"@/views/system/datasource/DsConfiguration"
;
import
PluginCom
from
'@/views/system/plugin/PluginCom'
import
{
deleteDriverFile
,
listDriverDetails
,
updateDriver
}
from
"@/api/system/datasource"
;
import
{
delUser
}
from
"@/api/system/user"
;
import
{
$alert
}
from
"@/utils/message"
;
import
store
from
"@/store"
;
import
{
getToken
}
from
"@/utils/auth"
;
const
token
=
getToken
()
export
default
{
name
:
'DriverForm'
,
components
:
{
DsConfiguration
,
LayoutContent
,
ApiHttpRequestForm
,
PluginCom
},
props
:
{
params
:
{
type
:
Object
,
default
:
null
},
tData
:
{
type
:
Array
,
default
:
null
},
dsTypes
:
{
type
:
Array
,
default
:
null
}
},
data
()
{
return
{
disabled
:
false
,
driverForm
:
{
id
:
''
,
name
:
''
,
desc
:
''
,
type
:
''
,
driverClass
:
''
},
datasourceType
:
{},
driverClassList
:
[],
rule
:
{
name
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.input_name'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
50
,
message
:
i18n
.
t
(
'datasource.input_limit_2_25'
,
[
2
,
25
]),
trigger
:
'blur'
}],
desc
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.input_name'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
200
,
message
:
i18n
.
t
(
'datasource.input_limit_2_25'
,
[
2
,
25
]),
trigger
:
'blur'
}],
type
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.please_choose_type'
),
trigger
:
'blur'
}]
},
canEdit
:
false
,
driverFiles
:
[],
btnDisabled
:
false
,
buttons
:
[
{
label
:
this
.
$t
(
'commons.delete'
),
icon
:
'el-icon-delete'
,
type
:
'danger'
,
click
:
this
.
deleteDriverFile
,
disabled
:
this
.
btnDisabled
}
],
uploading
:
false
,
baseUrl
:
process
.
env
.
VUE_APP_BASE_API
,
headers
:
{
Authorization
:
token
,
'Accept-Language'
:
i18n
.
locale
.
replace
(
'_'
,
'-'
)
},
fileList
:
[]
}
},
created
()
{
const
row
=
this
.
params
this
.
driverForm
=
JSON
.
parse
(
JSON
.
stringify
(
row
))
this
.
disabled
=
this
.
params
&&
this
.
params
.
id
&&
this
.
params
.
showModel
&&
this
.
params
.
showModel
===
'show'
&&
!
this
.
canEdit
this
.
listDriverDetails
()
},
mounted
()
{
},
methods
:
{
beforeUpload
(
file
)
{
this
.
uploading
=
true
},
uploadSuccess
(
response
,
file
,
fileList
)
{
this
.
uploading
=
false
this
.
listDriverDetails
()
},
uploadFail
(
response
,
file
,
fileList
)
{
let
myError
=
response
.
toString
()
myError
=
myError
.
replace
(
'Error: '
,
''
)
if
(
myError
.
indexOf
(
'AuthenticationException'
)
>=
0
){
const
message
=
i18n
.
t
(
'login.tokenError'
)
$alert
(
message
,
()
=>
{
store
.
dispatch
(
'user/logout'
).
then
(()
=>
{
location
.
reload
()
})
},
{
confirmButtonText
:
i18n
.
t
(
'login.re_login'
),
showClose
:
false
})
return
}
const
errorMessage
=
JSON
.
parse
(
myError
).
message
this
.
uploading
=
false
this
.
$message
({
type
:
'error'
,
message
:
errorMessage
,
showClose
:
true
})
},
deleteDriverFile
(
row
){
deleteDriverFile
(
row
.
id
).
then
(
res
=>
{
this
.
$success
(
this
.
$t
(
'commons.delete_success'
))
this
.
listDriverDetails
()
})
},
listDriverDetails
(){
listDriverDetails
(
this
.
driverForm
.
id
).
then
(
res
=>
{
this
.
driverFiles
=
res
.
data
this
.
driverClassList
=
[]
this
.
driverFiles
.
forEach
(
driverFile
=>
{
this
.
driverClassList
=
this
.
driverClassList
.
concat
(
driverFile
.
driverClass
.
split
(
','
))
})
})
},
changeEdit
()
{
this
.
canEdit
=
true
this
.
formType
=
'modify'
this
.
disabled
=
this
.
params
&&
this
.
params
.
id
&&
this
.
params
.
showModel
&&
this
.
params
.
showModel
===
'show'
&&
!
this
.
canEdit
},
save
(){
updateDriver
(
this
.
driverForm
).
then
(
res
=>
{
this
.
$success
(
i18n
.
t
(
'commons.success'
))
this
.
canEdit
=
false
})
},
reset
()
{
this
.
$refs
.
dsForm
.
resetFields
()
},
backToList
()
{
this
.
$emit
(
'switch-component'
,
{})
},
refreshType
(
form
)
{
this
.
$emit
(
'refresh-type'
,
DsForm
)
},
handleClick
(
tab
,
event
)
{}
}
}
</
script
>
<
style
scoped
>
.el-input
{
width
:
300px
;
}
.el-select
{
width
:
300px
;
}
.ms-http-input
{
width
:
500px
;
margin-top
:
5px
;
}
.tip
{
padding
:
3px
5px
;
font-size
:
16px
;
border-radius
:
0
;
border-left
:
4px
solid
#409EFF
;
margin
:
5px
5px
10px
5px
;
}
.el-select
>>>
input
{
padding-right
:
10px
;
}
.el-select
>>>
.el-input__suffix
{
right
:
0
;
}
.dialog-css
>>>
.el-dialog__header
{
padding
:
10px
20px
0px
;
}
.dialog-css
>>>
.el-dialog__body
{
padding
:
10px
20px
10px
;
}
.dialog-footer
>>>
.el-dialog__footer
{
padding
:
10px
10px
10px
;
}
</
style
>
frontend/src/views/system/datasource/DsConfiguration.vue
浏览文件 @
ad01a695
...
@@ -3,13 +3,13 @@
...
@@ -3,13 +3,13 @@
<el-row>
<el-row>
<el-col>
<el-col>
<el-form
<el-form
ref=
"DsConfig"
ref=
"DsConfig"
:model=
"form"
:model=
"form"
:rules=
"rule"
:rules=
"rule"
size=
"small"
size=
"small"
:disabled=
"disabled"
:disabled=
"disabled"
label-width=
"180px"
label-width=
"180px"
label-position=
"right"
label-position=
"right"
>
>
<el-form-item
v-if=
"form.type == 'api'"
:label=
"$t('datasource.data_table')"
>
<el-form-item
v-if=
"form.type == 'api'"
:label=
"$t('datasource.data_table')"
>
<el-col>
<el-col>
...
@@ -77,7 +77,8 @@
...
@@ -77,7 +77,8 @@
</div>
</div>
<el-form-item
:label=
"$t('datasource.data_path')"
prop=
"dataPath"
>
<el-form-item
:label=
"$t('datasource.data_path')"
prop=
"dataPath"
>
<el-input
:placeholder=
"$t('datasource.data_path_desc')"
v-model=
"apiItem.dataPath"
autocomplete=
"off"
/>
<el-input
:placeholder=
"$t('datasource.data_path_desc')"
v-model=
"apiItem.dataPath"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</el-row>
</el-row>
...
@@ -103,7 +104,10 @@
...
@@ -103,7 +104,10 @@
</el-tabs>
</el-tabs>
</el-row>
</el-row>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"next"
:disabled=
"disabledNext"
v-show=
"active === 1"
>
{{ $t('fu.steps.next') }}
</el-button>
<el-button
@
click=
"next"
:disabled=
"disabledNext"
v-show=
"active === 1"
>
{{
$t('fu.steps.next')
}}
</el-button>
<el-button
@
click=
"before"
v-show=
"active === 2"
>
{{ $t('fu.steps.prev') }}
</el-button>
<el-button
@
click=
"before"
v-show=
"active === 2"
>
{{ $t('fu.steps.prev') }}
</el-button>
<el-button
@
click=
"saveItem"
v-show=
"active === 2"
>
{{ $t('commons.save') }}
</el-button>
<el-button
@
click=
"saveItem"
v-show=
"active === 2"
>
{{ $t('commons.save') }}
</el-button>
</div>
</div>
...
@@ -125,20 +129,55 @@
...
@@ -125,20 +129,55 @@
<el-input
v-model=
"form.configuration.dataBase"
autocomplete=
"off"
/>
<el-input
v-model=
"form.configuration.dataBase"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"form.type=='oracle' && form.type !== 'api'"
:label=
"$t('datasource.oracle_connection_type')"
<el-form-item
v-if=
"form.type=='oracle' && form.type !== 'api'"
:label=
"$t('datasource.oracle_connection_type')"
prop=
"configuration.connectionType"
>
prop=
"configuration.connectionType"
>
<el-radio
v-model=
"form.configuration.connectionType"
label=
"sid"
>
{{ $t('datasource.oracle_sid') }}
</el-radio>
<el-radio
v-model=
"form.configuration.connectionType"
label=
"sid"
>
{{
$t('datasource.oracle_sid')
}}
</el-radio>
<el-radio
v-model=
"form.configuration.connectionType"
label=
"serviceName"
>
<el-radio
v-model=
"form.configuration.connectionType"
label=
"serviceName"
>
{{ $t('datasource.oracle_service_name') }}
{{ $t('datasource.oracle_service_name') }}
</el-radio>
</el-radio>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"form.type !== 'es' && form.type !== 'api'"
<el-form-item
v-if=
"form.type=='hive' "
:label=
"$t('datasource.auth_method')"
>
<el-select
v-model=
"form.configuration.authMethod"
class=
"select-width"
>
<el-option
v-for=
"item in authMethodList"
:key=
"item.id"
:label=
"item.label"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"form.type === 'hive' && form.configuration.authMethod === 'kerberos'"
:label=
"$t('datasource.client_principal')"
>
<el-input
v-model=
"form.configuration.username"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
v-if=
"form.type === 'hive' && form.configuration.authMethod === 'kerberos'"
:label=
"$t('datasource.keytab_Key_path')"
>
<el-input
v-model=
"form.configuration.password"
autocomplete=
"off"
show-password
/>
<p>
{{$t('datasource.kerbers_info')}}
</p>
</el-form-item>
<span
v-if=
"form.type === 'hive' && form.configuration.authMethod === 'kerberos'"
>
</span>
<el-form-item
v-if=
"form.type !== 'es' && form.type !== 'api' && form.configuration.authMethod !== 'kerberos'"
:label=
"$t('datasource.user_name')"
>
:label=
"$t('datasource.user_name')"
>
<el-input
v-model=
"form.configuration.username"
autocomplete=
"off"
/>
<el-input
v-model=
"form.configuration.username"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"form.type !== 'es' && form.type !== 'api'"
<el-form-item
v-if=
"form.type !== 'es' && form.type !== 'api'
&& form.configuration.authMethod !== 'kerberos'
"
:label=
"$t('datasource.password')"
>
:label=
"$t('datasource.password')"
>
<el-input
v-model=
"form.configuration.password"
autocomplete=
"off"
show-password
/>
<el-input
v-model=
"form.configuration.password"
autocomplete=
"off"
show-password
/>
</el-form-item>
</el-form-item>
...
@@ -164,21 +203,26 @@
...
@@ -164,21 +203,26 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
>
v-if=
"form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
>
<el-button
icon=
"el-icon-plus"
size=
"mini"
@
click=
"getSchema()"
>
{{ $t('datasource.get_schema') }}
</el-button>
<el-button
icon=
"el-icon-plus"
size=
"mini"
@
click=
"getSchema()"
>
{{
$t('datasource.get_schema')
}}
</el-button>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
v-if=
"form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
:label=
"$t('datasource.schema')"
>
:label=
"$t('datasource.schema')"
>
<el-select
v-model=
"form.configuration.schema"
filterable
:placeholder=
"$t('datasource.please_choose_schema')"
<el-select
v-model=
"form.configuration.schema"
filterable
:placeholder=
"$t('datasource.please_choose_schema')"
class=
"select-width"
>
class=
"select-width"
>
<el-option
v-for=
"item in schemas"
:key=
"item"
:label=
"item"
:value=
"item"
/>
<el-option
v-for=
"item in schemas"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"form.type=='oracle'"
:label=
"$t('datasource.charset')"
>
<el-form-item
v-if=
"form.type=='oracle'"
:label=
"$t('datasource.charset')"
>
<el-select
v-model=
"form.configuration.charset"
filterable
:placeholder=
"$t('datasource.please_choose_charset')"
<el-select
v-model=
"form.configuration.charset"
filterable
:placeholder=
"$t('datasource.please_choose_charset')"
class=
"select-width"
>
class=
"select-width"
>
<el-option
v-for=
"item in datasourceType.charset"
:key=
"item"
:label=
"item"
:value=
"item"
/>
<el-option
v-for=
"item in datasourceType.charset"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-select>
...
@@ -208,7 +252,6 @@
...
@@ -208,7 +252,6 @@
<
script
>
<
script
>
import
i18n
from
"@/lang"
;
import
i18n
from
"@/lang"
;
import
{
checkApiDatasource
,
getSchema
}
from
"@/api/system/datasource"
;
import
{
checkApiDatasource
,
getSchema
}
from
"@/api/system/datasource"
;
import
ApiHttpRequestForm
from
'@/views/system/datasource/ApiHttpRequestForm'
import
ApiHttpRequestForm
from
'@/views/system/datasource/ApiHttpRequestForm'
...
@@ -367,15 +410,20 @@ export default {
...
@@ -367,15 +410,20 @@ export default {
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
],
],
height
:
500
,
height
:
500
,
disabledNext
:
false
disabledNext
:
false
,
authMethodList
:
[
{
id
:
'passwd'
,
label
:
i18n
.
t
(
'datasource.passwd'
)
},
{
id
:
'kerberos'
,
label
:
'Kerberos'
}]
}
}
},
},
created
()
{
created
()
{
},
watch
:
{
},
},
watch
:
{},
methods
:
{
methods
:
{
getSchema
()
{
getSchema
()
{
this
.
$refs
.
DsConfig
.
validate
(
valid
=>
{
this
.
$refs
.
DsConfig
.
validate
(
valid
=>
{
...
...
frontend/src/views/system/datasource/
f
orm.vue
→
frontend/src/views/system/datasource/
DsF
orm.vue
浏览文件 @
ad01a695
...
@@ -41,6 +41,23 @@
...
@@ -41,6 +41,23 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"datasourceType.isJdbc"
:label=
"$t('driver.driver')"
>
<el-select
v-model=
"form.configuration.customDriver"
:placeholder=
"$t('driver.please_choose_driver')"
class=
"select-width"
filterable
>
<el-option
v-for=
"item in driverList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
:disabled=
"!item.driverClass"
/>
</el-select>
</el-form-item>
<ds-configuration
ref=
"dsConfig"
v-if=
"!datasourceType.isPlugin"
:datasource-type=
'datasourceType'
:form=
"form"
:disabled=
"params && params.id && params.showModel && params.showModel === 'show' && !canEdit"
></ds-configuration>
<ds-configuration
ref=
"dsConfig"
v-if=
"!datasourceType.isPlugin"
:datasource-type=
'datasourceType'
:form=
"form"
:disabled=
"params && params.id && params.showModel && params.showModel === 'show' && !canEdit"
></ds-configuration>
<plugin-com
ref=
"pluginDsConfig"
v-if=
"datasourceType.isPlugin"
:component-name=
"datasourceType.type"
:obj=
"{form, disabled }"
/>
<plugin-com
ref=
"pluginDsConfig"
v-if=
"datasourceType.isPlugin"
:component-name=
"datasourceType.type"
:obj=
"{form, disabled }"
/>
...
@@ -70,7 +87,15 @@
...
@@ -70,7 +87,15 @@
<
script
>
<
script
>
import
LayoutContent
from
'@/components/business/LayoutContent'
import
LayoutContent
from
'@/components/business/LayoutContent'
import
{
addDs
,
editDs
,
getSchema
,
validateDs
,
validateDsById
,
checkApiDatasource
}
from
'@/api/system/datasource'
import
{
addDs
,
editDs
,
getSchema
,
validateDs
,
validateDsById
,
checkApiDatasource
,
listDriverByType
}
from
'@/api/system/datasource'
import
{
$confirm
}
from
'@/utils/message'
import
{
$confirm
}
from
'@/utils/message'
import
i18n
from
'@/lang/index'
import
i18n
from
'@/lang/index'
import
ApiHttpRequestForm
from
'@/views/system/datasource/ApiHttpRequestForm'
import
ApiHttpRequestForm
from
'@/views/system/datasource/ApiHttpRequestForm'
...
@@ -227,7 +252,8 @@ export default {
...
@@ -227,7 +252,8 @@ export default {
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
],
],
height
:
500
,
height
:
500
,
disabledNext
:
false
disabledNext
:
false
,
driverList
:
[]
}
}
},
},
...
@@ -235,7 +261,7 @@ export default {
...
@@ -235,7 +261,7 @@ export default {
if
(
this
.
params
&&
this
.
params
.
id
)
{
if
(
this
.
params
&&
this
.
params
.
id
)
{
const
row
=
this
.
params
const
row
=
this
.
params
this
.
edit
(
row
)
this
.
edit
(
row
)
this
.
changeType
()
this
.
changeType
(
true
)
}
else
{
}
else
{
this
.
create
()
this
.
create
()
if
(
this
.
params
&&
this
.
params
.
type
)
{
if
(
this
.
params
&&
this
.
params
.
type
)
{
...
@@ -492,13 +518,19 @@ export default {
...
@@ -492,13 +518,19 @@ export default {
}
}
})
})
},
},
changeType
()
{
changeType
(
init
)
{
for
(
let
i
=
0
;
i
<
this
.
dsTypes
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
dsTypes
.
length
;
i
++
)
{
if
(
this
.
dsTypes
[
i
].
type
===
this
.
form
.
type
)
{
if
(
this
.
dsTypes
[
i
].
type
===
this
.
form
.
type
)
{
if
(
this
.
form
.
type
!==
'api'
){
if
(
this
.
form
.
type
!==
'api'
&&
!
init
){
this
.
form
.
configuration
.
extraParams
=
this
.
dsTypes
[
i
].
extraParams
this
.
form
.
configuration
.
extraParams
=
this
.
dsTypes
[
i
].
extraParams
}
}
this
.
datasourceType
=
this
.
dsTypes
[
i
]
this
.
datasourceType
=
this
.
dsTypes
[
i
]
if
(
this
.
datasourceType
.
isJdbc
){
listDriverByType
(
this
.
datasourceType
.
type
).
then
(
res
=>
{
this
.
driverList
=
res
.
data
this
.
driverList
.
push
({
id
:
'default'
,
name
:
'Default'
,
driverClass
:
'Default'
})
})
}
}
}
}
}
},
},
...
...
frontend/src/views/system/datasource/DsMain.vue
浏览文件 @
ad01a695
...
@@ -22,7 +22,8 @@ import DeMainContainer from '@/components/dataease/DeMainContainer'
...
@@ -22,7 +22,8 @@ import DeMainContainer from '@/components/dataease/DeMainContainer'
import
DeContainer
from
'@/components/dataease/DeContainer'
import
DeContainer
from
'@/components/dataease/DeContainer'
import
DeAsideContainer
from
'@/components/dataease/DeAsideContainer'
import
DeAsideContainer
from
'@/components/dataease/DeAsideContainer'
import
DsTree
from
'./DsTree'
import
DsTree
from
'./DsTree'
import
DsForm
from
'./form'
import
DsForm
from
'./DsForm'
import
DriverForm
from
"./DriverForm"
;
import
DataHome
from
'./DataHome'
import
DataHome
from
'./DataHome'
export
default
{
export
default
{
...
@@ -56,6 +57,12 @@ export default {
...
@@ -56,6 +57,12 @@ export default {
this
.
tData
=
tData
this
.
tData
=
tData
this
.
dsTypes
=
dsTypes
this
.
dsTypes
=
dsTypes
break
break
case
'DriverForm'
:
this
.
component
=
DriverForm
this
.
param
=
componentParam
this
.
tData
=
tData
this
.
dsTypes
=
dsTypes
break
default
:
default
:
this
.
component
=
DataHome
this
.
component
=
DataHome
this
.
param
=
null
this
.
param
=
null
...
...
frontend/src/views/system/datasource/DsTree.vue
浏览文件 @
ad01a695
<
template
xmlns:el-col=
"http://www.w3.org/1999/html"
>
<
template
xmlns:el-col=
"http://www.w3.org/1999/html"
>
<el-col
class=
"tree-style"
>
<el-col
class=
"tree-style"
>
<el-col>
<el-col>
<el-row
class=
"title-css"
>
<el-row
>
<span
class=
"title-text"
>
<el-tabs
v-model=
"showView"
@
tab-click=
"changeTab"
type=
"card"
>
{{
$t
(
'commons.datasource'
)
}}
<el-tab-pane
v-for=
"(item, index) in editableTabs"
:key=
"item.name"
:label=
"item.title"
:name=
"item.name"
>
</span>
</el-tab-pane>
<el-button
icon=
"el-icon-plus"
type=
"text"
size=
"mini"
style=
"float: right;"
</el-tabs>
@
click=
"addFolder"
/>
</el-row>
<el-row>
<el-button
icon=
"el-icon-plus"
type=
"text"
size=
"mini"
style=
"float: left;"
@
click=
"addFolder"
/>
</el-row>
</el-row>
<el-divider/>
<el-row>
<el-row>
<el-form>
<el-form>
<el-form-item
class=
"form-item"
>
<el-form-item
class=
"form-item"
>
...
@@ -99,11 +99,55 @@
...
@@ -99,11 +99,55 @@
</el-tree>
</el-tree>
</div>
</div>
</el-col>
</el-col>
<el-dialog
v-dialogDrag
:title=
"dialogTitle"
:visible=
"editDriver"
:show-close=
"false"
width=
"50%"
append-to-body
>
<el-form
ref=
"driverForm"
:model=
"driverForm"
label-position=
"right"
label-width=
"100px"
:rules=
"rule"
>
<el-form-item
:label=
"$t('commons.name')"
prop=
"name"
>
<el-input
v-model=
"driverForm.name"
/>
</el-form-item>
<el-form-item
:label=
"$t('commons.description')"
prop=
"desc"
>
<el-input
v-model=
"driverForm.desc"
/>
</el-form-item>
<el-form-item
:label=
"$t('datasource.type')"
prop=
"type"
>
<el-select
v-model=
"driverForm.type"
:placeholder=
"$t('datasource.please_choose_type')"
class=
"select-width"
:disabled=
"disabledModifyType"
filterable
>
<el-option
v-for=
"item in dsTypes"
:key=
"item.type"
:label=
"item.name"
:value=
"item.type"
/>
</el-select>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
size=
"mini"
@
click=
"close()"
>
{{
$t
(
'commons.cancel'
)
}}
</el-button>
<el-button
type=
"primary"
size=
"mini"
@
click=
"saveDriver(driverForm)"
>
{{
$t
(
'commons.save'
)
}}
</el-button>
</div>
</el-dialog>
</el-col>
</el-col>
</el-col>
</el-col>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
listDatasource
,
listDatasourceByType
,
delDs
,
listDatasourceType
}
from
'@/api/system/datasource'
import
{
listDatasource
,
listDatasourceByType
,
listDriverByType
,
delDs
,
listDatasourceType
,
listDrivers
,
addDriver
,
delDriver
}
from
'@/api/system/datasource'
import
{
mapGetters
}
from
'vuex'
import
i18n
from
"@/lang"
;
export
default
{
export
default
{
name
:
'DsTree'
,
name
:
'DsTree'
,
...
@@ -119,7 +163,27 @@ export default {
...
@@ -119,7 +163,27 @@ export default {
tData
:
[],
tData
:
[],
dsTypes
:
[],
dsTypes
:
[],
showSearchInput
:
false
,
showSearchInput
:
false
,
key
:
''
key
:
''
,
showView
:
'Datasource'
,
dialogTitle
:
''
,
editDriver
:
false
,
driverForm
:
{
name
:
''
,
desc
:
''
,
type
:
''
},
disabledModifyType
:
false
,
rule
:
{
name
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.input_name'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
50
,
message
:
i18n
.
t
(
'datasource.input_limit_2_25'
,
[
2
,
25
]),
trigger
:
'blur'
}],
desc
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.input_name'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
200
,
message
:
i18n
.
t
(
'datasource.input_limit_2_25'
,
[
2
,
25
]),
trigger
:
'blur'
}],
type
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.please_choose_type'
),
trigger
:
'blur'
}]
},
editableTabs
:
[{
title
:
i18n
.
t
(
'commons.datasource'
),
name
:
'Datasource'
}]
}
}
},
},
watch
:
{
watch
:
{
...
@@ -127,14 +191,22 @@ export default {
...
@@ -127,14 +191,22 @@ export default {
this
.
$refs
.
myDsTree
.
filter
(
val
)
this
.
$refs
.
myDsTree
.
filter
(
val
)
}
}
},
},
computed
:
{
...
mapGetters
([
'user'
])
},
created
()
{
created
()
{
this
.
queryTreeDatas
()
this
.
queryTreeDatas
()
this
.
datasourceTypes
()
this
.
datasourceTypes
()
if
(
this
.
user
.
isAdmin
){
this
.
editableTabs
.
push
({
title
:
i18n
.
t
(
'driver.mgm'
),
name
:
'Driver'
})
}
},
},
// mounted() {
// this.queryTreeDatas()
// this.datasourceTypes()
// },
methods
:
{
methods
:
{
filterNode
(
value
,
data
)
{
filterNode
(
value
,
data
)
{
if
(
!
value
)
return
true
if
(
!
value
)
return
true
...
@@ -148,9 +220,16 @@ export default {
...
@@ -148,9 +220,16 @@ export default {
this
.
showSearchInput
=
false
this
.
showSearchInput
=
false
},
},
queryTreeDatas
()
{
queryTreeDatas
()
{
listDatasource
().
then
(
res
=>
{
if
(
this
.
showView
===
'Datasource'
){
this
.
tData
=
this
.
buildTree
(
res
.
data
)
listDatasource
().
then
(
res
=>
{
})
this
.
tData
=
this
.
buildTree
(
res
.
data
)
})
}
if
(
this
.
showView
===
'Driver'
){
listDrivers
().
then
(
res
=>
{
this
.
tData
=
this
.
buildTree
(
res
.
data
)
})
}
},
},
datasourceTypes
()
{
datasourceTypes
()
{
listDatasourceType
().
then
(
res
=>
{
listDatasourceType
().
then
(
res
=>
{
...
@@ -158,8 +237,9 @@ export default {
...
@@ -158,8 +237,9 @@ export default {
})
})
},
},
refreshType
(
datasource
)
{
refreshType
(
datasource
)
{
const
method
=
this
.
showView
===
'Datasource'
?
listDatasourceByType
:
listDriverByType
let
typeData
=
[]
let
typeData
=
[]
listDatasourceByType
(
datasource
.
type
).
then
(
res
=>
{
method
(
datasource
.
type
).
then
(
res
=>
{
typeData
=
this
.
buildTree
(
res
.
data
)
typeData
=
this
.
buildTree
(
res
.
data
)
if
(
typeData
.
length
===
0
)
{
if
(
typeData
.
length
===
0
)
{
let
index
=
this
.
tData
.
findIndex
(
item
=>
{
let
index
=
this
.
tData
.
findIndex
(
item
=>
{
...
@@ -209,10 +289,30 @@ export default {
...
@@ -209,10 +289,30 @@ export default {
},
},
addFolder
()
{
addFolder
()
{
this
.
switchMain
(
'DsForm'
,
{},
this
.
tData
,
this
.
dsTypes
)
if
(
this
.
showView
===
'Driver'
){
this
.
dialogTitle
=
this
.
$t
(
'driver.driver'
)
this
.
editDriver
=
true
// this.switchMain('DriverForm', {}, this.tData, this.dsTypes)
}
else
{
this
.
switchMain
(
'DsForm'
,
{},
this
.
tData
,
this
.
dsTypes
)
}
},
},
changeTab
()
{
this
.
expandedArray
=
[]
this
.
tData
=
[]
this
.
queryTreeDatas
()
},
addFolderWithType
(
data
)
{
addFolderWithType
(
data
)
{
this
.
switchMain
(
'DsForm'
,
{
type
:
data
.
id
},
this
.
tData
,
this
.
dsTypes
)
if
(
this
.
showView
===
'Driver'
){
this
.
driverForm
.
type
=
data
.
id
this
.
dialogTitle
=
this
.
$t
(
'driver.driver'
)
this
.
editDriver
=
false
this
.
switchMain
(
'DriverForm'
,
{},
this
.
tData
,
this
.
dsTypes
)
}
else
{
this
.
switchMain
(
'DsForm'
,
{
type
:
data
.
id
},
this
.
tData
,
this
.
dsTypes
)
}
},
},
nodeClick
(
node
,
data
)
{
nodeClick
(
node
,
data
)
{
if
(
node
.
type
===
'folder'
)
return
if
(
node
.
type
===
'folder'
)
return
...
@@ -240,7 +340,12 @@ export default {
...
@@ -240,7 +340,12 @@ export default {
},
},
showInfo
(
row
)
{
showInfo
(
row
)
{
const
param
=
{...
row
.
data
,
...{
showModel
:
'show'
}}
const
param
=
{...
row
.
data
,
...{
showModel
:
'show'
}}
this
.
switchMain
(
'DsForm'
,
param
,
this
.
tData
,
this
.
dsTypes
)
if
(
this
.
showView
===
'Datasource'
){
this
.
switchMain
(
'DsForm'
,
param
,
this
.
tData
,
this
.
dsTypes
)
}
else
{
this
.
switchMain
(
'DriverForm'
,
param
,
this
.
tData
,
this
.
dsTypes
)
}
},
},
_handleDelete
(
datasource
)
{
_handleDelete
(
datasource
)
{
this
.
$confirm
(
this
.
$t
(
'datasource.delete_warning'
),
''
,
{
this
.
$confirm
(
this
.
$t
(
'datasource.delete_warning'
),
''
,
{
...
@@ -248,7 +353,8 @@ export default {
...
@@ -248,7 +353,8 @@ export default {
cancelButtonText
:
this
.
$t
(
'commons.cancel'
),
cancelButtonText
:
this
.
$t
(
'commons.cancel'
),
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
delDs
(
datasource
.
id
).
then
(
res
=>
{
const
method
=
this
.
showView
===
'Datasource'
?
delDs
:
delDriver
method
(
datasource
.
id
).
then
(
res
=>
{
if
(
res
.
success
){
if
(
res
.
success
){
this
.
$success
(
this
.
$t
(
'commons.delete_success'
))
this
.
$success
(
this
.
$t
(
'commons.delete_success'
))
this
.
switchMain
(
'DataHome'
,
{},
this
.
tData
,
this
.
dsTypes
)
this
.
switchMain
(
'DataHome'
,
{},
this
.
tData
,
this
.
dsTypes
)
...
@@ -289,7 +395,33 @@ export default {
...
@@ -289,7 +395,33 @@ export default {
})
})
})
})
})
})
}
},
close
()
{
this
.
$refs
[
'driverForm'
].
resetFields
()
this
.
editDriver
=
false
this
.
driverForm
=
{
name
:
''
,
desc
:
''
,
type
:
''
}
},
saveDriver
(
driverForm
)
{
this
.
$refs
[
'driverForm'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
addDriver
(
driverForm
).
then
(
res
=>
{
this
.
$message
({
message
:
this
.
$t
(
'dataset.save_success'
),
type
:
'success'
,
showClose
:
true
})
this
.
refreshType
(
driverForm
)
this
.
close
()
})
}
else
{
return
false
}
})
},
}
}
}
}
</
script
>
</
script
>
...
...
frontend/src/views/system/plugin/index.vue
浏览文件 @
ad01a695
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
@
search=
"search"
@
search=
"search"
>
>
<template
#
toolbar
>
<template
#
toolbar
>
<el-upload
<el-upload
:action=
"baseUrl+'api/plugin/upload'"
:action=
"baseUrl+'api/plugin/upload'"
:multiple=
"false"
:multiple=
"false"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论