Skip to content
Snippets Groups Projects
Commit d024a5a5 authored by Jan Mach's avatar Jan Mach
Browse files

Fix: Removed 'items' subkey from /api/events/dashboard response JSON.

JSON response could be really large in some scenarios, we have encountered objects 40MB large. Since the user is interested only in 'statistics' subkey, it is unnecessary to mae him download all the raw data as well.
parent 022a6598
No related branches found
No related tags found
No related merge requests found
...@@ -808,15 +808,10 @@ following keys: ...@@ -808,15 +808,10 @@ following keys:
* *Datatype:* ``list of dictionaries`` * *Datatype:* ``list of dictionaries``
``items``
* *Description:* This subkey is present in case search operation was triggered.
It contains a list of all statistical records, that were used to calculate
the final result in ``statistics`` subkey (see above).
* *Datatype:* ``list of dictionaries``
``items_count`` ``items_count``
* *Description:* This subkey is present in case search operation was triggered. * *Description:* This subkey is present in case search operation was triggered.
It contains the number of items in the result set ``items``. It contains the number of original datasets that have been processed to produce
final dataset ``statistics``.
* *Datatype:* ``integer`` * *Datatype:* ``integer``
``query_params`` ``query_params``
...@@ -837,11 +832,6 @@ following keys: ...@@ -837,11 +832,6 @@ following keys:
It is a simple indication of the successfull search operation. It is a simple indication of the successfull search operation.
* *Datatype:* ``boolean`` always set to ``True`` * *Datatype:* ``boolean`` always set to ``True``
``quicksearch_list``
* *Description:* This subkey is always present in the response. It is intended
for internal purposes.
* *Datatype:* ``list of dictionaries``
``search_widget_item_limit`` ``search_widget_item_limit``
* *Description:* This subkey is always present in the response. It is intended * *Description:* This subkey is always present in the response. It is intended
for internal purposes. for internal purposes.
......
...@@ -432,6 +432,17 @@ class APIDashboardView(AJAXMixin, AbstractDashboardView): # pylint: disable=loc ...@@ -432,6 +432,17 @@ class APIDashboardView(AJAXMixin, AbstractDashboardView): # pylint: disable=loc
"""*Implementation* of :py:func:`hawat.base.BaseView.get_view_name`.""" """*Implementation* of :py:func:`hawat.base.BaseView.get_view_name`."""
return 'apidashboard' return 'apidashboard'
def process_response_context(self):
"""*Implementation* of :py:func:`hawat.base.AJAXMixin.process_response_context`."""
super().process_response_context()
# Prevent certain response context keys to appear in final response.
for key in ('items', 'quicksearch_list'):
try:
del self.response_context[key]
except KeyError:
pass
return self.response_context
class APIMetadataView(AJAXMixin, SimpleView): class APIMetadataView(AJAXMixin, SimpleView):
""" """
......
...@@ -20,4 +20,4 @@ open-source project. ...@@ -20,4 +20,4 @@ open-source project.
__author__ = "Jan Mach <jan.mach@cesnet.cz>" __author__ = "Jan Mach <jan.mach@cesnet.cz>"
__credits__ = "Pavel Kácha <pavel.kacha@cesnet.cz>, Andrea Kropáčová <andrea.kropacova@cesnet.cz>" __credits__ = "Pavel Kácha <pavel.kacha@cesnet.cz>, Andrea Kropáčová <andrea.kropacova@cesnet.cz>"
__version__ = "2.5.5" __version__ = "2.5.6"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment