Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
877e65ec
authored
Nov 08, 2017
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network, dashboard: add quick search to dashboard and fix vxlan template
parent
66659765
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
4 deletions
+37
-4
circle/dashboard/static/dashboard/dashboard.js
+13
-0
circle/dashboard/templates/dashboard/index-vxlans.html
+5
-2
circle/network/templates/network/vxlan-list.html
+2
-2
circle/network/views.py
+17
-0
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
877e65ec
...
...
@@ -223,6 +223,7 @@ $(function () {
register_search
(
$
(
"#dashboard-group-search-form"
),
$
(
"#dashboard-group-list"
),
generateGroupHTML
);
register_search
(
$
(
"#dashboard-user-search-form"
),
$
(
"#dashboard-user-list"
),
generateUserHTML
);
register_search
(
$
(
"#dashboard-template-search-form"
),
$
(
"#dashboard-template-list"
),
generateTemplateHTML
);
register_search
(
$
(
"#dashboard-vxlan-search-form"
),
$
(
"#dashboard-vxlan-list"
),
generateVxlanHTML
);
/* notification message toggle */
$
(
document
).
on
(
'click'
,
".notification-message-subject"
,
function
()
{
...
...
@@ -331,6 +332,18 @@ function generateNodeHTML(data, is_last) {
'</a>'
;
}
function
generateVxlanHTML
(
data
,
is_last
)
{
html
=
'<a href="'
+
data
.
url
+
'" class="list-group-item real-link'
+
(
is_last
?
' list-group-item-last'
:
''
)
+
'">'
+
'<span class="index-vxlan-list-name">'
+
'<i class="fa '
+
data
.
icon
+
'" title="'
+
data
.
name
+
'"></i> '
+
safe_tags_replace
(
data
.
name
);
if
(
data
.
vni
!==
null
&&
data
.
vni
!==
undefined
)
html
+=
' <small class="text-muted"> vni: '
+
data
.
vni
+
'</small>'
;
html
+=
'</span>'
+
'<div style="clear: both;"></div>'
+
'</a>'
;
return
html
;
}
/* copare vm-s by fav, pk order */
function
compareVmByFav
(
a
,
b
)
{
if
(
a
.
fav
&&
b
.
fav
)
{
...
...
circle/dashboard/templates/dashboard/index-vxlans.html
View file @
877e65ec
...
...
@@ -8,12 +8,15 @@
</h3>
</div>
<div
class=
"list-group"
id=
"vxlan-list-view"
>
<div
id=
"dashboard-
user
-list"
>
<div
id=
"dashboard-
vxlan
-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"
>
<span
class=
"index-
vxlan
-list-name"
>
<i
class=
"fa fa-sitemap"
></i>
{{ vxlan.name }}
{% if user.is_superuser %}
<small
class=
"text-muted"
>
vni: {{ vxlan.vni }}
</small>
{% endif %}
</span>
</a>
{% endfor %}
...
...
circle/network/templates/network/vxlan-list.html
View file @
877e65ec
...
...
@@ -4,12 +4,12 @@
{% load l10n %}
{% load staticfiles %}
{% block title-page %}{% trans "Vlans" %}{% endblock %}
{% block title-page %}{% trans "V
x
lans" %}{% endblock %}
{% block content %}
<div
class=
"page-header"
>
<a
href=
"{% url "
network
.
vxlan-create
"
%}"
class=
"btn btn-success pull-right"
><i
class=
"fa fa-plus-circle"
></i>
{% trans "Create a new vxlan" %}
</a>
<h1>
Vlans
<small>
{% trans "list of all vxlans" %}
</small></h1>
<h1>
V
x
lans
<small>
{% trans "list of all vxlans" %}
</small></h1>
</div>
<div
class=
"table-responsive"
>
...
...
circle/network/views.py
View file @
877e65ec
...
...
@@ -922,6 +922,23 @@ class VxlanList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
template_name
=
"network/vxlan-list.html"
table_pagination
=
False
def
get
(
self
,
*
args
,
**
kwargs
):
if
self
.
request
.
is_ajax
():
return
self
.
_create_ajax_request
()
return
super
(
VxlanList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
_create_ajax_request
(
self
):
vxlans
=
Vxlan
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
)
vxlans
=
[{
'pk'
:
i
.
pk
,
'url'
:
reverse_lazy
(
'network.vxlan'
,
args
=
[
i
.
pk
]),
'icon'
:
'fa-sitemap'
,
'name'
:
i
.
name
,
'vni'
:
i
.
vni
if
self
.
request
.
user
.
is_superuser
else
None
}
for
i
in
vxlans
]
return
JsonResponse
(
list
(
vxlans
),
safe
=
False
)
class
VxlanAclUpdateView
(
AclUpdateView
):
model
=
Vxlan
...
...
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