Merge pull request #10698 from dataease/pr@dev-v2@fixDS

fix: API 数据源参数校验
This commit is contained in:
taojinlong 2024-07-02 13:53:47 +08:00 committed by GitHub
commit 6e8afa3071
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 67 additions and 12 deletions

View File

@ -95,10 +95,10 @@ public class DataSourceManage {
if (ObjectUtils.isNotEmpty(dto.getId())) { if (ObjectUtils.isNotEmpty(dto.getId())) {
wrapper.ne("id", dto.getId()); wrapper.ne("id", dto.getId());
} }
if (ObjectUtils.isNotEmpty(dto.getNodeType()) ) { if (ObjectUtils.isNotEmpty(dto.getNodeType())) {
if(dto.getNodeType().equalsIgnoreCase("folder")){ if (dto.getNodeType().equalsIgnoreCase("folder")) {
wrapper.eq("type", dto.getType()); wrapper.eq("type", dto.getType());
}else { } else {
wrapper.ne("type", "folder"); wrapper.ne("type", "folder");
} }

View File

@ -37,6 +37,7 @@ import io.dataease.i18n.Translator;
import io.dataease.job.schedule.CheckDsStatusJob; import io.dataease.job.schedule.CheckDsStatusJob;
import io.dataease.job.schedule.ScheduleManager; import io.dataease.job.schedule.ScheduleManager;
import io.dataease.license.config.XpackInteract; import io.dataease.license.config.XpackInteract;
import io.dataease.license.utils.LicenseUtil;
import io.dataease.log.DeLog; import io.dataease.log.DeLog;
import io.dataease.model.BusiNodeRequest; import io.dataease.model.BusiNodeRequest;
import io.dataease.model.BusiNodeVO; import io.dataease.model.BusiNodeVO;
@ -969,9 +970,10 @@ public class DatasourceServer implements DatasourceApi {
datasources.forEach(datasource -> { datasources.forEach(datasource -> {
commonThreadPool.addTask(() -> { commonThreadPool.addTask(() -> {
try { try {
LicenseUtil.validate();
validate(datasource); validate(datasource);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
}); });
}); });

View File

@ -70,6 +70,7 @@ public class ExportCenterManage {
public void init() { public void init() {
scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(corePoolSize); scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(corePoolSize);
scheduledThreadPoolExecutor.setKeepAliveTime(keepAliveSeconds, TimeUnit.SECONDS); scheduledThreadPoolExecutor.setKeepAliveTime(keepAliveSeconds, TimeUnit.SECONDS);
scheduledThreadPoolExecutor.setMaximumPoolSize(10);
} }
@Scheduled(fixedRate = 5000) @Scheduled(fixedRate = 5000)
@ -154,6 +155,9 @@ public class ExportCenterManage {
public void retry(String id) { public void retry(String id) {
CoreExportTask exportTask = exportTaskMapper.selectById(id); CoreExportTask exportTask = exportTaskMapper.selectById(id);
if(!exportTask.getExportStatus().equalsIgnoreCase("FAILED")){
DEException.throwException("正在导出中!");
}
exportTask.setExportStatus("PENDING"); exportTask.setExportStatus("PENDING");
exportTask.setExportProgress("0"); exportTask.setExportProgress("0");
exportTask.setExportMachineName(hostName()); exportTask.setExportMachineName(hostName());

View File

@ -599,13 +599,18 @@ const handleApiParams = (cmd: string, data) => {
autofocus: false, autofocus: false,
showClose: false showClose: false
}).then(() => { }).then(() => {
form.value.paramsConfiguration.splice(0, 1) let index = 0
for (let i = 0; i < form.value.paramsConfiguration.length; i++) {
if (form.value.paramsConfiguration[i].serialNumber === data.serialNumber) {
index = i
}
}
form.value.paramsConfiguration.splice(index, 1)
if (activeParamsName.value === data.name) { if (activeParamsName.value === data.name) {
gridData.value = [] gridData.value = []
} }
}) })
} }
if (cmd === 'edit') { if (cmd === 'edit') {
addApiItem(data) addApiItem(data)
} }

View File

@ -630,15 +630,59 @@ const editDatasource = (editType?: number) => {
} }
const handleEdit = async data => { const handleEdit = async data => {
await handleNodeClick(data) editDatasource()
datasourceEditor.value.init(nodeInfo)
} }
const handleCopy = async data => { const handleCopy = async data => {
await handleNodeClick(data) getById(nodeInfo.id).then(res => {
nodeInfo.id = '' let {
nodeInfo.name = '复制数据源' name,
datasourceEditor.value.init(nodeInfo) createBy,
id,
createTime,
creator,
type,
pid,
configuration,
syncSetting,
apiConfigurationStr,
paramsStr,
fileName,
size,
description,
lastSyncTime
} = res.data
if (configuration) {
configuration = JSON.parse(Base64.decode(configuration))
}
if (paramsStr) {
paramsStr = JSON.parse(Base64.decode(paramsStr))
}
if (apiConfigurationStr) {
apiConfigurationStr = JSON.parse(Base64.decode(apiConfigurationStr))
}
let datasource = reactive<Node>(cloneDeep(defaultInfo))
Object.assign(datasource, {
name,
pid,
description,
fileName,
size,
createTime,
creator,
createBy,
id,
type,
configuration,
syncSetting,
apiConfiguration: apiConfigurationStr,
paramsConfiguration: paramsStr,
lastSyncTime
})
datasource.id = ''
datasource.name = '复制数据源'
datasourceEditor.value.init(datasource)
})
} }
const handleDatasourceTree = (cmd: string, data?: Tree) => { const handleDatasourceTree = (cmd: string, data?: Tree) => {