Skip to content

Commit

Permalink
Add quota_bytes field to user serialization in API
Browse files Browse the repository at this point in the history
The value in bytes is more useful to control the final representation
  • Loading branch information
davelopez committed Feb 21, 2022
1 parent 350279e commit 96c47ee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/galaxy/managers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ def quota(self, user, total=False):
return self.app.quota_agent.get_quota_nice_size(user)
return self.app.quota_agent.get_percent(user=user)

def quota_bytes(self, user):
return self.app.quota_agent.get_quota(user=user)

def tags_used(self, user, tag_models=None):
"""
Return a list of distinct 'user_tname:user_value' strings that the
Expand Down Expand Up @@ -660,6 +663,7 @@ def __init__(self, app: MinimalManagerApp):
"nice_total_disk_usage",
"quota_percent",
"quota",
"quota_bytes",
"deleted",
"purged",
# 'active',
Expand All @@ -686,6 +690,7 @@ def add_serializers(self):
"total_disk_usage": lambda i, k, **c: float(i.total_disk_usage),
"quota_percent": lambda i, k, **c: self.user_manager.quota(i),
"quota": lambda i, k, **c: self.user_manager.quota(i, total=True),
"quota_bytes": lambda i, k, **c: self.user_manager.quota_bytes(i),
"tags_used": lambda i, k, **c: self.user_manager.tags_used(i),
}
)
Expand Down

0 comments on commit 96c47ee

Please sign in to comment.