From 47b3cc0349f1431d800710038a5f5de287af528b Mon Sep 17 00:00:00 2001 From: Andrew Melton Date: Wed, 10 Apr 2013 13:43:13 -0400 Subject: [PATCH 1/2] Include Updates checkbox on Commands search --- stacktach/views.py | 15 +++++++++++---- templates/index.html | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/stacktach/views.py b/stacktach/views.py index bbd4c8a..e308d70 100644 --- a/stacktach/views.py +++ b/stacktach/views.py @@ -462,13 +462,20 @@ def search(request, deployment_id): c = _default_context(request, deployment_id) column = request.POST.get('field', None) value = request.POST.get('value', None) + updates = request.POST.get('updates', True) + if updates and updates == 'true': + updates = True + elif updates and updates == 'false': + updates = False rows = None if column != None and value != None: rows = models.RawData.objects.select_related() - if deployment_id: - row = rows.filter(deployment=deployment_id) - rows = rows.filter(**{column:value}). \ - order_by('-when')[:22] + if deployment_id and int(deployment_id) != 0: + rows = rows.filter(deployment=deployment_id) + rows = rows.filter(**{column: value}) + if not updates: + rows = rows.exclude(event='compute.instance.update') + rows = rows.order_by('-when')[:22] _post_process_raw_data(rows) c['rows'] = rows c['allow_expansion'] = True diff --git a/templates/index.html b/templates/index.html index 6cb7e46..55b0876 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,7 +17,8 @@ function search_form(deployment_id) { var field = $("#field").val(); var value = $("#query").val(); - var data = {'field':field, 'value':value}; + var updates = $("#updates").is(":checked") + var data = {'field':field, 'value':value, 'updates':updates}; $("#detail").load('/' + deployment_id + '/search/', data); return false; }; @@ -54,6 +55,7 @@ function search_form(deployment_id)