opsx
0427b87412
fix(instance): access_mode 值 read/readonly 不一致导致「读」实例被过滤
现象:instance-groups 里给 MySQL 实例授予「只读查询」权限后,
/queries 页面仍然选不到该实例,admin 也无法访问。
根因(枚举值前后端不一致):
前端 CreateInstanceForm「读」按钮写入 access_mode = "read"
后端 AccessibleInstances 只匹配 ["readwrite", "readonly"]
→ "read" 永远不命中,选了「读」的实例(MySQL)被过滤掉;
Redis 实例是 "readwrite" 所以恰好能查,掩盖了该 bug。
修复:后端 readonly 过滤增加 "read",兼容两种历史写法:
[]string{"readwrite", "readonly", "read"}
写过滤仍为 ["readwrite", "write"]("read" 实例正确地不能写)
验证(admin):
GET /instances/accessible?access_type=readonly → 5 个(含 MySQL id=5, access_mode=read)
GET /instances/accessible?access_type=write → 4 个(MySQL 正确排除)
镜像:lghost/opsxsql:latest + v0.1 = sha256:6b1a7121da71
2026-10-26 18:30:47 +00:00
..
2026-10-26 17:58:59 +08:00
2026-07-08 08:53:48 +00:00
2026-10-26 20:08:46 +08:00
2026-10-26 19:47:08 +08:00
2026-05-31 01:30:10 +08:00
2026-10-26 17:21:00 +08:00
2026-10-26 18:53:02 +08:00
2026-10-26 19:47:08 +08:00
2026-10-26 18:30:47 +00:00
2026-10-26 17:21:00 +08:00
2026-10-26 17:21:00 +08:00
2026-10-26 20:08:46 +08:00
2026-10-26 20:08:46 +08:00
2026-10-26 17:21:00 +08:00
2026-10-26 17:21:00 +08:00
2026-10-26 18:27:11 +08:00
2026-10-26 18:01:44 +00:00
2026-10-26 17:21:00 +08:00
2026-10-26 17:21:00 +08:00
2026-10-26 19:14:35 +08:00
2026-10-26 17:37:21 +00:00