Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
56a98145
authored
Nov 05, 2017
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add a box to dashboard which lists user networks
parent
74467caa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
circle/dashboard/templates/dashboard/index-vxlans.html
+44
-0
circle/dashboard/templates/dashboard/index.html
+6
-0
circle/dashboard/views/index.py
+7
-0
No files found.
circle/dashboard/templates/dashboard/index-vxlans.html
0 → 100644
View file @
56a98145
{% load i18n %}
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<span
class=
"btn btn-default btn-xs infobtn pull-right"
data-container=
"body"
title=
"{% trans "
List
of
virtual
networks
that
are
available
for
you
."
%}"
>
<i
class=
"fa fa-info-circle"
></i>
</span>
<h3
class=
"no-margin"
><i
class=
"fa fa-globe"
></i>
{% trans "Virtual networks" %}
</h3>
</div>
<div
class=
"list-group"
id=
"vxlan-list-view"
>
<div
id=
"dashboard-user-list"
>
{% for vxlan in vxlans %}
<a
href=
"{% url "
network
.
vxlan
"
vni=
vxlan.vni
%}"
class=
"list-group-item
{% if forloop.last and vxlan|length < 5 %} list-group-item-last{% endif %}"
>
<span
class=
"index-template-list-name"
>
<i
class=
"fa fa-sitemap"
></i>
{{ vxlan.name }}
</span>
</a>
{% endfor %}
</div>
<div
class=
"list-group-item list-group-footer"
>
<div
class=
"row"
>
<div
class=
"col-xs-5 col-sm-6"
>
<form
action=
"{% url "
network
.
vxlan-list
"
%}"
method=
"GET"
id=
"dashboard-vxlan-search-form"
>
<div
class=
"input-group input-group-sm"
>
<input
name=
"s"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"btn btn-primary"
><i
class=
"fa fa-search"
></i></button>
</div>
</div>
</form>
</div>
<div
class=
"col-xs-7 col-sm-6 text-right"
>
<a
href=
"{% url "
network
.
vxlan-list
"
%}"
class=
"btn btn-primary btn-xs"
>
<i
class=
"fa fa-chevron-circle-right"
></i>
{% trans "show all" %}
</a>
<a
href=
"{% url "
network
.
vxlan-create
"
%}"
class=
"btn btn-success btn-xs"
>
<i
class=
"fa fa-plus-circle"
></i>
{% trans "new" %}
</a>
</div>
</div>
</div>
</div>
</div>
circle/dashboard/templates/dashboard/index.html
View file @
56a98145
...
@@ -54,6 +54,12 @@
...
@@ -54,6 +54,12 @@
{% include "dashboard/index-users.html" %}
{% include "dashboard/index-users.html" %}
</div>
</div>
{% endif %}
{% endif %}
{% if perms.vxlan %}
<div
class=
"col-lg-4 col-sm-6"
>
{% include "dashboard/index-vxlans.html" %}
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
circle/dashboard/views/index.py
View file @
56a98145
...
@@ -29,6 +29,7 @@ from braces.views import LoginRequiredMixin
...
@@ -29,6 +29,7 @@ from braces.views import LoginRequiredMixin
from
dashboard.models
import
GroupProfile
from
dashboard.models
import
GroupProfile
from
vm.models
import
Instance
,
Node
,
InstanceTemplate
from
vm.models
import
Instance
,
Node
,
InstanceTemplate
from
dashboard.views.vm
import
vm_ops
from
dashboard.views.vm
import
vm_ops
from
network.models
import
Vxlan
from
..store_api
import
Store
from
..store_api
import
Store
...
@@ -100,6 +101,12 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -100,6 +101,12 @@ class IndexView(LoginRequiredMixin, TemplateView):
context
[
'templates'
]
=
InstanceTemplate
.
get_objects_with_level
(
context
[
'templates'
]
=
InstanceTemplate
.
get_objects_with_level
(
'operator'
,
user
,
disregard_superuser
=
True
)
.
all
()[:
5
]
'operator'
,
user
,
disregard_superuser
=
True
)
.
all
()[:
5
]
# vxlan
if
user
.
has_perm
(
'network.create_vxlan'
):
context
[
'vxlans'
]
=
Vxlan
.
get_objects_with_level
(
'user'
,
user
,
disregard_superuser
=
True
)
.
all
()[:
5
]
context
[
'vxlans'
]
=
Vxlan
.
objects
.
all
()[:
5
]
# toplist
# toplist
if
settings
.
STORE_URL
:
if
settings
.
STORE_URL
:
cache_key
=
"files-
%
d"
%
self
.
request
.
user
.
pk
cache_key
=
"files-
%
d"
%
self
.
request
.
user
.
pk
...
...
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