mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Make sure only 20 dashboards/queries returned in recent call.
This commit is contained in:
parent
5f656f3868
commit
46f1478e0d
@ -2,7 +2,7 @@ from flask import request
|
||||
from flask.ext.restful import abort
|
||||
from flask_login import current_user
|
||||
|
||||
from funcy import distinct
|
||||
from funcy import distinct, take
|
||||
from itertools import chain
|
||||
|
||||
from redash import models
|
||||
@ -19,7 +19,7 @@ class DashboardRecentAPI(BaseResource):
|
||||
if len(recent) < 10:
|
||||
global_recent = [d.to_dict() for d in models.Dashboard.recent()]
|
||||
|
||||
return distinct(chain(recent, global_recent), key=lambda d: d['id'])
|
||||
return take(20, distinct(chain(recent, global_recent), key=lambda d: d['id']))
|
||||
|
||||
|
||||
class DashboardListAPI(BaseResource):
|
||||
|
@ -3,7 +3,7 @@ from flask.ext.restful import abort
|
||||
from flask_login import current_user, login_required
|
||||
import sqlparse
|
||||
|
||||
from funcy import distinct
|
||||
from funcy import distinct, take
|
||||
from itertools import chain
|
||||
|
||||
from redash import models
|
||||
@ -56,7 +56,7 @@ class QueryRecentAPI(BaseResource):
|
||||
if len(recent) < 10:
|
||||
global_recent = [d.to_dict() for d in models.Query.recent()]
|
||||
|
||||
return distinct(chain(recent, global_recent), key=lambda d: d['id'])
|
||||
return take(20, distinct(chain(recent, global_recent), key=lambda d: d['id']))
|
||||
|
||||
|
||||
class QueryListAPI(BaseResource):
|
||||
|
Loading…
Reference in New Issue
Block a user