From a0c4edae4584780685216a93eddfd6e680bc3504 Mon Sep 17 00:00:00 2001 From: Kálmán Viktor Date: Mon, 24 Mar 2014 21:33:31 +0100 Subject: [PATCH] dashboard: wordwrap for ajax search too in vm list --- circle/dashboard/static/dashboard/dashboard.js | 27 ++++++++++++++++++--------- circle/dashboard/views.py | 4 +++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/circle/dashboard/static/dashboard/dashboard.js b/circle/dashboard/static/dashboard/dashboard.js index 5164aa6..0dfc8a7 100644 --- a/circle/dashboard/static/dashboard/dashboard.js +++ b/circle/dashboard/static/dashboard/dashboard.js @@ -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' + - ' ' + name + - '
' + - '' + - '
' + - ''; +function generateVmHTML(pk, name, host, icon, _status, fav) { + return '' + + '' + + ' ' + name + + '' + + ' ' + host + '' + + '
' + + (fav ? '' : + '' ) + + '
' + + '
' + + '
'; } function compareVmByFav(a, b) { diff --git a/circle/dashboard/views.py b/circle/dashboard/views.py index ea20b06..8dfd690 100644 --- a/circle/dashboard/views.py +++ b/circle/dashboard/views.py @@ -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 -- libgit2 0.26.0