Commit 39b34734 by Kálmán Viktor

dashboard: don't show in progress icon in vm list for a long list

Too many SQL queries
parent e52cd2ff
......@@ -617,3 +617,11 @@ function noJS() {
$('.no-js-hidden').show();
$('.js-hidden').hide();
}
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
......@@ -163,7 +163,7 @@ $(function() {
$(this).find('input[type="radio"]').prop("checked", true);
});
if(checkStatusUpdate()) {
if(checkStatusUpdate() || $("#vm-list-table tbody tr").length >= 100) {
updateStatuses(1);
}
......@@ -187,6 +187,7 @@ function checkStatusUpdate() {
function updateStatuses(runs) {
var include_deleted = getParameterByName("include_deleted");
$.get("/dashboard/vm/list/?compact", function(result) {
$("#vm-list-table tbody tr").each(function() {
vm = $(this).data("vm-pk");
......@@ -212,7 +213,8 @@ function updateStatuses(runs) {
$(this).find(".node").text(result[vm].node);
}
} else {
$(this).remove();
if(!include_deleted)
$(this).remove();
}
});
......
......@@ -79,7 +79,7 @@
<td class="name"><a class="real-link" href="{% url "dashboard.views.detail" i.pk %}">{{ i.name }}</a> </td>
<td class="state">
<i class="fa fa-fw
{% if i.is_in_status_change %}
{% if show_acts_in_progress and i.is_in_status_change %}
fa-spin fa-spinner
{% else %}
{{ i.get_status_icon }}{% endif %}"></i>
......
......@@ -1792,6 +1792,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
else:
context['ops'].append(v)
context['search_form'] = self.search_form
context['show_acts_in_progress'] = self.object_list.count() < 100
return context
def get(self, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment