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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
a0c4edae
authored
Mar 24, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: wordwrap for ajax search too in vm list
parent
20631849
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
circle/dashboard/static/dashboard/dashboard.js
+18
-9
circle/dashboard/views.py
+3
-1
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
a0c4edae
...
...
@@ -188,6 +188,9 @@ $(function () {
'name'
:
result
[
i
].
name
.
toLowerCase
(),
'state'
:
result
[
i
].
state
,
'fav'
:
result
[
i
].
fav
,
'host'
:
result
[
i
].
host
,
'icon'
:
result
[
i
].
icon
,
'status'
:
result
[
i
].
status
,
});
}
});
...
...
@@ -204,7 +207,9 @@ $(function () {
}
search_result
.
sort
(
compareVmByFav
);
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
html
+=
generateVmHTML
(
search_result
[
i
].
pk
,
search_result
[
i
].
name
,
search_result
[
i
].
fav
);
html
+=
generateVmHTML
(
search_result
[
i
].
pk
,
search_result
[
i
].
name
,
search_result
[
i
].
host
,
search_result
[
i
].
icon
,
search_result
[
i
].
status
,
search_result
[
i
].
fav
);
if
(
search_result
.
length
==
0
)
html
+=
'<div class="list-group-item">No result</div>'
;
$
(
"#dashboard-vm-list"
).
html
(
html
);
...
...
@@ -230,14 +235,18 @@ $(function () {
});
});
function
generateVmHTML
(
pk
,
name
,
fav
)
{
return
'<a href="/dashboard/vm/'
+
pk
+
'/" class="list-group-item">'
+
'<i class="icon-play-sign"></i> '
+
name
+
'<div class="pull-right dashboard-vm-favourite" data-vm="'
+
pk
+
'">'
+
'<i class="title-favourite icon-star'
+
(
fav
?
""
:
"-empty"
)
+
' text-primary" title="" data-original-title="'
+
(
fav
?
"Un"
:
"Mark as "
)
+
'favourite"></i>'
+
'</div>'
+
'</a>'
;
function
generateVmHTML
(
pk
,
name
,
host
,
icon
,
_status
,
fav
)
{
return
'<a href="/dashboard/vm/'
+
pk
+
'/" class="list-group-item">'
+
'<span class="index-vm-list-name">'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'</span>'
+
'<small class="text-muted"> '
+
host
+
'</small>'
+
'<div class="pull-right dashboard-vm-favourite" data-vm="'
+
pk
+
'">'
+
(
fav
?
'<i class="icon-star text-primary title-favourite" title="Unfavourite"></i>'
:
'<i class="icon-star-empty text-primary title-favourite" title="Mark as favorite"></i>'
)
+
'</div>'
+
'<div style="clear: both;"></div>'
+
'</a>'
;
}
function
compareVmByFav
(
a
,
b
)
{
...
...
circle/dashboard/views.py
View file @
a0c4edae
...
...
@@ -921,7 +921,9 @@ class VmList(LoginRequiredMixin, ListView):
instances
=
[{
'pk'
:
i
.
pk
,
'name'
:
i
.
name
,
'state'
:
i
.
state
,
'icon'
:
i
.
get_status_icon
(),
'host'
:
""
if
not
i
.
primary_host
else
i
.
primary_host
.
hostname
,
'status'
:
i
.
get_status_display
(),
'fav'
:
i
.
pk
in
favs
}
for
i
in
instances
]
return
HttpResponse
(
json
.
dumps
(
list
(
instances
)),
# instances is ValuesQuerySet
...
...
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