Commit fd1eae32 by Oláh István Gergely

dashboard: add node index view

parent 2c033559
from django_tables2 import Table # A
from django_tables2.columns import TemplateColumn # LinkColumn
from django_tables2 import Table, A
from django_tables2.columns import LinkColumn, TemplateColumn, Column
from vm.models import Instance
from vm.models import Instance, Node
from django.utils.translation import ugettext_lazy as _
......@@ -40,3 +40,23 @@ class VmListTable(Table):
attrs = {'class': ('table table-bordered table-striped table-hover '
'vm-list-table')}
fields = ('pk', 'name', 'state', 'time_of_suspend', 'time_of_delete', )
class NodeListTable(Table):
pk = Column(
verbose_name="ID",
)
name = LinkColumn(
'dashboard.views.node-detail',
args=[A('pk')],
attrs={'a': {'class': 'real-link'}}
)
class Meta:
model = Node
attrs = {'class': ('table table-bordered table-striped table-hover '
'node-list-table')}
fields = ('pk', 'name', 'host' , 'enabled' , 'created' , 'modified' , 'priority' , 'overcommit' ,)
......@@ -3,7 +3,7 @@ from django.conf.urls import patterns, url
from vm.models import Instance
from .views import (
IndexView, VmDetailView, VmList, VmCreate, TemplateDetail, AclUpdateView,
VmDelete, VmMassDelete, vm_activity)
VmDelete, VmMassDelete, vm_activity, NodeList, NodeDetailView)
urlpatterns = patterns(
'',
......@@ -21,5 +21,9 @@ urlpatterns = patterns(
name="dashboard.views.delete-vm"),
url(r'^vm/mass-delete/', VmMassDelete.as_view(),
name='dashboard.view.mass-delete-vm'),
url(r'^vm/(?P<pk>\d+)/activity/$', vm_activity)
url(r'^vm/(?P<pk>\d+)/activity/$', vm_activity),
url(r'^node/list/$', NodeList.as_view(), name='dashboard.views.node-list'),
url(r'^node/(?P<pk>\d+)/$', NodeDetailView.as_view(),
name='dashboard.views.node-detail'),
)
......@@ -18,9 +18,9 @@ from django.utils.translation import ugettext as _
from django_tables2 import SingleTableView
from .tables import VmListTable
from .tables import (VmListTable, NodeListTable)
from vm.models import (Instance, InstanceTemplate, InterfaceTemplate,
InstanceActivity)
InstanceActivity, Node)
from firewall.models import Vlan
from storage.models import Disk
......@@ -276,6 +276,11 @@ class VmList(SingleTableView):
table_class = VmListTable
table_pagination = False
class NodeList(SingleTableView):
template_name = "dashboard/node-list.html"
model = Node
table_class = NodeListTable
table_pagination = False
class VmCreate(TemplateView):
......
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