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
0a8706da
authored
Feb 01, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: search in vm list
parent
93b78ecd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
circle/dashboard/static/dashboard/dashboard.js
+5
-2
circle/dashboard/templates/dashboard/vm-list.html
+8
-0
circle/dashboard/views.py
+6
-2
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
0a8706da
...
@@ -144,7 +144,7 @@ $(function () {
...
@@ -144,7 +144,7 @@ $(function () {
for
(
var
i
in
result
)
{
for
(
var
i
in
result
)
{
my_vms
.
push
({
my_vms
.
push
({
'pk'
:
result
[
i
].
pk
,
'pk'
:
result
[
i
].
pk
,
'name'
:
result
[
i
].
name
,
'name'
:
result
[
i
].
name
.
toLowerCase
()
,
'state'
:
result
[
i
].
state
,
'state'
:
result
[
i
].
state
,
'fav'
:
result
[
i
].
fav
,
'fav'
:
result
[
i
].
fav
,
});
});
...
@@ -153,7 +153,7 @@ $(function () {
...
@@ -153,7 +153,7 @@ $(function () {
$
.
ajaxSetup
(
{
"async"
:
true
}
);
$
.
ajaxSetup
(
{
"async"
:
true
}
);
}
}
input
=
$
(
"#dashboard-vm-search-input"
).
val
();
input
=
$
(
"#dashboard-vm-search-input"
).
val
()
.
toLowerCase
()
;
var
search_result
=
[]
var
search_result
=
[]
var
html
=
''
;
var
html
=
''
;
for
(
var
i
in
my_vms
)
{
for
(
var
i
in
my_vms
)
{
...
@@ -173,6 +173,9 @@ $(function () {
...
@@ -173,6 +173,9 @@ $(function () {
if
(
e
.
keyCode
==
13
&&
search_result
.
length
==
1
)
{
if
(
e
.
keyCode
==
13
&&
search_result
.
length
==
1
)
{
window
.
location
.
href
=
"/dashboard/vm/"
+
search_result
[
0
].
pk
+
"/"
;
window
.
location
.
href
=
"/dashboard/vm/"
+
search_result
[
0
].
pk
+
"/"
;
}
}
if
(
e
.
keyCode
==
13
&&
search_result
.
length
>
1
&&
input
.
length
>
0
)
{
window
.
location
.
href
=
"/dashboard/vm/list/?s="
+
input
;
}
});
});
});
});
...
...
circle/dashboard/templates/dashboard/vm-list.html
View file @
0a8706da
...
@@ -9,6 +9,14 @@
...
@@ -9,6 +9,14 @@
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
><i
class=
"icon-desktop"
></i>
Your virtual machines
</h3>
<h3
class=
"no-margin"
><i
class=
"icon-desktop"
></i>
Your virtual machines
</h3>
</div>
</div>
<div
class=
"pull-right"
style=
"max-width: 250px; margin-top: 15px; margin-right: 15px;"
>
<form
action=
""
method=
"GET"
class=
"input-group"
>
<input
type=
"text"
name=
"s"
{%
if
request
.
GET
.
s
%}
value=
"{{ request.GET.s }}"
{%
endif
%}
class=
"form-control input-tags"
placeholder=
"Search..."
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary input-tags"
title=
"search"
><i
class=
"icon-search"
></i></button>
</div>
</form>
</div>
<div
class=
"panel-body vm-list-group-control"
>
<div
class=
"panel-body vm-list-group-control"
>
<p>
<p>
<strong>
Group actions
</strong>
<strong>
Group actions
</strong>
...
...
circle/dashboard/views.py
View file @
0a8706da
...
@@ -607,8 +607,12 @@ class VmList(LoginRequiredMixin, SingleTableView):
...
@@ -607,8 +607,12 @@ class VmList(LoginRequiredMixin, SingleTableView):
def
get_queryset
(
self
):
def
get_queryset
(
self
):
logger
.
debug
(
'VmList.get_queryset() called. User:
%
s'
,
logger
.
debug
(
'VmList.get_queryset() called. User:
%
s'
,
unicode
(
self
.
request
.
user
))
unicode
(
self
.
request
.
user
))
return
Instance
.
get_objects_with_level
(
queryset
=
Instance
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
)
.
filter
(
destroyed
=
None
)
.
all
()
'user'
,
self
.
request
.
user
)
.
filter
(
destroyed
=
None
)
s
=
self
.
request
.
GET
.
get
(
"s"
)
if
s
:
queryset
=
queryset
.
filter
(
name__icontains
=
s
)
return
queryset
class
NodeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
class
NodeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
...
...
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