From 53f9aef51909090de859341c7dcf83d3531b4497 Mon Sep 17 00:00:00 2001 From: Andrew Melton Date: Wed, 10 Apr 2013 14:11:20 -0400 Subject: [PATCH] Adding count dropdown on Commands search --- stacktach/views.py | 3 ++- templates/index.html | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/stacktach/views.py b/stacktach/views.py index e308d70..ef81716 100644 --- a/stacktach/views.py +++ b/stacktach/views.py @@ -463,6 +463,7 @@ def search(request, deployment_id): column = request.POST.get('field', None) value = request.POST.get('value', None) updates = request.POST.get('updates', True) + count = request.POST.get('count', 20) if updates and updates == 'true': updates = True elif updates and updates == 'false': @@ -475,7 +476,7 @@ def search(request, deployment_id): rows = rows.filter(**{column: value}) if not updates: rows = rows.exclude(event='compute.instance.update') - rows = rows.order_by('-when')[:22] + rows = rows.order_by('-when')[:int(count)] _post_process_raw_data(rows) c['rows'] = rows c['allow_expansion'] = True diff --git a/templates/index.html b/templates/index.html index 55b0876..65a20ea 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,8 +17,12 @@ function search_form(deployment_id) { var field = $("#field").val(); var value = $("#query").val(); + var count = $("#count").val(); var updates = $("#updates").is(":checked") - var data = {'field':field, 'value':value, 'updates':updates}; + var data = {'field':field, + 'value':value, + 'updates':updates, + 'count':count}; $("#detail").load('/' + deployment_id + '/search/', data); return false; }; @@ -56,6 +60,12 @@ function search_form(deployment_id) Include Updates: +