Skip to content

Commit

Permalink
feat: 导入成功或失败都关闭dialog (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJohw authored Sep 30, 2024
1 parent 6acf90c commit 6a10e3c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/pages/src/hooks/useDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ export const useDataSource = () => {
};

const stopOperationPollingRule = (data) => {
if (data.status === 'success') {
if (data.status === 'success' || data.status === 'failed') {
stopPolling();
}
}
};

const importDataTimePolling = ref(null);

Expand All @@ -135,7 +135,7 @@ export const useDataSource = () => {
};

const importDataStopRule = (data) => {
if (data.status === 'success') {
if (data.status === 'success' || data.status === 'failed') {
stopImportDataTimePolling();
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/pages/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"待执行": "Pending",
"同步状态": "Synchronization status",
"同步中": "Running",
"同步成功": "Synchronization successful",
"同步失败": "Synchronization failed",
"成功": "Success",
"失败": "Failed",
"定时": "Scheduled",
Expand Down
2 changes: 2 additions & 0 deletions src/pages/src/language/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"待执行": "待执行",
"同步状态": "同步状态",
"同步中": "同步中",
"同步成功": "同步成功",
"同步失败": "同步失败",
"成功": "成功",
"失败": "失败",
"定时": "定时",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ export const dataRecordStatus = {
},
success: {
icon: normalImg,
text: t('成功'),
text: t('同步成功'),
theme: 'success',
},
failed: {
icon: abnormalImg,
text: t('失败'),
text: t('同步失败'),
theme: 'danger',
},
};
Expand Down
3 changes: 2 additions & 1 deletion src/pages/src/views/setting/data-source/ConfigList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,13 @@ const confirmImportUsers = async () => {
};
const url = `${window.AJAX_BASE_URL}/api/v3/web/data-sources/${currentDataSourceId.value}/operations/import/`;
await axios.post(url, formData, config);
importDialog.isShow = false;
Message({ theme: 'success', message: t('导入成功') });
handleImportLocalDataSync();
initDataSourceList();
} catch (e) {
Message({ theme: 'error', message: e.response.data.error.message });
} finally {
importDialog.isShow = false;
importDialog.loading = false;
}
};
Expand Down

0 comments on commit 6a10e3c

Please sign in to comment.