diff --git a/enabled/_50_admin_add_monitoring_panel.py b/enabled/_50_admin_add_monitoring_panel.py index fd342afc..f2b3cfc2 100644 --- a/enabled/_50_admin_add_monitoring_panel.py +++ b/enabled/_50_admin_add_monitoring_panel.py @@ -16,4 +16,3 @@ ADD_INSTALLED_APPS = ['monitoring'] # A list of angular modules to be added as dependencies to horizon app. #ADD_ANGULAR_MODULE = ['monitoringApp'] - diff --git a/monitoring/api/monitor.py b/monitoring/api/monitor.py index ffeef8a3..6fdc39fd 100644 --- a/monitoring/api/monitor.py +++ b/monitoring/api/monitor.py @@ -55,13 +55,16 @@ def monclient(request, password=None): def alarm_list(request, marker=None, paginate=False): return monclient(request).alarms.list() + def alarm_list_by_service(request, service_name, marker=None, paginate=False): - service_dim = {'service' : service_name} + service_dim = {'service': service_name} return monclient(request).alarms.list(dimensions=service_dim) + def alarm_delete(request, alarm_id): return monclient(request).alarms.delete(alarm_id=alarm_id) + def alarm_get(request, alarm_id): return monclient(request).alarms.get(alarm_id=alarm_id) @@ -83,7 +86,8 @@ def notification_delete(request, notification_id): def notification_get(request, notification_id): - return monclient(request).notifications.get(notification_id=notification_id) + return monclient(request).notifications. \ + get(notification_id=notification_id) def notification_create(request, **kwargs): @@ -96,5 +100,3 @@ def notification_update(request, notification_id, **kwargs): def metrics_list(request, marker=None, paginate=False): return monclient(request).metrics.list() - - diff --git a/monitoring/constants.py b/monitoring/constants.py index bf3a12fc..ec15771c 100644 --- a/monitoring/constants.py +++ b/monitoring/constants.py @@ -31,8 +31,7 @@ class NotificationType(object): if choice[0] == key: return choice[1] return key - -OVERCLOUD_SERVICES = ["Nova","Swift","Cinder","Glance","Neutron","MySQL","RabbitMQ","Monitoring"] +ß PHONE_VALIDATOR = validators.RegexValidator( regex=r"^\+[()0-9 ]{5,20}$", diff --git a/monitoring/forms.py b/monitoring/forms.py index 31c6d59d..a3670671 100644 --- a/monitoring/forms.py +++ b/monitoring/forms.py @@ -26,6 +26,7 @@ from horizon import messages from monitoring import api from monitoring import constants + def get_expression(meter): expr = meter['name'] args = None @@ -38,12 +39,14 @@ def get_expression(meter): args += "%s=%s" % (name, value) return "%s{%s}" % (expr, args) + class SimpleExpressionWidget(django_forms.MultiWidget): def __init__(self, meters=None, attrs=None): choices = [(get_expression(m), get_expression(m)) for m in meters] + comparators = [('>', '>'), ('<', '<'), ('=', '=')] _widgets = ( django_forms.widgets.Select(attrs=attrs, choices=choices), - django_forms.widgets.Select(attrs=attrs, choices=[('>', '>'), ('<', '<'), ('=', '=')]), + django_forms.widgets.Select(attrs=attrs, choices=comparatorsß), django_forms.widgets.TextInput(attrs=attrs), ) super(SimpleExpressionWidget, self).__init__(_widgets, attrs) @@ -129,7 +132,7 @@ class NotificationCreateWidget(forms.Select): for notification in value: output += '' output += ('