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

feat: agent_v2_allow_report_filter #1437

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dongtai_web/views/agents_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class AgentListv2ArgsSerializer(serializers.Serializer):
help_text=_('project_id'))
project_name = serializers.CharField(default=None,
help_text=_("project_name"))
allow_report = serializers.IntegerField(default=None,
required=False,
help_text=_('allow_report'))


class AgentListv2(UserEndPoint, ViewSet):
Expand Down Expand Up @@ -83,6 +86,9 @@ def pagenation_list(self, request):
if ser.validated_data['project_id'] is not None:
filter_condiction = filter_condiction & Q(
bind_project_id=ser.validated_data['project_id'])
if ser.validated_data['allow_report'] is not None:
filter_condiction = filter_condiction & Q(
allow_report=ser.validated_data['allow_report'])
if ser.validated_data['last_days'] is not None:
filter_condiction = filter_condiction & Q(
heartbeat__dt__gte=int(time()) -
Expand Down