Skip to content

Commit

Permalink
feat: 提供 Agent 包管理后台基础接口 (closed #1683)
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 22864
  • Loading branch information
ping15 committed Nov 5, 2024
1 parent 6d49006 commit b073de4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/node_man/tools/gse_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def compare_version(a, b):
@classmethod
def match_criteria(cls, pkg_version_info, validated_data, filter_keys):
for key in filter_keys:
if key == "os" and validated_data["os"] in pkg_version_info["os_choices"]:
return True
elif key == "cpu_arch" and validated_data["cpu_arch"] in pkg_version_info["cpu_arch_choices"]:
return True
return False
if key == "os" and validated_data["os"] not in pkg_version_info["os_choices"]:
return False
elif key == "cpu_arch" and validated_data["cpu_arch"] not in pkg_version_info["cpu_arch_choices"]:
return False
return True
10 changes: 10 additions & 0 deletions apps/node_man/views/package_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@


class PackageManageOrderingFilterSet(filters.OrderingFilter):
def get_ordering(self, request, queryset, view):
params = request.data.get(self.ordering_param)
if params:
fields = [param.strip() for param in params.split(",")]
ordering = self.remove_invalid_fields(queryset, fields, view, request)
if ordering:
return ordering

return self.get_default_ordering(view)

def filter_queryset(self, request, queryset, view):
ordering = self.get_ordering(request, queryset, view)
if not ordering:
Expand Down

0 comments on commit b073de4

Please sign in to comment.