Add support for tempmon views
This commit is contained in:
parent
94993cf553
commit
50509f8f52
|
@ -73,6 +73,23 @@
|
|||
</li>
|
||||
% endif
|
||||
|
||||
% if request.has_any_perm('tempmon.clients.list', 'tempmon.probes.list', 'tempmon.readings.list'):
|
||||
<li>
|
||||
<a>TempMon</a>
|
||||
<ul>
|
||||
% if request.has_perm('tempmon.clients.list'):
|
||||
<li>${h.link_to("Clients", url('tempmon.clients'))}</li>
|
||||
% endif
|
||||
% if request.has_perm('tempmon.probes.list'):
|
||||
<li>${h.link_to("Probes", url('tempmon.probes'))}</li>
|
||||
% endif
|
||||
% if request.has_perm('tempmon.readings.list'):
|
||||
<li>${h.link_to("Readings", url('tempmon.readings'))}</li>
|
||||
% endif
|
||||
</ul>
|
||||
</li>
|
||||
% endif
|
||||
|
||||
% if request.has_any_perm('users.list', 'roles.list', 'settings.list'):
|
||||
<li>
|
||||
<a>Admin</a>
|
||||
|
|
|
@ -42,6 +42,7 @@ def includeme(config):
|
|||
config.include('tailbone.views.settings')
|
||||
config.include('tailbone.views.stores')
|
||||
config.include('tailbone.views.subdepartments')
|
||||
config.include('rattail_demo.web.views.tempmon')
|
||||
config.include('rattail_demo.web.views.users')
|
||||
config.include('tailbone.views.vendors')
|
||||
|
||||
|
|
39
rattail_demo/web/views/tempmon.py
Normal file
39
rattail_demo/web/views/tempmon.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Tempmon views
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
from tailbone.views.tempmon.clients import TempmonClientView as BaseTempmonClientView
|
||||
from tailbone.views.tempmon.probes import TempmonProbeView as BaseTempmonProbeView
|
||||
|
||||
|
||||
class TempmonClientView(BaseTempmonClientView):
|
||||
"""
|
||||
Prevent edit/delete for 'demo' client
|
||||
"""
|
||||
|
||||
def editable_instance(self, client):
|
||||
return client.config_key != 'demo'
|
||||
|
||||
def deletable_instance(self, client):
|
||||
return client.config_key != 'demo'
|
||||
|
||||
|
||||
class TempmonProbeView(BaseTempmonProbeView):
|
||||
"""
|
||||
Prevent edit/delete for 'demo' probe
|
||||
"""
|
||||
|
||||
def editable_instance(self, probe):
|
||||
return probe.config_key != 'demo'
|
||||
|
||||
def deletable_instance(self, probe):
|
||||
return probe.config_key != 'demo'
|
||||
|
||||
|
||||
def includeme(config):
|
||||
TempmonClientView.defaults(config)
|
||||
TempmonProbeView.defaults(config)
|
||||
config.include('tailbone.views.tempmon.readings')
|
Loading…
Reference in a new issue