Merge branch 'dev' into pr@dev_memory_component

This commit is contained in:
dataeaseShu 2022-12-19 17:47:10 +08:00
commit 5e9a02bd65
14 changed files with 87 additions and 23 deletions

View File

@ -52,6 +52,20 @@ public class DatasourceController {
return datasourceService.addDatasource(datasource);
}
@RequiresPermissions("datasource:read")
@DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE)
@ApiOperation("更新数据源")
@PostMapping("/update")
@DeLog(
operatetype = SysLogConstants.OPERATE_TYPE.MODIFY,
sourcetype = SysLogConstants.SOURCE_TYPE.DATASOURCE,
positionIndex = 0, positionKey = "type",
value = "id"
)
public void updateDatasource(@RequestBody UpdataDsRequest dsRequest) throws Exception {
datasourceService.updateDatasource(dsRequest);
}
@RequiresPermissions("datasource:read")
@ApiOperation("数据源类型")
@GetMapping("/types")
@ -106,20 +120,6 @@ public class DatasourceController {
return resultHolder;
}
@RequiresPermissions("datasource:read")
@DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE)
@ApiOperation("更新数据源")
@PostMapping("/update")
@DeLog(
operatetype = SysLogConstants.OPERATE_TYPE.MODIFY,
sourcetype = SysLogConstants.SOURCE_TYPE.DATASOURCE,
positionIndex = 0, positionKey = "type",
value = "id"
)
public void updateDatasource(@RequestBody UpdataDsRequest dsRequest) throws Exception {
datasourceService.updateDatasource(dsRequest);
}
@DePermission(type = DePermissionType.DATASOURCE)
@ApiOperation("查询数据源下属所有表")
@PostMapping("/getTables/{id}")

View File

@ -263,12 +263,9 @@ public class DatasourceService {
if (!types().stream().map(DataSourceType::getType).collect(Collectors.toList()).contains(updataDsRequest.getType())) {
throw new Exception("Datasource type not supported.");
}
System.out.println(updataDsRequest.getConfiguration());
System.out.println(updataDsRequest.isConfigurationEncryption());
if(updataDsRequest.isConfigurationEncryption()){
updataDsRequest.setConfiguration(new String(java.util.Base64.getDecoder().decode(updataDsRequest.getConfiguration())));
}
System.out.println(updataDsRequest.getConfiguration());
checkName(updataDsRequest.getName(), updataDsRequest.getType(), updataDsRequest.getId());
Datasource datasource = new Datasource();
datasource.setName(updataDsRequest.getName());
@ -277,15 +274,22 @@ public class DatasourceService {
datasource.setCreateTime(null);
datasource.setType(updataDsRequest.getType());
datasource.setUpdateTime(System.currentTimeMillis());
Provider datasourceProvider = ProviderFactory.getProvider(updataDsRequest.getType());
datasourceProvider.checkConfiguration(datasource);
checkAndUpdateDatasourceStatus(datasource);
DatasourceExample example = new DatasourceExample();
example.createCriteria().andIdEqualTo(updataDsRequest.getId());
datasourceMapper.updateByExampleSelective(datasource, example);
handleConnectionPool(updataDsRequest.getId());
if(StringUtils.isNotEmpty(updataDsRequest.getId())){
DatasourceExample example = new DatasourceExample();
example.createCriteria().andIdEqualTo(updataDsRequest.getId());
datasourceMapper.updateByExampleSelective(datasource, example);
handleConnectionPool(updataDsRequest.getId());
}else {
datasource.setId(UUID.randomUUID().toString());
datasource.setCreateTime(System.currentTimeMillis());
datasourceMapper.insert(datasource);
handleConnectionPool(datasource, "add");
sysAuthService.copyAuth(datasource.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASOURCE);
}
}
private void handleConnectionPool(String datasourceId) {

View File

@ -8,3 +8,8 @@ WHERE `id` = 'system_1';
ALTER TABLE `sys_task`
ADD COLUMN `status` tinyint(1) NULL DEFAULT 1 COMMENT '运行状态' AFTER `create_time`;
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`) VALUES (1100, 1, 0, 1, '血缘关系', 'sys-relationship', 'system/relationship/index', 1002, 'sys-relationship', 'relationship', 0, 0, 0, 'relationship:read');
UPDATE `sys_menu` SET `menu_sort` = 1003 WHERE (`menu_id` = 101);

View File

@ -259,4 +259,5 @@ I18N_LOG_FORMAT_PREFIX=With authority of %s\u3010%s\u3011
\u7F16\u8F91\u8BB0\u5F55=Edit record
\u5220\u9664\u8BB0\u5F55=Delete record
\u6C34\u5370\u7BA1\u7406=Watermark
\u8840\u7F18\u5173\u7CFB=Relationship

View File

@ -259,5 +259,6 @@ I18N_LOG_FORMAT_PREFIX=\u4EE5%s\u3010%s\u3011\u6743\u9650
\u7F16\u8F91\u8BB0\u5F55=\u7F16\u8F91\u8BB0\u5F55
\u5220\u9664\u8BB0\u5F55=\u5220\u9664\u8BB0\u5F55
\u6C34\u5370\u7BA1\u7406=\u6C34\u5370\u7BA1\u7406
\u8840\u7F18\u5173\u7CFB=\u8840\u7F18\u5173\u7CFB

View File

@ -255,3 +255,4 @@ I18N_LOG_FORMAT_PREFIX=\u4EE5%s\u3010%s\u3011\u6B0A\u9650
\u7F16\u8F91\u8BB0\u5F55=\u7DE8\u8F2F\u8A18\u9304
\u5220\u9664\u8BB0\u5F55=\u522A\u9664\u8A18\u9304
\u6C34\u5370\u7BA1\u7406=\u6C34\u5370\u7BA1\u7406
\u8840\u7F18\u5173\u7CFB=\u8840\u7DE3\u95DC\u7CFB

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M896.000414 271.999142c70.699777 0 127.999596-57.299819 127.999596-127.999596 0-70.599777-57.399819-127.999596-127.999596-127.999596-70.699777 0-127.999596 57.299819-127.999596 127.999596 0 19.799938 4.499986 38.499879 12.49996 55.199826 2.899991 6.099981 1.599995 13.399958-3.19999 18.199942l-72.399771 72.399772c-4.799985 4.799985-12.099962 5.999981-18.199943 3.09999-28.799909-13.399958-60.899808-20.999934-94.699701-20.999934-108.399658 0-198.799373 76.999757-219.499308 179.299435-1.499995 7.399977-8.099974 12.69996-15.69995 12.69996h-94.099703c-6.599979 0-12.59996-3.999987-14.899953-10.199968-18.099943-47.999849-64.299797-82.199741-118.499627-82.799739C58.703055 370.298832 0.503239 427.598651 0.00324 498.098429c-0.499998 71.099776 56.99982 128.899593 127.999597 128.899593 56.699821 0 104.799669-36.899884 121.599616-87.899722 2.199993-6.599979 8.299974-11.099965 15.199952-11.099965h91.99971c7.599976 0 14.199955 5.299983 15.69995 12.699959C393.202 642.997972 483.601715 719.997729 592.001373 719.997729c19.09994 0 37.699881-2.399992 55.399825-6.899978 6.899978-1.799994 14.199955 1.299996 17.699944 7.499976l45.999855 79.599749c-26.399917 23.399926-43.099864 57.699818-43.099864 95.799698 0 70.899776 57.999817 128.499595 128.899594 127.999596 69.69978-0.499998 126.199602-56.699821 127.099599-126.299602 0.899997-70.099779-56.99982-129.299592-127.099599-129.69959-6.19998 0-12.299961 0.399999-18.299943 1.199996-6.499979 0.899997-12.79996-2.199993-16.099949-7.799976l-38.499878-66.699789c-3.999987-6.999978-2.199993-15.79995 4.199986-20.699935 53.399832-40.899871 87.799723-105.399668 87.799723-177.899439 0-57.19982-21.399932-109.299655-56.699821-148.89953-5.599982-6.29998-5.299983-15.89995 0.699998-21.899931l62.499803-62.499803c4.799985-4.799985 12.099962-6.099981 18.199943-3.19999 16.799947 7.899975 35.499888 12.399961 55.299825 12.399961z m0-191.999394c35.299889 0 63.999798 28.699909 63.999798 63.999798s-28.699909 63.999798-63.999798 63.999798-63.999798-28.699909-63.999798-63.999798 28.699909-63.999798 63.999798-63.999798z m-767.997577 482.998476c-35.299889 0-63.999798-28.699909-63.999799-63.999798s28.699909-63.999798 63.999799-63.999798 63.999798 28.699909 63.999798 63.999798-28.699909 63.999798-63.999798 63.999798z m667.997893 268.999152c35.299889 0 63.999798 28.699909 63.999798 63.999798s-28.699909 63.999798-63.999798 63.999798-63.999798-28.699909-63.999799-63.999798 28.699909-63.999798 63.999799-63.999798z m-43.999862-335.998941c0 42.699865-16.599948 82.899739-46.899852 113.099644-30.199905 30.199905-70.399778 46.899852-113.099643 46.899852s-82.899739-16.599948-113.099643-46.899852c-30.199905-30.199905-46.899852-70.399778-46.899852-113.099644s16.599948-82.899739 46.899852-113.099643C509.101634 352.598888 549.301508 335.99894 592.001373 335.99894s82.899739 16.599948 113.099643 46.899852c30.299904 30.199905 46.899852 70.399778 46.899852 113.099643z" /></svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1822,6 +1822,7 @@ export default {
please_input_url: 'Please enter url address',
please_input_port: 'Please enter port',
modify: 'Edit data Source',
copy: 'Copy datasource',
validate_success: 'Verification successful',
validate: 'Validate',
search_by_name: 'Search by name',

View File

@ -1816,6 +1816,7 @@ export default {
please_input_url: '請輸入URL地址',
please_input_port: '請輸入端口',
modify: '編輯數據源',
copy: '複製數據源',
validate_success: '校驗成功',
validate: '校驗',
search_by_name: '根據名稱搜索',

View File

@ -1815,6 +1815,7 @@ export default {
please_input_url: '请输入URL地址',
please_input_port: '请输入端口',
modify: '编辑数据源',
copy: '复制数据源',
validate_success: '校验成功',
validate: '校验',
search_by_name: '根据名称搜索',

View File

@ -95,6 +95,9 @@ export default {
},
tips() {
const { id, showModel } = this.params
if(showModel === 'copy'){
return this.$t('datasource.copy')
}
return id && showModel === 'show' && !this.canEdit
? this.$t('datasource.show_info')
: this.formType === 'add'

View File

@ -716,6 +716,9 @@ export default {
res.data.apiConfiguration = JSON.parse(Base64.decode(res.data.apiConfigurationStr))
}
this.params = { ...res.data, showModel }
if(showModel === 'copy'){
this.params.id = ''
}
this.$emit('setParams', { ...this.params })
}).finally(() => {
this.$emit('update:formLoading', false)

View File

@ -173,6 +173,10 @@
<i class="el-icon-edit" />
{{ $t('chart.edit') }}
</el-dropdown-item>
<el-dropdown-item command="copy" v-show="showView === 'Datasource'">
<i class="el-icon-edit" />
{{ $t('commons.copy') }}
</el-dropdown-item>
<el-dropdown-item command="delete">
<i class="el-icon-delete" />
{{ $t('chart.delete') }}
@ -651,6 +655,9 @@ export default {
case 'edit':
this._handleEditer(data)
break
case 'copy':
this._handleCopy(data)
break
case 'delete':
this._handleDelete(data)
break
@ -669,6 +676,17 @@ export default {
this.dialogTitle = this.$t('datasource.edit_driver')
this.driverForm = { ...row }
},
_handleCopy(row){
if (this.showView === 'Datasource') {
const param = { ...row, ...{ showModel: 'copy' }}
this.switchMain('DsForm', param, this.tData, this.dsTypes)
this.currentNodeId && sessionStorage.setItem('datasource-current-node', this.currentNodeId)
return
}
this.editDriver = true
this.dialogTitle = this.$t('commons.copy')
this.driverForm = { ...row }
},
_handleDelete(datasource) {
const params = {
title:

View File

@ -0,0 +1,24 @@
<template>
<div>
<h2>this is blood relationship page for shutong</h2>
<span>{{ text }}</span>
</div>
</template>
<script>
export default {
name: 'Relationship',
data() {
return {
text: ''
}
},
created() {
this.init
},
methods: {
init() {
this.text = 'shutong is a handsome guy'
}
}
}
</script>