Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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
7 years ago
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
Show 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 () {
...
@@ -223,6 +223,7 @@ $(function () {
register_search
(
$
(
"#dashboard-group-search-form"
),
$
(
"#dashboard-group-list"
),
generateGroupHTML
);
register_search
(
$
(
"#dashboard-group-search-form"
),
$
(
"#dashboard-group-list"
),
generateGroupHTML
);
register_search
(
$
(
"#dashboard-user-search-form"
),
$
(
"#dashboard-user-list"
),
generateUserHTML
);
register_search
(
$
(
"#dashboard-user-search-form"
),
$
(
"#dashboard-user-list"
),
generateUserHTML
);
register_search
(
$
(
"#dashboard-template-search-form"
),
$
(
"#dashboard-template-list"
),
generateTemplateHTML
);
register_search
(
$
(
"#dashboard-template-search-form"
),
$
(
"#dashboard-template-list"
),
generateTemplateHTML
);
register_search
(
$
(
"#dashboard-vxlan-search-form"
),
$
(
"#dashboard-vxlan-list"
),
generateVxlanHTML
);
/* notification message toggle */
/* notification message toggle */
$
(
document
).
on
(
'click'
,
".notification-message-subject"
,
function
()
{
$
(
document
).
on
(
'click'
,
".notification-message-subject"
,
function
()
{
...
@@ -331,6 +332,18 @@ function generateNodeHTML(data, is_last) {
...
@@ -331,6 +332,18 @@ function generateNodeHTML(data, is_last) {
'</a>'
;
'</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 */
/* copare vm-s by fav, pk order */
function
compareVmByFav
(
a
,
b
)
{
function
compareVmByFav
(
a
,
b
)
{
if
(
a
.
fav
&&
b
.
fav
)
{
if
(
a
.
fav
&&
b
.
fav
)
{
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/templates/dashboard/index-vxlans.html
View file @
877e65ec
...
@@ -8,12 +8,15 @@
...
@@ -8,12 +8,15 @@
</h3>
</h3>
</div>
</div>
<div
class=
"list-group"
id=
"vxlan-list-view"
>
<div
class=
"list-group"
id=
"vxlan-list-view"
>
<div
id=
"dashboard-
user
-list"
>
<div
id=
"dashboard-
vxlan
-list"
>
{% for vxlan in vxlans %}
{% for vxlan in vxlans %}
<a
href=
"{% url "
network
.
vxlan
"
vni=
vxlan.vni
%}"
class=
"list-group-item
<a
href=
"{% url "
network
.
vxlan
"
vni=
vxlan.vni
%}"
class=
"list-group-item
{% if forloop.last and vxlan|length < 5 %} list-group-item-last{% endif %}"
>
{% 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 }}
<i
class=
"fa fa-sitemap"
></i>
{{ vxlan.name }}
{% if user.is_superuser %}
<small
class=
"text-muted"
>
vni: {{ vxlan.vni }}
</small>
{% endif %}
</span>
</span>
</a>
</a>
{% endfor %}
{% endfor %}
...
...
This diff is collapsed.
Click to expand it.
circle/network/templates/network/vxlan-list.html
View file @
877e65ec
...
@@ -4,12 +4,12 @@
...
@@ -4,12 +4,12 @@
{% load l10n %}
{% load l10n %}
{% load staticfiles %}
{% load staticfiles %}
{% block title-page %}{% trans "Vlans" %}{% endblock %}
{% block title-page %}{% trans "V
x
lans" %}{% endblock %}
{% block content %}
{% block content %}
<div
class=
"page-header"
>
<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>
<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>
<div
class=
"table-responsive"
>
<div
class=
"table-responsive"
>
...
...
This diff is collapsed.
Click to expand it.
circle/network/views.py
View file @
877e65ec
...
@@ -922,6 +922,23 @@ class VxlanList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
...
@@ -922,6 +922,23 @@ class VxlanList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
template_name
=
"network/vxlan-list.html"
template_name
=
"network/vxlan-list.html"
table_pagination
=
False
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
):
class
VxlanAclUpdateView
(
AclUpdateView
):
model
=
Vxlan
model
=
Vxlan
...
...
This diff is collapsed.
Click to expand it.
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