Skip to content
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

增加实例标签功能 #162

Merged
merged 4 commits into from
May 6, 2019
Merged

增加实例标签功能 #162

merged 4 commits into from
May 6, 2019

Conversation

hhyo
Copy link
Owner

@hhyo hhyo commented May 3, 2019

相关issue:#152

  • 增加两个默认标签,可通过命令 python manage.py loaddata initial_data.json 初始化
  • 标签可在添加实例时进行关联
  • 实例列表标签筛选逻辑是&&

@LeoQuote @yyukai
关于tag_code,标签代码有没有命名规范建议?

  • 查询和上线的实例过滤条件会由主库、从库变成标签过滤,所以tag_code和权限代码类似会存在于代码中

@hhyo hhyo requested review from LeoQuote and kjiLupin and removed request for LeoQuote May 3, 2019 04:52
@codecov
Copy link

codecov bot commented May 3, 2019

Codecov Report

Merging #162 into master will increase coverage by 0.03%.
The diff coverage is 71.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
+ Coverage   73.91%   73.95%   +0.03%     
==========================================
  Files          62       62              
  Lines        6683     6727      +44     
==========================================
+ Hits         4940     4975      +35     
- Misses       1743     1752       +9
Impacted Files Coverage Δ
sql/views.py 38.85% <0%> (-0.45%) ⬇️
sql/instance.py 43.94% <0%> (-0.81%) ⬇️
sql/admin.py 100% <100%> (ø) ⬆️
sql/resource_group.py 16.21% <16.66%> (ø) ⬆️
sql/utils/resource_group.py 73.07% <50%> (-5.19%) ⬇️
sql/models.py 94.57% <95.65%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f6f6d7...5932ee1. Read the comment docs.

@LeoQuote
Copy link
Collaborator

LeoQuote commented May 3, 2019

还没空跑起来,从代码来看是类似用户和组的体验?只要能在一个地方完成添加我觉得就挺好的。

关于属性值这块我建议不要有tag_name 这样的命名,这样的话,代码里会有这样风格的名字 some_tag.tag_name 我个人感觉 some_tag.name 就比较自然。

tag有ID和名字我觉得就够了,code_name是出于什么考虑?检索速度吗?

tag的名字可以有个建议比如都是 can_ is_ 开头的,can_read 表示可以读,can_write 可以写,is_master 是主库,is_slave 是从库之类的。

@hhyo
Copy link
Owner Author

hhyo commented May 3, 2019

类似用户和组,主要用于分类和筛选

名称可以在model定义为name,加个属性映射到db,主要还是避免关键字的原因

code用于代码逻辑判断,定义后不能修改,name用于前端展现,可以修改

Copy link
Collaborator

@LeoQuote LeoQuote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

很棒, 我刚刚在自己机器上跑起来了, 用起来挺友好, 和zabbix的界面很像.
我看前端的相关调整还没有完成吧, 加油👍

@flyingonthebed
Copy link
Contributor

加油⛽️

@hhyo
Copy link
Owner Author

hhyo commented May 5, 2019

tag_code调整为:can_read 支持查询,can_write 支持上线
SQL上线和查询相关代码已经修改完成
演示环境已更新

@hhyo hhyo merged commit d1dcf6c into master May 6, 2019
@hhyo hhyo deleted the feature/instance_tag branch May 6, 2019 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants