Add Tempmon Appliance views, menu link
also remove edit/delete restrictions for tempmon clients, probes. now we just let the normal permissions handle that
This commit is contained in:
parent
099fe14de1
commit
b044790d51
|
@ -151,6 +151,11 @@ def simple_menus(request):
|
||||||
'title': "TempMon",
|
'title': "TempMon",
|
||||||
'type': 'menu',
|
'type': 'menu',
|
||||||
'items': [
|
'items': [
|
||||||
|
{
|
||||||
|
'title': "Appliances",
|
||||||
|
'url': url('tempmon.appliances'),
|
||||||
|
'perm': 'tempmon.appliances.list',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'title': "Clients",
|
'title': "Clients",
|
||||||
'url': url('tempmon.clients'),
|
'url': url('tempmon.clients'),
|
||||||
|
|
|
@ -29,7 +29,7 @@ def includeme(config):
|
||||||
config.include('rattail_demo.web.views.settings')
|
config.include('rattail_demo.web.views.settings')
|
||||||
config.include('tailbone.views.stores')
|
config.include('tailbone.views.stores')
|
||||||
config.include('tailbone.views.subdepartments')
|
config.include('tailbone.views.subdepartments')
|
||||||
config.include('rattail_demo.web.views.tempmon')
|
config.include('tailbone.views.tempmon')
|
||||||
config.include('rattail_demo.web.views.upgrades')
|
config.include('rattail_demo.web.views.upgrades')
|
||||||
config.include('tailbone.views.users')
|
config.include('tailbone.views.users')
|
||||||
config.include('rattail_demo.web.views.vendors')
|
config.include('rattail_demo.web.views.vendors')
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
# -*- 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'
|
|
||||||
|
|
||||||
def restartable_client(self, client):
|
|
||||||
return client.config_key == 'demo'
|
|
||||||
|
|
||||||
def get_restart_cmd(self, client):
|
|
||||||
if self.rattail_config.production():
|
|
||||||
return ['ssh', 'demo.rattailproject.org', 'sudo service demo-tempmon-client restart']
|
|
||||||
# just mock it out when testing
|
|
||||||
return ['sleep', '2']
|
|
||||||
|
|
||||||
|
|
||||||
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