diff --git a/stacktach/views.py b/stacktach/views.py index bbd4c8a..ef81716 100644 --- a/stacktach/views.py +++ b/stacktach/views.py @@ -462,13 +462,21 @@ 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) + count = request.POST.get('count', 20) + 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')[: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 6cb7e46..65a20ea 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,7 +17,12 @@ function search_form(deployment_id) { var field = $("#field").val(); var value = $("#query").val(); - var data = {'field':field, 'value':value}; + var count = $("#count").val(); + var updates = $("#updates").is(":checked") + var data = {'field':field, + 'value':value, + 'updates':updates, + 'count':count}; $("#detail").load('/' + deployment_id + '/search/', data); return false; }; @@ -54,6 +59,13 @@ function search_form(deployment_id)