Merge pull request #6377 from dataease/pr@dev-v2@fixDatasource

Pr@dev v2@fix datasource
This commit is contained in:
taojinlong 2023-10-26 02:53:11 -05:00 committed by GitHub
commit 250f46081e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 5 deletions

View File

@ -134,7 +134,7 @@ public class DatasourceSyncManage {
datasourceRequest.setDatasource(coreDatasource); datasourceRequest.setDatasource(coreDatasource);
List<DatasetTableDTO> tables = ApiUtils.getTables(datasourceRequest); List<DatasetTableDTO> tables = ApiUtils.getTables(datasourceRequest);
for (DatasetTableDTO api : tables) { for (DatasetTableDTO api : tables) {
CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(coreDatasource.getId(), taskId, api.getName(), scheduleType); CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(coreDatasource.getId(), taskId, api.getTableName(), scheduleType);
datasourceRequest.setTable(api.getTableName()); datasourceRequest.setTable(api.getTableName());
List<TableField> tableFields = ApiUtils.getTableFields(datasourceRequest); List<TableField> tableFields = ApiUtils.getTableFields(datasourceRequest);
try { try {
@ -181,7 +181,7 @@ public class DatasourceSyncManage {
LogUtil.error("Can not find datasource: " + datasourceId); LogUtil.error("Can not find datasource: " + datasourceId);
return; return;
} }
CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(datasourceId, null, name, MANUAL.toString()); CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(datasourceId, null, tableName, MANUAL.toString());
DatasourceRequest datasourceRequest = new DatasourceRequest(); DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(coreDatasource); datasourceRequest.setDatasource(coreDatasource);

View File

@ -846,11 +846,24 @@ public class DatasourceServer implements DatasourceApi {
} }
public IPage<CoreDatasourceTaskLogDTO> listSyncRecord(int goPage, int pageSize, Long dsId) { public IPage<CoreDatasourceTaskLogDTO> listSyncRecord(int goPage, int pageSize, Long dsId) {
QueryWrapper<CoreDatasourceTaskLogDTO> wrapper = new QueryWrapper<>(); QueryWrapper<CoreDatasourceTaskLogDTO> wrapper = new QueryWrapper<>();
wrapper.eq("ds_id", dsId); wrapper.eq("ds_id", dsId);
wrapper.orderByDesc("start_time"); wrapper.orderByDesc("start_time");
Page<CoreDatasourceTaskLogDTO> page = new Page<>(goPage, pageSize); Page<CoreDatasourceTaskLogDTO> page = new Page<>(goPage, pageSize);
IPage<CoreDatasourceTaskLogDTO> pager = taskLogExtMapper.pager(page, wrapper); IPage<CoreDatasourceTaskLogDTO> pager = taskLogExtMapper.pager(page, wrapper);
CoreDatasource coreDatasource = datasourceMapper.selectById(dsId);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(coreDatasource);
List<DatasetTableDTO> datasetTableDTOS = ApiUtils.getTables(datasourceRequest);
for (int i = 0; i < pager.getRecords().size(); i++) {
for (int i1 = 0; i1 < datasetTableDTOS.size(); i1++) {
if(pager.getRecords().get(i).getTableName().equalsIgnoreCase(datasetTableDTOS.get(i1).getTableName())){
pager.getRecords().get(i).setName(datasetTableDTOS.get(i1).getName());
}
}
}
return pager; return pager;
} }

View File

@ -737,7 +737,7 @@ defineExpose({
</el-select> </el-select>
</el-form-item> </el-form-item>
<span <span
v-if="!['es', 'api', 'mongo'].includes(form.type)" v-if="!['es', 'api'].includes(form.type)"
class="de-expand" class="de-expand"
@click="showPriority = !showPriority" @click="showPriority = !showPriority"
>{{ t('datasource.priority') }} >{{ t('datasource.priority') }}

View File

@ -995,7 +995,7 @@ onMounted(() => {
</el-col> </el-col>
</el-row> </el-row>
<span <span
v-if="!['es', 'api', 'mongo'].includes(nodeInfo.type.toLowerCase())" v-if="!['es', 'api'].includes(nodeInfo.type.toLowerCase())"
class="de-expand" class="de-expand"
@click="showPriority = !showPriority" @click="showPriority = !showPriority"
>{{ t('datasource.priority') }} >{{ t('datasource.priority') }}
@ -1236,7 +1236,7 @@ onMounted(() => {
@size-change="handleRecordSizeChange" @size-change="handleRecordSizeChange"
@current-change="handleRecordCurrentChange" @current-change="handleRecordCurrentChange"
> >
<el-table-column prop="tableName" :label="t('datasource.data_table')"></el-table-column> <el-table-column prop="name" :label="t('datasource.data_table')"></el-table-column>
<el-table-column prop="triggerType" :label="t('datasource.sync_rate')"> <el-table-column prop="triggerType" :label="t('datasource.sync_rate')">
<template #default="scope"> <template #default="scope">
<div class="flex-align-center"> <div class="flex-align-center">

View File

@ -55,6 +55,7 @@ public class CoreDatasourceTaskLogDTO implements Serializable {
*/ */
private String taskStatus; private String taskStatus;
private String tableName; private String tableName;
private String name;
/** /**
* 错误信息 * 错误信息