Merge pull request #78 from ramielrowe/search_count
Include Updates Checkbox and Results Count Dropdown
This commit is contained in:
commit
80796cd50e
@ -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
|
||||
|
@ -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)
|
||||
<option selected='true'>instance
|
||||
</select>
|
||||
<input type='text' id='query' size='60' value=''/>
|
||||
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}});'/>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user