项目、资产相关模型的列表视图,使用公共的过滤封装
This commit is contained in:
parent
eb90c17711
commit
6edb81058a
|
@ -11,6 +11,7 @@ from controller.asset import parsers
|
|||
class HostViews(parsers.HostParse, ListCreateViewSet):
|
||||
model = assetModel.Host
|
||||
fields = assetField.HostFields
|
||||
filter_fields = (("public_ip", "contains"), ("private_ip", "contains"), ("tags", ""))
|
||||
|
||||
def __init__(self):
|
||||
self.init_parse()
|
||||
|
@ -32,6 +33,7 @@ class HostDetailViews(parsers.HostParse, DetailViewSet):
|
|||
class MySQLInstanceViews(parsers.DatabaseServerParse, ListCreateViewSet):
|
||||
model = assetModel.MySQLInstance
|
||||
fields = assetField.MySQLInstanceFields
|
||||
filter_fields = (("name", "icontains"), ("host", "icontains"), ("manage", ""), ("tags", ""))
|
||||
|
||||
def __init__(self):
|
||||
self.init_parse()
|
||||
|
@ -71,6 +73,7 @@ class MySQLInstanceDetail(parsers.DatabaseServerParse, DetailViewSet):
|
|||
class RedisInstanceViews(parsers.DatabaseServerParse, ListCreateViewSet):
|
||||
model = assetModel.RedisInstance
|
||||
fields = assetField.RedisInstanceFields
|
||||
filter_fields = (("name", "icontains"), ("host", "icontains"), ("manage", ""), ("tags", ""))
|
||||
|
||||
def __init__(self):
|
||||
self.init_parse()
|
||||
|
@ -105,6 +108,7 @@ class RedisInstanceDetail(parsers.DatabaseServerParse, DetailViewSet):
|
|||
class NginxInstanceViews(parsers.MiddlewareParse, ListCreateViewSet):
|
||||
model = assetModel.NginxInstance
|
||||
fields = assetField.NginxInstanceFields
|
||||
filter_fields = (("host", "icontains"), ("manage", ""), ("url", "icontains"), ("tags", ""))
|
||||
|
||||
def __init__(self):
|
||||
self.init_parse()
|
||||
|
@ -134,6 +138,7 @@ class CDNViews(ListCreateViewSet):
|
|||
model = assetModel.CDN
|
||||
fields = assetField.CDNFields
|
||||
uniq_fields = ("domain",)
|
||||
filter_fields = (("domain", "icontains"), ("tags", ""),)
|
||||
|
||||
def __init__(self):
|
||||
self.request_parse = reqparse.RequestParser()
|
||||
|
|
|
@ -13,6 +13,7 @@ class ProjectViews(ListMixin, CreateMixin):
|
|||
model = Project
|
||||
paging = False
|
||||
fields = fields.ProjectFields
|
||||
filter_fields = (("name", ""), ("fork", ""), ("ops_ip", ""), ("domain", "icontains"), ("tags", ""))
|
||||
|
||||
|
||||
class ProjectDetailViews(DetailViewSet):
|
||||
|
@ -24,6 +25,7 @@ class ChannelViews(parsers.ChannelParse, ListCreateViewSet):
|
|||
model = Channel
|
||||
fields = fields.ChannelFields
|
||||
uniq_fields = (("spid", "project_id"),)
|
||||
filter_fields = (("name", ""), ("spid", ""), ("tags", ""))
|
||||
|
||||
def __init__(self):
|
||||
self.init_parse()
|
||||
|
@ -49,6 +51,7 @@ class ServerViews(parsers.ServerParse, ListCreateViewSet):
|
|||
fields = fields.ServerFields
|
||||
uniq_fields = (("num", "channel_id"),)
|
||||
relation_fields = (("host_id", assetModel.Host, ""), ("channel_id", Channel, True))
|
||||
filter_fields = (("num", ""), ("spid", ""), ("tags", ""))
|
||||
|
||||
def __init__(self):
|
||||
self.init_parse()
|
||||
|
|
|
@ -97,6 +97,7 @@ class NginxInstance(Middleware):
|
|||
|
||||
class CDN(DocumentBase):
|
||||
"""cdn域名"""
|
||||
meta = {'collection': 'cdn'}
|
||||
domain = mongo.StringField(max_length=256, required=True) # cdn域名
|
||||
manage = mongo.StringField(max_length=128, default="")
|
||||
data = mongo.DictField(default=dict)
|
||||
|
|
Loading…
Reference in New Issue