Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
399b45f6
authored
Jan 27, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: list groups, make group table
parent
fca3ac78
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
19 deletions
+110
-19
circle/dashboard/tables.py
+9
-0
circle/dashboard/templates/dashboard/group-list.html
+68
-0
circle/dashboard/templates/dashboard/index-groups.html
+19
-17
circle/dashboard/urls.py
+3
-1
circle/dashboard/views.py
+11
-1
No files found.
circle/dashboard/tables.py
View file @
399b45f6
from
django.contrib.auth.models
import
Group
from
django_tables2
import
Table
,
A
from
django_tables2
import
Table
,
A
from
django_tables2.columns
import
(
TemplateColumn
,
Column
,
BooleanColumn
,
from
django_tables2.columns
import
(
TemplateColumn
,
Column
,
BooleanColumn
,
LinkColumn
)
LinkColumn
)
...
@@ -101,6 +102,14 @@ class NodeListTable(Table):
...
@@ -101,6 +102,14 @@ class NodeListTable(Table):
'number_of_VMs'
,
)
'number_of_VMs'
,
)
class
GroupListTable
(
Table
):
class
Meta
:
model
=
Group
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover '
'group-list-table'
)}
fields
=
(
'id'
,
'name'
,
)
class
NodeVmListTable
(
Table
):
class
NodeVmListTable
(
Table
):
pk
=
TemplateColumn
(
pk
=
TemplateColumn
(
template_name
=
'dashboard/vm-list/column-id.html'
,
template_name
=
'dashboard/vm-list/column-id.html'
,
...
...
circle/dashboard/templates/dashboard/group-list.html
0 → 100644
View file @
399b45f6
{% extends "dashboard/base.html" %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% block content %}
<div
class=
"alert alert-info"
>
Tip #1: you can select multiple vm instances while holding down the
<strong>
CTRL
</strong>
key!
</div>
<div
class=
"alert alert-info"
>
Tip #2: if you want to select multiple instances by one click select an instance then hold down
<strong>
SHIFT
</strong>
key and select another one!
</div>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
><i
class=
"icon-desktop"
></i>
Your nodes
</h3>
</div>
<div
class=
"panel-body node-list-group-control"
>
<p>
<strong>
Group actions
</strong>
<button
id=
"node-list-group-select-all"
class=
"btn btn-info btn-xs"
>
Select all
</button>
<a
class=
"btn btn-default btn-xs"
id=
"node-list-group-migrate"
disabled
><i
class=
"icon-truck"
></i>
Migrate
</a>
<a
disabled
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-refresh"
></i>
Reboot
</a>
<a
disabled
href=
"#"
class=
"btn btn-default btn-xs"
><i
class=
"icon-off"
></i>
Shutdown
</a>
<a
id=
"node-list-group-delete"
disabled
href=
"#"
class=
"btn btn-danger btn-xs"
><i
class=
"icon-remove"
></i>
Discard
</a>
</p>
</div>
<div
id=
"table_container"
>
<div
id=
"rendered_table"
class=
"panel-body"
>
{% render_table table %}
</div>
</div>
</div>
</div>
</div>
<style>
.popover
{
max-width
:
600px
;
}
.node-list-selected
,
.node-list-selected
td
{
background-color
:
#e8e8e8
!important
;
}
.node-list-selected
:hover
,
.node-list-selected
:hover
td
{
background-color
:
#d0d0d0
!important
;
}
.node-list-selected
td
:first-child
{
font-weight
:
bold
;
}
.node-list-table-thin
{
width
:
10px
;
}
.node-list-table-admin
{
width
:
130px
;
}
</style>
{% endblock %}
{% block extra_js %}
<script
src=
"{{ STATIC_URL}}dashboard/node-list.js"
></script>
{% endblock %}
circle/dashboard/templates/dashboard/index-groups.html
View file @
399b45f6
...
@@ -8,26 +8,28 @@
...
@@ -8,26 +8,28 @@
</h3>
</h3>
</div>
</div>
<div
class=
"list-group"
id=
"vm-list-view"
>
<div
class=
"list-group"
id=
"vm-list-view"
>
{% for i in groups %}
<a
href=
"#"
class=
"list-group-item"
>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-file"
></i>
ALMA
<div
class=
"pull-right"
><i
class=
"icon-download-alt "
></i></div>
<i
class=
"icon-file"
></i>
{{ i.name }}
<div
class=
"pull-right"
><i
class=
"icon-download-alt "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-file-text"
></i>
ALMA.docx
<div
class=
"pull-right"
><i
class=
"icon-download-alt "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-file-text"
></i>
ALMA.docx
<div
class=
"pull-right"
><i
class=
"icon-download-alt "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-file-text"
></i>
ALMA.docx
<div
class=
"pull-right"
><i
class=
"icon-download-alt "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-file-text"
></i>
ALMA.docx
<div
class=
"pull-right"
><i
class=
"icon-download-alt "
></i></div>
</a>
</a>
{% endfor %}
<div
href=
"#"
class=
"list-group-item list-group-footer text-right"
>
<div
href=
"#"
class=
"list-group-item list-group-footer text-right"
>
<p>
<div
class=
"row"
>
<a
class=
"btn btn-primary btn-xs"
><i
class=
"icon-chevron-sign-right"
></i>
show more
</a>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<a
class=
"btn btn-success btn-xs"
><i
class=
"icon-upload-alt"
></i>
upload
</a>
<input
type=
"text"
class=
"form-control"
placeholder=
"Search..."
/>
</p>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary"
title=
"search"
><i
class=
"icon-search"
></i></button>
</div>
</div>
<div
class=
"col-sm-6 text-right"
>
{% if more_groups >= 0 %}
<a
class=
"btn btn-primary btn-xs"
href=
"{% url "
dashboard
.
views
.
group-list
"
%}"
>
<i
class=
"icon-chevron-sign-right"
></i>
<strong>
{{ more_groups }}
</strong>
more
</a>
{% endif %}
<a
class=
"btn btn-success btn-xs group-create"
href=
"#"
><i
class=
"icon-upload-alt"
></i>
upload
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
circle/dashboard/urls.py
View file @
399b45f6
...
@@ -6,7 +6,7 @@ from .views import (
...
@@ -6,7 +6,7 @@ from .views import (
VmDelete
,
VmMassDelete
,
vm_activity
,
NodeList
,
NodeDetailView
,
PortDelete
,
VmDelete
,
VmMassDelete
,
vm_activity
,
NodeList
,
NodeDetailView
,
PortDelete
,
TransferOwnershipView
,
TransferOwnershipConfirmView
,
NodeDelete
,
TransferOwnershipView
,
TransferOwnershipConfirmView
,
NodeDelete
,
TemplateList
,
LeaseDetail
,
NodeCreate
,
LeaseCreate
,
TemplateCreate
,
TemplateList
,
LeaseDetail
,
NodeCreate
,
LeaseCreate
,
TemplateCreate
,
FavouriteView
,
NodeStatus
,
FavouriteView
,
NodeStatus
,
GroupList
,
)
)
urlpatterns
=
patterns
(
urlpatterns
=
patterns
(
...
@@ -51,4 +51,6 @@ urlpatterns = patterns(
...
@@ -51,4 +51,6 @@ urlpatterns = patterns(
name
=
'dashboard.views.node-create'
),
name
=
'dashboard.views.node-create'
),
url
(
r'^favourite/$'
,
FavouriteView
.
as_view
(),
url
(
r'^favourite/$'
,
FavouriteView
.
as_view
(),
name
=
'dashboard.views.favourite'
),
name
=
'dashboard.views.favourite'
),
url
(
r'^group/list/$'
,
GroupList
.
as_view
(),
name
=
'dashboard.views.group-list'
),
)
)
circle/dashboard/views.py
View file @
399b45f6
...
@@ -25,7 +25,7 @@ from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
...
@@ -25,7 +25,7 @@ from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
from
.forms
import
VmCreateForm
,
TemplateForm
,
LeaseForm
,
NodeForm
,
HostForm
from
.forms
import
VmCreateForm
,
TemplateForm
,
LeaseForm
,
NodeForm
,
HostForm
from
.tables
import
(
VmListTable
,
NodeListTable
,
NodeVmListTable
,
from
.tables
import
(
VmListTable
,
NodeListTable
,
NodeVmListTable
,
TemplateListTable
,
LeaseListTable
)
TemplateListTable
,
LeaseListTable
,
GroupListTable
)
from
vm.models
import
(
Instance
,
InstanceTemplate
,
InterfaceTemplate
,
from
vm.models
import
(
Instance
,
InstanceTemplate
,
InterfaceTemplate
,
InstanceActivity
,
Node
,
instance_activity
,
Lease
,
InstanceActivity
,
Node
,
instance_activity
,
Lease
,
Interface
)
Interface
)
...
@@ -76,9 +76,12 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -76,9 +76,12 @@ class IndexView(LoginRequiredMixin, TemplateView):
})
})
nodes
=
Node
.
objects
.
all
()
nodes
=
Node
.
objects
.
all
()
groups
=
Group
.
objects
.
all
()
context
.
update
({
context
.
update
({
'nodes'
:
nodes
[:
10
],
'nodes'
:
nodes
[:
10
],
'more_nodes'
:
nodes
.
count
()
-
len
(
nodes
[:
10
]),
'more_nodes'
:
nodes
.
count
()
-
len
(
nodes
[:
10
]),
'groups'
:
groups
[:
10
],
'more_groups'
:
groups
.
count
()
-
len
(
groups
[:
10
]),
'sum_node_num'
:
nodes
.
count
(),
'sum_node_num'
:
nodes
.
count
(),
'node_num'
:
{
'node_num'
:
{
'running'
:
Node
.
get_state_count
(
True
,
True
),
'running'
:
Node
.
get_state_count
(
True
,
True
),
...
@@ -567,6 +570,13 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
...
@@ -567,6 +570,13 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
table_pagination
=
False
table_pagination
=
False
class
GroupList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
template_name
=
"dashboard/group-list.html"
model
=
Group
table_class
=
GroupListTable
table_pagination
=
False
class
VmCreate
(
LoginRequiredMixin
,
TemplateView
):
class
VmCreate
(
LoginRequiredMixin
,
TemplateView
):
form_class
=
VmCreateForm
form_class
=
VmCreateForm
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment