From 6edb81058aa3f05dd97a4d5b07403ef05946f620 Mon Sep 17 00:00:00 2001 From: chenzuoqing Date: Wed, 15 Dec 2021 15:12:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9E=8B=E7=9A=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E7=9A=84=E8=BF=87=E6=BB=A4=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/asset/views.py | 5 +++++ src/controller/project/views.py | 3 +++ src/models/asset/models.py | 1 + 3 files changed, 9 insertions(+) diff --git a/src/controller/asset/views.py b/src/controller/asset/views.py index ed08365..0f32894 100644 --- a/src/controller/asset/views.py +++ b/src/controller/asset/views.py @@ -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() diff --git a/src/controller/project/views.py b/src/controller/project/views.py index 3ac13e0..b3b19de 100644 --- a/src/controller/project/views.py +++ b/src/controller/project/views.py @@ -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() diff --git a/src/models/asset/models.py b/src/models/asset/models.py index 5a19a19..dc53731 100644 --- a/src/models/asset/models.py +++ b/src/models/asset/models.py @@ -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)