mirror of
https://github.com/dataease/dataease.git
synced 2026-06-10 23:09:59 +08:00
feat: 【数据源】远程Excel/CSV数据源,配置定时更新后支持手动立即更新 #18340
This commit is contained in:
@@ -876,8 +876,14 @@ public class DatasourceServer implements DatasourceApi {
|
||||
Long datasourceId = Long.valueOf(req.get("datasourceId"));
|
||||
CoreDatasourceTask coreDatasourceTask = datasourceTaskServer.selectByDSId(datasourceId);
|
||||
CoreDatasource coreDatasource = dataSourceManage.getCoreDatasource(datasourceId);
|
||||
DatasourceServer.UpdateType updateType = DatasourceServer.UpdateType.valueOf(coreDatasourceTask.getUpdateType());
|
||||
datasourceSyncManage.extractedData(null, coreDatasource, updateType, MANUAL.toString());
|
||||
if (coreDatasource.getType().equalsIgnoreCase("ExcelRemote")) {
|
||||
DatasourceServer.UpdateType updateType = DatasourceServer.UpdateType.valueOf(coreDatasourceTask.getUpdateType());
|
||||
datasourceSyncManage.extractedExcelData(null, coreDatasource, updateType, MANUAL.toString());
|
||||
} else {
|
||||
DatasourceServer.UpdateType updateType = DatasourceServer.UpdateType.valueOf(coreDatasourceTask.getUpdateType());
|
||||
datasourceSyncManage.extractedData(null, coreDatasource, updateType, MANUAL.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static <T> List<T> deepCopy(List<T> originalList) {
|
||||
|
||||
@@ -690,6 +690,24 @@ const updateApiDs = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const syncRemoteExcelDsLoading = ref(false)
|
||||
const updateRemoteExcelDs = () => {
|
||||
if (syncRemoteExcelDsLoading.value) {
|
||||
return
|
||||
}
|
||||
syncRemoteExcelDsLoading.value = true
|
||||
syncApiDs({ datasourceId: nodeInfo.id })
|
||||
.then(() => {
|
||||
ElMessage.success(t('datasource.req_completed'))
|
||||
if (showRecord.value) {
|
||||
getRecord()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
syncRemoteExcelDsLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
const nodeExpand = data => {
|
||||
if (data.id) {
|
||||
expandedKey.value.push(data.id)
|
||||
@@ -1819,14 +1837,30 @@ const getMenuList = (val: boolean) => {
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-button @click="getRecord" class="update-records" text>
|
||||
<template #icon>
|
||||
<icon name="icon_describe_outlined"
|
||||
><icon_describe_outlined class="svg-icon"
|
||||
/></icon>
|
||||
</template>
|
||||
{{ t('dataset.update_records') }}
|
||||
</el-button>
|
||||
<div class="update-actions">
|
||||
<el-button
|
||||
v-if="nodeInfo.type === 'ExcelRemote'"
|
||||
@click="updateRemoteExcelDs"
|
||||
:loading="syncRemoteExcelDsLoading"
|
||||
class="update-records"
|
||||
text
|
||||
>
|
||||
<template #icon>
|
||||
<icon name="icon_replace_outlined"
|
||||
><icon_replace_outlined class="svg-icon"
|
||||
/></icon>
|
||||
</template>
|
||||
{{ t('datasource.execute_once') }}
|
||||
</el-button>
|
||||
<el-button @click="getRecord" class="update-records" text>
|
||||
<template #icon>
|
||||
<icon name="icon_describe_outlined"
|
||||
><icon_describe_outlined class="svg-icon"
|
||||
/></icon>
|
||||
</template>
|
||||
{{ t('dataset.update_records') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</BaseInfoContent>
|
||||
</template>
|
||||
</template>
|
||||
@@ -2099,10 +2133,17 @@ const getMenuList = (val: boolean) => {
|
||||
}
|
||||
}
|
||||
|
||||
.update-records {
|
||||
.update-actions {
|
||||
position: absolute;
|
||||
top: 19px;
|
||||
right: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.update-records {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.update-info {
|
||||
|
||||
Reference in New Issue
Block a user