fix: reload when data source click refresh (#3804)

This commit is contained in:
jack zhang 2024-03-25 11:28:54 +08:00 committed by GitHub
parent 66229cc92b
commit 570e5c1354
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,6 +60,13 @@ export const DatabaseConnectionManagerPane = () => {
const service = useResourceActionContext();
return {
async onClick() {
const needReloadDataSources = service?.data?.data.filter((item) => item.status !== 'loaded');
if (needReloadDataSources?.length) {
const dataSources = dm.getDataSources();
const needLoadDataSourceKeys = needReloadDataSources.map((item) => item.key);
const needLoadDataSourcesInstance = dataSources.filter((item) => needLoadDataSourceKeys.includes(item.key));
await Promise.all(needLoadDataSourcesInstance.map((item) => item.reload()));
}
service?.refresh?.();
},
};