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 Jan 27, 2022
1 parent 83cd083 commit 7d4941c
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 @@ -389,6 +389,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 @@ -618,6 +621,7 @@ def __init__(self, app: MinimalManagerApp):
'nice_total_disk_usage',
'quota_percent',
'quota',
'quota_bytes',
'deleted',
'purged',
# 'active',
Expand All @@ -644,6 +648,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 7d4941c

Please sign in to comment.