-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis库列表显示保留有数据的,并加上key的数量 #2705
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2705 +/- ##
=======================================
Coverage 77.43% 77.44%
=======================================
Files 119 119
Lines 16359 16394 +35
=======================================
+ Hits 12668 12696 +28
- Misses 3691 3698 +7 ☔ View full report in Codecov by Sentry. |
@@ -313,6 +313,8 @@ def instance_resource(request): | |||
db_name = request.GET.get("db_name", "") | |||
schema_name = request.GET.get("schema_name", "") | |||
tb_name = request.GET.get("tb_name", "") | |||
# request_source: 请求来源。1. SQL查询。 2.SQL提交 | |||
request_source = request.GET.get("request_source", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整体功能确实是一个非常实用的功能, 但这里我不确认这个参数是不是很合理, 有没有可能这样处理:
- 返回时全部都返回, 不管是谁请求的, 什么用途
- 前端在查询时, 如果是 redis, 遍历其中的内容, 挑选出里面有数据的表, 其他剔除
那这么设计的话, engine 层面就也不需要加参数, 尽力地去获取所有db 的 key 数量就可以了.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你说的这种方式应该可以。我要确认一下SQL提交那边的代码 看看要不要改,有没有影响。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从扩展来说,不同的数据库,可能需要传入不同的参数的。
应该是将post的参数,变成key,value,全部传给方法。这样子方法就自由了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没太看懂你的意思,你能展开说一下吗?比如api 设计,后端大致逻辑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我应该先抛出问题:
get_all_databases() 父类这个方法,从设计上是不是要传参数才好呢?具体怎么传再议。
原因:这个方法现在父类没有参数,
各种engine层在实现这个方法时,因为没有前端的get或post参数,从而限制了子类的这个方法的实现,不够自由。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从名字来看,我个人觉得是不应该加参数的,因为名字就是获取所有的db,没有任何条件。
不过我觉得还是从上层用法来看比较合适,如果说各个engine定制很多,那加参数是必须要的,如果名字不贴切可以再改名字。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恩。OK
我先试试在前端筛选。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LeoQuote 调用/instance/instance_resource/的地方太多,不好改虽然那里不可能选Redis实例,但得要一个个测。 主要是返回结果改了:之前返回一列数据。现在返回了2列(一个key,一个显示值。)
我先不改了。感觉还是支持参数比较好,方便扩展。
…ine2 into redis_database_update
功能需求见:#2608
效果图: