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

Facts revamp with datatables. #357

Merged
merged 10 commits into from
Jun 10, 2017
Merged

Facts revamp with datatables. #357

merged 10 commits into from
Jun 10, 2017

Conversation

redref
Copy link
Contributor

@redref redref commented Feb 5, 2017

Like inventory, ordering by fact value is not possible for facts.

On /facts -

On /fact

  • push everything into datatables (AJAX) - which save much time in DOM parsing and keep interface responsive during loading time
  • make datatables JSON call to also feed C3.js chart data if chart enabled

On /node

  • switch to datatables
  • mutualize JSON call code with /fact backend endpoint

@coveralls
Copy link

coveralls commented Feb 5, 2017

Coverage Status

Coverage increased (+7.3%) to 76.504% when pulling ba135ba on redref:facts into 35486e8 on voxpupuli:master.

@redref
Copy link
Contributor Author

redref commented Feb 5, 2017

Port of #356 fix with the new template.

Add this case to the tests.

@coveralls
Copy link

Coverage Status

Coverage increased (+6.7%) to 75.931% when pulling 1ddeacb on redref:facts into 35486e8 on voxpupuli:master.

1 similar comment
@coveralls
Copy link

coveralls commented Feb 5, 2017

Coverage Status

Coverage increased (+6.7%) to 75.931% when pulling 1ddeacb on redref:facts into 35486e8 on voxpupuli:master.

@redref
Copy link
Contributor Author

redref commented Feb 5, 2017

On #356 subject.

Python3 returned me

    return sorted(map(_GroupTuple, groupby(sorted(value, key=expr), expr)))
TypeError: unorderable types: bool() < str()

Solved by adding a jinja2 filter used in a map before groupby.

@coveralls
Copy link

coveralls commented Feb 5, 2017

Coverage Status

Coverage increased (+7.4%) to 76.605% when pulling 4d522d8 on redref:facts into 35486e8 on voxpupuli:master.

@redref
Copy link
Contributor Author

redref commented Feb 15, 2017

Rebased.

@coveralls
Copy link

coveralls commented Feb 15, 2017

Coverage Status

Coverage increased (+7.2%) to 81.728% when pulling 31173ff on redref:facts into fd4051b on voxpupuli:master.

@coveralls
Copy link

coveralls commented Feb 15, 2017

Coverage Status

Coverage increased (+7.2%) to 81.728% when pulling 8e2d441 on redref:facts into fd4051b on voxpupuli:master.

@tux-o-matic
Copy link
Contributor

JSON is a first class citizen in Python, why choose to generate JSON in a template rather than pure Python code in the fact_ajax function?

@redref
Copy link
Contributor Author

redref commented Mar 23, 2017

Honestly, I don't know. Now that you said it, it really seems legit.

@mterzo
Copy link
Contributor

mterzo commented Mar 23, 2017

If the data isn't quite the same as you want in the client the template makes some sense.

@redref
Copy link
Contributor Author

redref commented Mar 23, 2017

No preference on my side. Let me know if you prefer me to amend those PR's or if you think we can postpone it to do all of these in one pass.

node for which this fact is known.

:param env: Searches for facts in this environment
:type env: :obj:`string`
:param fact: Find all facts with this name
:type fact: :obj:`string`
:param fact: Find all facts with this value
:type fact: :obj:`string`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc should reference the value parameter, not the fact parameter.

@corey-hammerton
Copy link
Contributor

In the long run if the python can directly output JSON data then that's far less code for this project to maintain.

redref added 4 commits March 23, 2017 22:35
Removed facts query to let only fact-names. facts query time grow pretty quickly with number of nodes. Drawback: no filter on environment (which seems acceptable)
Add testing about view and column repartition (broken in jinja2 2.9.X / inner loop variables).
Rework facts page (jinja 2.9 compliant)
Created a custom template_filter as in python3, the groupby filter cannot order Bool vs Str. Needed to push format before the groupby which is not currently possible in jinja.
@coveralls
Copy link

Coverage Status

Coverage increased (+7.7%) to 81.356% when pulling e39d8f0 on redref:facts into e76fdb5 on voxpupuli:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+7.7%) to 81.356% when pulling e39d8f0 on redref:facts into e76fdb5 on voxpupuli:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+7.2%) to 80.791% when pulling f02ea7a on redref:facts into e76fdb5 on voxpupuli:master.

@redref
Copy link
Contributor Author

redref commented Mar 23, 2017

Refactored JSON generation in python. It is cleaner than jinja for sure.

Also rebased on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+7.1%) to 80.737% when pulling c1fd33f on redref:facts into e76fdb5 on voxpupuli:master.

@coveralls
Copy link

coveralls commented Apr 3, 2017

Coverage Status

Coverage increased (+7.7%) to 81.303% when pulling d2c47df on redref:facts into e76fdb5 on voxpupuli:master.

@coveralls
Copy link

coveralls commented Jun 10, 2017

Coverage Status

Coverage increased (+3.2%) to 80.417% when pulling 7cd8908 on redref:facts into 26825ae on voxpupuli:master.

@mterzo mterzo merged commit 38b2a2f into voxpupuli:master Jun 10, 2017
@redref redref deleted the facts branch June 10, 2017 11:59
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.

5 participants