-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
puppetboard: Adding PuppetDB 3.x support #176
Conversation
Some excerpts from CHANGELOG.rst include: - Increasing the pypuppetdb requirements from 0.1.x to 0.2.x - The Reports page now lists reports from the reports endpoint instead of a link to a PuppetDB issue with a feature request - Adding a Catalogs page to view either individual node catalogs or compare them against other nodes - New environment awareness adds a new query parameter to all applicable endpoints to filter results based on the current environment. If the default environment 'production' is not available, or any other unavailable environment, the user is redirected to the first known environment. - Adding pagination functionality for reports (for now) based on the value of the REPORTS_COUNT configuration option (used for the limit and the offset calculation). Implementation also makes it possible for other UI enhancements. - Removing the limit_reports function from puppetboard/utils.py since paging parameters are now accepted by the pypuppetdb endpoint functions. - Bumping the version to 0.1.0
$('#switch_env').change(function() { | ||
path = location.pathname.split('/'); | ||
path[1] = $(this).find(':selected').text(); | ||
location.assign(path.join('/')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer a bootstrap-like dropdown in the navbar with the hyperlinks directly setup. Am planning on (re-)implementing bootstrap after the 0.1.0 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semantic-UI supports dropdown in many places just fine. It'd be nice to have 1 framework that we use though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome @daenney, I would still like to work on bootstrap to have the added benefit of being mobile friendly. But then again I don't know Semantic UI that well either...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing again. Semantic UI is perfectly mobile friendly though we're on a pretty old version as it currently stands. Feel free to change it around though but do stick to 1 framework for everything, otherwise it becomes unnecessarily complex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
Make Puppetboard work with the PuppetDB V4 api This PR just enables the basic functionality of PuppetBoard with the new PyPuppetDB version. #176 includes this work as well as other work to make better utilization of the new library
This PR also includes #161, after I iron out the issues with that I will include those changes here since this PR affects PuppetDB queries and template rendering. |
https://github.com/corey-hammerton/puppetboard/commit/b4f74e240dd97ca5f4d5cf06a19eeab0c6eeec5e Making catalog tables searchable https://github.com/corey-hammerton/puppetboard/commit/7a8ddde6caa5b77a1cf3596e347dd492ebf5997b Navbar style/naming simplifications https://github.com/corey-hammerton/puppetboard/commit/e8fea997fd9e867bf9c97724ecbce9754185a720 Creating Semantic UI Menu for environment switching instead of select menu
Removing the environment switching point in the Known Issues section that has been dealt with.
Tonight or Saturday I will fix these merge conflicts then we can have this PR merged. After that I can remove the footer and maybe one or 2 more things then release 0.1.0. Cool? |
Fixing merge conflicts Conflicts: puppetboard/app.py puppetboard/forms.py puppetboard/templates/catalogs.html
If there are no more objections I will merge this PR either tonight or tomorrow. |
envs = environments() | ||
|
||
if env not in envs: | ||
return redirect(url_for_environments(envs[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should give a 404 imho. You're requesting an environment that's not there. Just blindly redirecting to the first entry in envs
is surprising.
envs = environments() | ||
|
||
if env not in envs: | ||
return redirect(url_for_environments(envs[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Considering this line of code appears a whopping 16 times: env = environments()
if env not in envs:
return redirect(url_for_environments(envs[0])) Extract that into a function that does the correct thing and just call that one function. That keeps the functionality in one place so updating the behaviour will be correctly reflected by everything that uses it. |
Despite some of the caveats and frustrations I love code/peer reviews 😛 |
…nd checking Moving the envs variable out of the functions scope to the global scope, this enables each function to reference and use these values. Adding a new function check_env() to standardize the way to ensure that the request environment exists, if it doesn't then abort with a 404. This reduces 16 blocks of code and is in line with @daenney's suggestions
Those 16 blocks of environment code have been replaced with a global scope |
👍 |
@daenney If all is well now I would like to merge this PR tonight so that we can hopefully release PuppetBoard 0.1.0. |
👍 looking forward! |
puppetboard: Adding PuppetDB 3.x support Some of the implementations here is: - Environment Awareness with a dropdown menu to switch environments - First implementation of pagination in the form of a macro for flexibility - Use of the PuppetDB 3.x APIs, therefore PuppetDB 2.x compatibility is broken
Some excerpts from CHANGELOG.rst include:
a link to a PuppetDB issue with a feature request
them against other nodes
endpoints to filter results based on the current environment. If the
default environment 'production' is not available, or any other unavailable
environment, the user is redirected to the first known environment.
the REPORTS_COUNT configuration option (used for the limit and the offset
calculation). Implementation also makes it possible for other UI enhancements.
parameters are now accepted by the pypuppetdb endpoint functions.