-
Notifications
You must be signed in to change notification settings - Fork 74
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
Views engine #383
Views engine #383
Conversation
The files contained in status/custom_*.py and status/templates/custom_* pemit to have a views engine, i.e. a customised form in where you can choose the data you need from Livestatus datasources/columns, arrange them how you like (sorting, filtering, stats) and feed this data to pre-defined templates or your own ones. The views can be represented with simple dictionaries, and are therefore stored through the userdata module. User-defined customised views are now possible within Adagios :)
* datatable: jquery plugin to render html tables into pageable/sortable/filterable tables. Simpler and more functional than datatables. * jquery-ui: contains the functions which permit DOM elements to me draggable. This is used in custom forms, where the user can re-order the colums, filters, etc.
This templates, through the help of jqplot, can display a pie chart representing data coming from aggregated Livestatus queries (with the "Stats:" clause).
Through OpenLayers.js, displays a map with red/green markers representing the state of all defined hosts. The IP addresses are mapped to GPS coordianates through GeoIP.
The files contained in status/custom_*.py and status/templates/custom_* pemit to have a views engine, i.e. a customised form in where you can choose the data you need from Livestatus datasources/columns, arrange them how you like (sorting, filtering, stats) and feed this data to pre-defined templates or your own ones. The views can be represented with simple dictionaries, and are therefore stored through the userdata module. User-defined customised views are now possible within Adagios :)
* datatable: jquery plugin to render html tables into pageable/sortable/filterable tables. Simpler and more functional than datatables. * jquery-ui: contains the functions which permit DOM elements to me draggable. This is used in custom forms, where the user can re-order the colums, filters, etc.
This templates, through the help of jqplot, can display a pie chart representing data coming from aggregated Livestatus queries (with the "Stats:" clause).
Through OpenLayers.js, displays a map with red/green markers representing the state of all defined hosts. The IP addresses are mapped to GPS coordianates through GeoIP.
…into feature-view-engine
Got it up and running. This is pretty sweet! Haven't looked through all the code yet, but the feature is awesome. Is it realistic to load a custom view via querystrings only (without saving it first) ? It would make unit testing easier. The pen-ultimate dream is to make all views in adagios use this engine 👍 |
Hey Pall, More on wednesday! |
Oh boy, 2860 files... Do we really need them all ? |
Alright, I'll update this on wednesday. |
This patch fixes an issue where custom_view cannot be loaded because an extra linebreak is sent with the livestatus query. I am guessing shinken's implementation of livestatus does not care about this.
If livestatus queries fail, return 500 error This should make unit testing of the view easier.
@palli About loading custom views via querystrings, it's not as trivial as I previously thought, because the datastructure used is too hierarchical, and it would add some dirty parsing and the use of special characters to have something working. For unit testing this, we can do it the same way as we do for the other user parameters, POST what we want like this: https://github.com/opinkerfi/adagios/blob/master/adagios/misc/tests.py#L97-L98 |
This is cool for wall projection (and for the future dashboard. Conflicts: adagios/status/templates/custom_views/templates/maps.html
The 'delete view' button is now on the edit page, rather than the view page.
I've addressed most of your issues, and added a few commits I had in another branch. |
Alright. Thanks. My only diff tool is github at the moment and it still has a problem because of number of files in the pull request, so i have minor problems with reviewing. I would want to take care of the javascript deps first, then the diff will be a little cleaner. Two questions at the moment:
Thanks :) |
Datatables: that's on purpose, yes. They actually are 2 different libraries (datatable and datatables), and I found datatable to be much more efficient at what I did in the template table.html. I definitely agree it would be better to only use one, but both of them are currently used. Jqplot is currently only used in pie_chart, but in the future it could be nice to have this kind of pie chart on the home page for instance. Do you like them? At least, I'll have a look if it's possible to use minified versions of these tools (datatable, jqplot, jquery-ui), in order not to ship everything :-) |
Alright, I've trimmed the javascript libraries, and rebased everything. |
Hi!
Here's my first shot for the views engine we talked about a few weeks ago.
From commit f4afe35:
"The files contained in status/custom_*.py and status/templates/custom_* permit to have a views engine, i.e. a customised form in where you can choose the data you need from Livestatus datasources/columns, arrange them how you like (sorting, filtering, stats) and feed this data to pre-defined templates or your own ones. The views can be represented with simple dictionaries, and are therefore stored through the userdata module."
To rapidly test this, create your own views (link in the left menu) and play with them, or use these predefined ones by adding this to your /etc/adagios/userdata/USER.json: http://fpaste.org/106649/01745996/ (there are 3 views, which use 3 different templates (table, openstreetmaps, and pie chart), so you'll have a good idea of what is doable with the engine).
This is a work in progress, but what is committed here is fully functional.
What I have on my roadmap (but let's go step-by-step):
Let me know your thoughts!