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

Merging views engine #439

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

Conversation

titilambert
Copy link
Contributor

Hello !
I rebased PR #391.
This PR doesn't include the possibility to use external commands (rescheduled, ask, ...). I will add this feature in other PR when this one will be merged.

@matthieucan could you confirm or not this ?
In adagios/status/templates/custom_views/widgets/link_host.html
The current line :

<a href="{% url "status.views.detail" %}?host_name={{ value }}&backend={{ line.backend }}">{{ line|hash:col_name }}</a>

Should be

<a href="{% url "status.views.detail" %}?host_name={{ line|hash:col_name }}&backend={{ line.backend }}">{{ line|hash:col_name }}</a>

Thanks !

matthieucan and others added 30 commits July 2, 2014 12:10
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.
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.
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.
Conflicts:
	adagios/templates/base.html
@titilambert
Copy link
Contributor Author

@matthieucan do you have any idea about the build failed ? It happens only with django < 1.5 ...

@matthieucan
Copy link
Contributor

For the changed line: yes, I confirm you're right, 'col_name' and 'line' are passed as arguments to the widgets.

For the build fail: definitely a feature somewhere in custom_*.py, which is not in Django 1.4. Are you able to reproduce the bug locally? It should point you to the correct line.

@titilambert
Copy link
Contributor Author

I get this error :

UnpicklingError at /status/custom/edit
invalid load key, '{'.
Request Method: GET
Request URL:    http://127.0.0.1:8000/status/custom/edit?datasource=hosts
Django Version: 1.4.15
Exception Type: UnpicklingError
Exception Value:    
invalid load key, '{'.
Exception Location: /home/titilambert/projets_opensource/adagios/env/local/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.py in loads, line 21
Python Executable:  /home/titilambert/projets_opensource/adagios/env/bin/python
Python Version: 2.7.8
Python Path:    
['/home/titilambert/projets_opensource/adagios/adagios/..',
 '/home/titilambert/projets_opensource/adagios/adagios',
 '/home/titilambert/projets_opensource/adagios/env/lib/python2.7',
 '/home/titilambert/projets_opensource/adagios/env/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/titilambert/projets_opensource/adagios/env/lib/python2.7/lib-tk',
 '/home/titilambert/projets_opensource/adagios/env/lib/python2.7/lib-old',
 '/home/titilambert/projets_opensource/adagios/env/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/titilambert/projets_opensource/adagios/env/local/lib/python2.7/site-packages',
 '/home/titilambert/projets_opensource/adagios/env/lib/python2.7/site-packages']
Server time:    Tue, 21 Oct 2014 09:12:47 -0400

The error is here (env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.py):

    def loads(self, data):
        return pickle.loads(data)

With
data => {"django_language":"en"}
type(data) => <type 'str'>

@matthieucan
Copy link
Contributor

No idea... don't you have a stack trace?

@tomas-edwardsson
Copy link
Contributor

@titilambert we switched from using file backed session cookies to using Signed Cookies. You should remove any cookies when moving between pre-django16 and django16 based code.

@titilambert
Copy link
Contributor Author

@matthieucan did this help you ?

@matthieucan
Copy link
Contributor

@titilambert Unless I'm mistaken, no cookies are used in the views engine. Can this be a problem within travis-ci?

@titilambert
Copy link
Contributor Author

FIXED !!!!
@matthieucan I fixed some javascript calls. Could you valid this ?

Thanks !

@matthieucan
Copy link
Contributor

@titilambert This looks good! I don't have any environment to test it right now, but if it works with you, that's perfect!

@titilambert
Copy link
Contributor Author

@palli @tomas-edwardsson it is correct for you ?
Thank !

@titilambert
Copy link
Contributor Author

Any news about it ? thank

@palli
Copy link
Contributor

palli commented Dec 3, 2014

So, I am seeing a few problems with this patch, which have made me hesitant to merge it in. I think maybe we should discuss this a little more on our meeting tomorrow. Here are a few comments from the top of my head:

  • It is still very big. Not a lot to be done about that now, but as a reminder for next time, maybe we should aim for getting a minimal working copy first, and then add on complexities
  • Can we do this without datatable and jquery-ui dependencies? (We already have datatables, and we moved from jquery-ui in version 1.0)
  • For me, applying the branch caused unhandled traceback on all adagios views because of unsafe code added to the context processors. Is it possible to do this without context processors ?
  • The custom views backend code, is about the same size as the status app.. Please make it is own django app, called 'custom views'.

Are you guys still using this extension and/or actively developing it ?

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.

4 participants