You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2022/08/31 12:45:43 UTC
[incubator-devlake] branch main updated: fix: connection saving must return after 2 seconds even though the network is in localhost. (#2887)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 65594e9f fix: connection saving must return after 2 seconds even though the network is in localhost. (#2887)
65594e9f is described below
commit 65594e9ff269b76209ea6d0b5a46e0e922600061
Author: likyh <l...@likyh.com>
AuthorDate: Wed Aug 31 20:45:39 2022 +0800
fix: connection saving must return after 2 seconds even though the network is in localhost. (#2887)
Co-authored-by: linyh <ya...@meri.co>
---
config-ui/src/hooks/useConnectionManager.jsx | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/config-ui/src/hooks/useConnectionManager.jsx b/config-ui/src/hooks/useConnectionManager.jsx
index cfeea122..19f21557 100644
--- a/config-ui/src/hooks/useConnectionManager.jsx
+++ b/config-ui/src/hooks/useConnectionManager.jsx
@@ -256,13 +256,16 @@ function useConnectionManager (
}
}
+ let savePromise
if (updateMode && activeConnection?.id !== null) {
modifyConfiguration(connectionPayload)
+ savePromise = modifyConfiguration(connectionPayload)
} else {
saveConfiguration(connectionPayload)
+ savePromise = saveConfiguration(connectionPayload)
}
- setTimeout(() => {
+ savePromise.then(() => {
if (saveResponse.success && errors.length === 0) {
ToastNotification.show({
message: 'Connection saved successfully.',
@@ -282,7 +285,11 @@ function useConnectionManager (
if (!updateMode) {
history.push(`/integrations/${provider.id}`)
}
- } else {
+ }
+ })
+
+ setTimeout(() => {
+ if (!saveResponse.success || errors.length !== 0) {
ToastNotification.show({
message: 'Connection failed to save, please try again.',
intent: 'danger',
@@ -312,7 +319,6 @@ function useConnectionManager (
try {
setIsFetching(!silent)
setErrors([])
- ToastNotification.clear()
console.log('>> FETCHING CONNECTION SOURCE')
const fetch = async () => {
const f = await request.get(
@@ -341,6 +347,7 @@ function useConnectionManager (
setIsFetching(false)
setActiveConnection(NullConnection)
setErrors([e.message])
+ ToastNotification.clear()
ToastNotification.show({
message: `${e}`,
intent: 'danger',