diff --git a/mayfly_go_web/src/views/ops/redis/DataOperation.vue b/mayfly_go_web/src/views/ops/redis/DataOperation.vue index 74440f36..5027fce9 100644 --- a/mayfly_go_web/src/views/ops/redis/DataOperation.vue +++ b/mayfly_go_web/src/views/ops/redis/DataOperation.vue @@ -9,7 +9,7 @@ @@ -64,7 +64,7 @@ - @@ -79,10 +79,10 @@ @@ -133,8 +133,8 @@ class NodeType { } const state = reactive({ - instanceMenuMaxHeight: '600', loading: false, + tableHeight: 600, tags: [], redisList: [] as any, dbList: [], @@ -176,6 +176,7 @@ const state = reactive({ }); const { + tableHeight, scanParam, dataEdit, hashValueDialog, @@ -190,7 +191,7 @@ onMounted(async () => { }) const setHeight = () => { - state.instanceMenuMaxHeight = window.innerHeight - 115 + 'px'; + state.tableHeight = window.innerHeight - 159; } /** @@ -259,13 +260,18 @@ const nodeClick = (data: any) => { */ const getDbs = async (redisInfo: any) => { let dbs: TagTreeNode[] = redisInfo.db.split(',').map((x: string) => { - return new TagTreeNode(x, x, NodeType.Db).withIsLeaf(true).withParams({ + return new TagTreeNode(x, `db${x}`, NodeType.Db).withIsLeaf(true).withParams({ id: redisInfo.id, db: x, name: `db${x}`, keys: 0, }) }) + + if (redisInfo.mode == 'cluster') { + return dbs; + } + const res = await redisApi.redisInfo.request({ id: redisInfo.id, host: redisInfo.host, section: "Keyspace" }); for (let db in res.Keyspace) { for (let d of dbs) { diff --git a/server/go.mod b/server/go.mod index f104268b..9334def7 100644 --- a/server/go.mod +++ b/server/go.mod @@ -4,13 +4,13 @@ go 1.20 require ( github.com/gin-gonic/gin v1.9.0 - github.com/go-redis/redis/v8 v8.11.5 github.com/go-sql-driver/mysql v1.7.0 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/gorilla/websocket v1.5.0 github.com/lib/pq v1.10.7 github.com/mojocn/base64Captcha v1.3.5 // 验证码 github.com/pkg/sftp v1.13.5 + github.com/redis/go-redis/v9 v9.0.2 github.com/robfig/cron/v3 v3.0.1 // 定时任务 github.com/sirupsen/logrus v1.9.0 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 @@ -24,7 +24,7 @@ require ( require ( github.com/bytedance/sonic v1.8.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/gin-contrib/sse v0.1.0 // indirect @@ -59,6 +59,5 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/server/internal/db/application/db.go b/server/internal/db/application/db.go index 816c8892..21e41d96 100644 --- a/server/internal/db/application/db.go +++ b/server/internal/db/application/db.go @@ -87,6 +87,9 @@ func (d *dbAppImpl) Save(dbEntity *entity.Db) { // 查找是否存在该库 oldDb := &entity.Db{Host: dbEntity.Host, Port: dbEntity.Port, Username: dbEntity.Username} + if dbEntity.SshTunnelMachineId > 0 { + oldDb.SshTunnelMachineId = dbEntity.SshTunnelMachineId + } err := d.GetDbBy(oldDb) if dbEntity.Id == 0 { diff --git a/server/internal/machine/application/machine.go b/server/internal/machine/application/machine.go index 90e60018..052a9d2c 100644 --- a/server/internal/machine/application/machine.go +++ b/server/internal/machine/application/machine.go @@ -62,6 +62,9 @@ func (m *machineAppImpl) Count(condition *entity.MachineQuery) int64 { func (m *machineAppImpl) Save(me *entity.Machine) { oldMachine := &entity.Machine{Ip: me.Ip, Port: me.Port, Username: me.Username} + if me.SshTunnelMachineId > 0 { + oldMachine.SshTunnelMachineId = me.SshTunnelMachineId + } err := m.GetMachine(oldMachine) me.PwdEncrypt() diff --git a/server/internal/redis/api/redis.go b/server/internal/redis/api/redis.go index d9180391..4c26b950 100644 --- a/server/internal/redis/api/redis.go +++ b/server/internal/redis/api/redis.go @@ -18,7 +18,7 @@ import ( "sync" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" ) type Redis struct { diff --git a/server/internal/redis/application/redis_app.go b/server/internal/redis/application/redis_app.go index ce22ad1b..a59ad63a 100644 --- a/server/internal/redis/application/redis_app.go +++ b/server/internal/redis/application/redis_app.go @@ -18,7 +18,7 @@ import ( "strings" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" ) type Redis interface { @@ -81,6 +81,9 @@ func (r *redisAppImpl) Save(re *entity.Redis) { // 查找是否存在该库 oldRedis := &entity.Redis{Host: re.Host} + if re.SshTunnelMachineId > 0 { + oldRedis.SshTunnelMachineId = re.SshTunnelMachineId + } err := r.GetRedisBy(oldRedis) if re.Id == 0 { diff --git a/server/pkg/rediscli/rediscli.go b/server/pkg/rediscli/rediscli.go index 0fa48027..4be909b2 100644 --- a/server/pkg/rediscli/rediscli.go +++ b/server/pkg/rediscli/rediscli.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" ) var cli *redis.Client diff --git a/server/pkg/starter/redis.go b/server/pkg/starter/redis.go index 60721481..dbd451a6 100644 --- a/server/pkg/starter/redis.go +++ b/server/pkg/starter/redis.go @@ -7,7 +7,7 @@ import ( "mayfly-go/pkg/global" "mayfly-go/pkg/rediscli" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" ) func initRedis() {