Commit db39311c by Őry Máté

dashboard: improve node list performance

parent 36538eb0
{% load i18n %}
<div id="node-list-column-vm">
<a class="real-link" href="{% url "dashboard.views.node-detail" %}#virtualmachines">{{ record.instance_set.count }}</a>
<a class="real-link" href="{% url "dashboard.views.node-detail" %}#virtualmachines">{{ value }}</a>
......@@ -14,6 +14,7 @@ from django.core.exceptions import (
from django.core import signing
from django.core.urlresolvers import reverse, reverse_lazy
from django.db.models import Count
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import redirect, render, get_object_or_404
from django.views.decorators.http import require_GET
......@@ -921,10 +922,13 @@ class VmList(LoginRequiredMixin, SingleTableView):
class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
template_name = "dashboard/node-list.html"
model = Node
table_class = NodeListTable
table_pagination = False
def get_queryset(self):
return Node.objects.annotate(
class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
template_name = "dashboard/group-list.html"
......@@ -305,7 +305,8 @@ class Node(TimeStampedModel):
def get_state_count(cls, online, enabled):
return len([1 for i in cls.objects.filter(enabled=enabled).all()
return len([1 for i in
if == online])
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