Pass param of limit for recent activity (#4475)

This commit is contained in:
Hugh A. Miles II 2018-02-23 14:18:06 -08:00 committed by Maxime Beauchemin
parent 5830846060
commit cacf53c92e
1 changed files with 7 additions and 1 deletions

View File

@ -1651,6 +1651,12 @@ class Superset(BaseSupersetView):
def recent_activity(self, user_id):
"""Recent activity (actions) for a given user"""
M = models # noqa
if request.args.get('limit'):
limit = int(request.args.get('limit'))
else:
limit = 1000
qry = (
db.session.query(M.Log, M.Dashboard, M.Slice)
.outerjoin(
@ -1668,7 +1674,7 @@ class Superset(BaseSupersetView):
),
)
.order_by(M.Log.dttm.desc())
.limit(1000)
.limit(limit)
)
payload = []
for log in qry.all():