Commit 3e6ca4e7 by Oláh István Gergely

dashboard: add get to nodelist - blank text to icon/status

parent c638d635
...@@ -925,6 +925,22 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView): ...@@ -925,6 +925,22 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
table_class = NodeListTable table_class = NodeListTable
table_pagination = False table_pagination = False
def get(self, *args, **kwargs):
if self.request.is_ajax():
nodes = Node.objects.all()
nodes = [{
'pk': i.pk,
'name': i.name,
'icon': '',
'status': ''} for i in nodes]
return HttpResponse(
json.dumps(list(nodes)), # instances is ValuesQuerySet
content_type="application/json",
)
else:
return super(NodeList, self).get(*args, **kwargs)
def get_queryset(self): def get_queryset(self):
return Node.objects.annotate( return Node.objects.annotate(
number_of_VMs=Count('instance_set')).select_related('host') number_of_VMs=Count('instance_set')).select_related('host')
......
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