Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asynchronous stats/browsing data retrieval #74

Merged
merged 4 commits into from
Nov 3, 2016

Conversation

julen
Copy link
Contributor

@julen julen commented Nov 3, 2016

This PR fixes the data format the internal API endpoint returns to match the new format we are using since the move to rendering the browsing tables in React.

In order to share the code that shapes the data, it reuses the path-based view dispatching from #73. This means now the internal endpoint doesn't only return stats, but also browsing data as used by the client. This will become very useful when implement browsing without page reloads.

The the structure stats are returned from the cache via TreeItem has been simplified to a list too.

Fixes #62.

This was originally a dictionary because the keys were used to query the DOM by
code. With the new table, feeding data is enough.

Note when calculating the browsing UI data, we take advantage of the fact that
children items and stats' items are sorted lists so we can safely combine them,
with no need to query a data source by key.
@julen julen force-pushed the issue/62-fix-get-stats branch 2 times, most recently from 1d4e05d to 6fe6891 Compare November 3, 2016 01:16
This will be useful for returning exactly the same browsing data from JSON
views.
@julen
Copy link
Contributor Author

julen commented Nov 3, 2016

It would be cool if you could verify this on your end @iafan; in my tests all behaves as expected. Also, speaking of tests, I am xfailing the old get_stats tests while we await on #45.

@iafan
Copy link
Contributor

iafan commented Nov 3, 2016

Did a quick check in the UI: JS errors are gone, XHR calls receive data in the proper format. Let's land it.

@julen julen force-pushed the issue/62-fix-get-stats branch from 6fe6891 to a68d671 Compare November 3, 2016 10:26
julen added 2 commits November 3, 2016 11:27
Previously, cached data from Redis would be used as-is in views. This was the
case both in the browsing view and the internal API endpoint to retrieve stats,
which would be consumed by the client code directly.

With the recent changes in the browsing pages, we changed the shape of the data
used by the client, but we didn't adjust the internal asynchronous endpoint that
retrieves updated stats when these are dirty.

This commit not only fixes that inconsistency, but also enables the endpoint to
return browsing-related data, not only stats. This data will be the same as the
data provided in templates' context.

Fixes serge-community#62.
@julen julen merged commit a68d671 into serge-community:master Nov 3, 2016
@julen julen deleted the issue/62-fix-get-stats branch November 3, 2016 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

views.get_stats returns data in an old format
2 participants