Pass front-end the api page limit with Jinja

This commit is contained in:
Nathan Barber
2021-05-19 10:01:00 -04:00
parent 21c14454cc
commit 5db40d096d
4 changed files with 6 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ export const initialState = {
user_page: 0, user_page: 0,
groups_data: undefined, groups_data: undefined,
groups_page: 0, groups_page: 0,
limit: 50, limit: window.api_page_limit,
}; };
export const reducers = (state = initialState, action) => { export const reducers = (state = initialState, action) => {

View File

@@ -466,6 +466,7 @@ class AdminHandler(BaseHandler):
allow_named_servers=self.allow_named_servers, allow_named_servers=self.allow_named_servers,
named_server_limit_per_user=self.named_server_limit_per_user, named_server_limit_per_user=self.named_server_limit_per_user,
server_version='{} {}'.format(__version__, self.version_hash), server_version='{} {}'.format(__version__, self.version_hash),
api_page_limit=self.settings["app"].api_page_default_limit,
) )
self.finish(html) self.finish(html)

File diff suppressed because one or more lines are too long

View File

@@ -17,6 +17,9 @@
{% block main %} {% block main %}
<div id="react-admin-hook"> <div id="react-admin-hook">
<script id="jupyterhub-admin-config">
window.api_page_limit = parseInt("{{ api_page_limit|safe }}")
</script>
<script src="static/js/admin-react.js"></script> <script src="static/js/admin-react.js"></script>
</div> </div>
{% endblock %} {% endblock %}