Hard code tenant id. Place framework for list meters.

This commit is contained in:
Rob Raymond 2014-05-27 11:16:05 -06:00
parent 3f26b5065c
commit 778cb86b08
2 changed files with 10 additions and 4 deletions

View File

@ -36,7 +36,7 @@ def monclient(request, password=None):
LOG.debug('monclient connection created using token "%s" and url "%s"' %
(request.user.token.id, endpoint))
kwargs = {
'token': request.user.token.id,
'token': '82510970543135', # request.user.token.id,
'insecure': insecure,
'ca_file': cacert,
'username': request.user.username,
@ -92,3 +92,8 @@ def notification_create(request, **kwargs):
def notification_update(request, notification_id, **kwargs):
return monclient(request).notifications.update(notification_id, **kwargs)
def metrics_list(request, marker=None, paginate=False):
return monclient(request).metrics.list()

View File

@ -110,18 +110,18 @@ class NotificationCreateWidget(forms.Select):
return format_html(output)
def value_from_datadict(self, data, files, name):
notificatons = []
notifications = []
i = 0
while True:
i += 1
notification_id = "%s_%d" % (name, i)
if notification_id in data:
if len(data[notification_id]) > 0:
notificatons.append({"notification_id":
notifications.append({"notification_id":
data[notification_id]})
else:
break
return notificatons
return notifications
class BaseAlarmForm(forms.SelfHandlingForm):
@ -154,6 +154,7 @@ class BaseAlarmForm(forms.SelfHandlingForm):
required=required,
max_length=250,
widget=textWidget)
meters = api.monitor.metrics_list(self.request)
self.fields['expression'] = forms.CharField(label=_("Expression"),
required=required,
widget=textAreaWidget)