Adding count dropdown on Commands search

This commit is contained in:
Andrew Melton 2013-04-10 14:11:20 -04:00
parent 47b3cc0349
commit 53f9aef519
2 changed files with 13 additions and 2 deletions

View File

@ -463,6 +463,7 @@ def search(request, deployment_id):
column = request.POST.get('field', None) column = request.POST.get('field', None)
value = request.POST.get('value', None) value = request.POST.get('value', None)
updates = request.POST.get('updates', True) updates = request.POST.get('updates', True)
count = request.POST.get('count', 20)
if updates and updates == 'true': if updates and updates == 'true':
updates = True updates = True
elif updates and updates == 'false': elif updates and updates == 'false':
@ -475,7 +476,7 @@ def search(request, deployment_id):
rows = rows.filter(**{column: value}) rows = rows.filter(**{column: value})
if not updates: if not updates:
rows = rows.exclude(event='compute.instance.update') 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) _post_process_raw_data(rows)
c['rows'] = rows c['rows'] = rows
c['allow_expansion'] = True c['allow_expansion'] = True

View File

@ -17,8 +17,12 @@ function search_form(deployment_id)
{ {
var field = $("#field").val(); var field = $("#field").val();
var value = $("#query").val(); var value = $("#query").val();
var count = $("#count").val();
var updates = $("#updates").is(":checked") 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); $("#detail").load('/' + deployment_id + '/search/', data);
return false; return false;
}; };
@ -56,6 +60,12 @@ function search_form(deployment_id)
</select> </select>
<input type='text' id='query' size='60' value=''/> <input type='text' id='query' size='60' value=''/>
Include Updates: <input type='checkbox' id="updates" checked /> Include Updates: <input type='checkbox' id="updates" checked />
<select id='count'>
<option>10
<option selected>20
<option>50
<option>100
</select>
<input type='submit' value='Search' onclick='return search_form({{deployment_id}});'/> <input type='submit' value='Search' onclick='return search_form({{deployment_id}});'/>
</form> </form>
</div> </div>