From 76679496c601a7039305d7a210771c9a1472a2ef Mon Sep 17 00:00:00 2001
From: tiny-craft <137850705+tiny-craft@users.noreply.github.com>
Date: Tue, 18 Jul 2023 17:35:31 +0800
Subject: [PATCH] feat: add connection timeout setting
---
backend/services/connection_service.go | 10 +++--
.../components/dialogs/ConnectionDialog.vue | 5 ++-
.../src/components/sidebar/ConnectionTree.vue | 38 +++++++++++--------
3 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go
index 0facf50..34378f9 100644
--- a/backend/services/connection_service.go
+++ b/backend/services/connection_service.go
@@ -253,10 +253,12 @@ func (c *connectionService) getRedisClient(connName string, db int) (*redis.Clie
}
rdb = redis.NewClient(&redis.Options{
- Addr: fmt.Sprintf("%s:%d", selConn.Addr, selConn.Port),
- Username: selConn.Username,
- Password: selConn.Password,
- ReadTimeout: -1,
+ Addr: fmt.Sprintf("%s:%d", selConn.Addr, selConn.Port),
+ Username: selConn.Username,
+ Password: selConn.Password,
+ DialTimeout: time.Duration(selConn.ConnTimeout) * time.Second,
+ ReadTimeout: time.Duration(selConn.ExecTimeout) * time.Second,
+ WriteTimeout: time.Duration(selConn.ExecTimeout) * time.Second,
})
rdb.AddHook(redis2.NewHook(connName, func(cmd string) {
now := time.Now()
diff --git a/frontend/src/components/dialogs/ConnectionDialog.vue b/frontend/src/components/dialogs/ConnectionDialog.vue
index c72f249..b4da914 100644
--- a/frontend/src/components/dialogs/ConnectionDialog.vue
+++ b/frontend/src/components/dialogs/ConnectionDialog.vue
@@ -65,7 +65,7 @@ const formLabelWidth = computed(() => {
}
return '80px'
})
-const predefineColors = ref(['', '#FE5959', '#FEC230', '#FEF27F', '#6CEFAF', '#46C3FC', '#B388FC', '#B0BEC5'])
+const predefineColors = ref(['', '#F75B52', '#F7A234', '#F7CE33', '#4ECF60', '#348CF7', '#B270D3'])
const generalFormRef = ref(null)
const advanceFormRef = ref(null)
@@ -247,7 +247,7 @@ const onClose = () => {
class="color-preset-item"
@click="generalForm.markColor = color"
>
-
+
@@ -286,6 +286,7 @@ const onClose = () => {
margin-right: 2px;
border: white 3px solid;
cursor: pointer;
+ border-radius: 50%;
&_selected,
&:hover {
diff --git a/frontend/src/components/sidebar/ConnectionTree.vue b/frontend/src/components/sidebar/ConnectionTree.vue
index 2787618..9e82cbb 100644
--- a/frontend/src/components/sidebar/ConnectionTree.vue
+++ b/frontend/src/components/sidebar/ConnectionTree.vue
@@ -1,12 +1,12 @@