mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
Add search in table
This commit is contained in:
parent
5f6b06b467
commit
1e91fb303f
3 changed files with 43 additions and 5 deletions
|
@ -79,3 +79,7 @@ body {
|
||||||
.ace_editor {
|
.ace_editor {
|
||||||
height: 350px;
|
height: 350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
|
@ -19,6 +19,9 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
<div class="pull-right search">
|
||||||
|
<input id="filter" class="form-control" type="text" placeholder="Search">
|
||||||
|
</div>
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -31,7 +34,7 @@
|
||||||
<th data-sortable="false" style="width: 165px;">Actions</th>
|
<th data-sortable="false" style="width: 165px;">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody class="searchable">
|
||||||
{% for host, inst in all_host_vms.items %}
|
{% for host, inst in all_host_vms.items %}
|
||||||
{% for vm, info in inst.items %}
|
{% for vm, info in inst.items %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -105,6 +108,9 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
<div class="pull-right search">
|
||||||
|
<input id="filter" class="form-control" type="text" placeholder="Search">
|
||||||
|
</div>
|
||||||
<table class="table table-hover table-striped">
|
<table class="table table-hover table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -115,8 +121,7 @@
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody class="searchable">
|
||||||
|
|
||||||
{% for host, vm in all_user_vms.items %}
|
{% for host, vm in all_user_vms.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'instance' host.0 vm.name %}">{{ vm.name }}</a></td>
|
<td><a href="{% url 'instance' host.0 vm.name %}">{{ vm.name }}</a></td>
|
||||||
|
@ -205,4 +210,17 @@
|
||||||
window.location = "/create/" + compute + "/";
|
window.location = "/create/" + compute + "/";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
(function ($) {
|
||||||
|
$('#filter').keyup(function () {
|
||||||
|
var rex = new RegExp($(this).val(), 'i');
|
||||||
|
$('.searchable tr').hide();
|
||||||
|
$('.searchable tr').filter(function () {
|
||||||
|
return rex.test($(this).text());
|
||||||
|
}).show();
|
||||||
|
})
|
||||||
|
}(jQuery));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -80,7 +80,10 @@
|
||||||
<h3 class="page-header">{% trans "Volumes" %}</h3>
|
<h3 class="page-header">{% trans "Volumes" %}</h3>
|
||||||
{% if volumes %}
|
{% if volumes %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-bordered sortable-theme-bootstrap" data-sortable>
|
<div class="pull-right search">
|
||||||
|
<input id="filter" class="form-control" type="text" placeholder="Search">
|
||||||
|
</div>
|
||||||
|
<table class="table table-striped sortable-theme-bootstrap" data-sortable>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:35px;">#</th>
|
<th style="width:35px;">#</th>
|
||||||
|
@ -90,7 +93,7 @@
|
||||||
<th data-sortable="false" colspan="2">{% trans "Action" %}</th>
|
<th data-sortable="false" colspan="2">{% trans "Action" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody class="searchable">
|
||||||
{% for volume in volumes %}
|
{% for volume in volumes %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ forloop.counter }}</td>
|
<td>{{ forloop.counter }}</td>
|
||||||
|
@ -202,4 +205,17 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
(function ($) {
|
||||||
|
$('#filter').keyup(function () {
|
||||||
|
var rex = new RegExp($(this).val(), 'i');
|
||||||
|
$('.searchable tr').hide();
|
||||||
|
$('.searchable tr').filter(function () {
|
||||||
|
return rex.test($(this).text());
|
||||||
|
}).show();
|
||||||
|
})
|
||||||
|
}(jQuery));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue