Skip to content

Commit

Permalink
new ui: Display a VM's icon when it is powered off
Browse files Browse the repository at this point in the history
Instead of the image-missing icon, display the VM's icon when it is
powered off.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
alinefm authored and Adam Litke committed Jun 26, 2013
1 parent 47f5c52 commit 0f18271
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/burnet/mockmodel.py
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ def vm_lookup(self, name):
if vm.info['state'] == 'running':
vm.info['screenshot'] = self.vmscreenshot_lookup(name)
else:
vm.info['screenshot'] = '/images/image-missing.svg'
vm.info['screenshot'] = None
vm.info['vnc_port'] = self._mock_vnc_ports.get(name, None)
return vm.info

2 changes: 1 addition & 1 deletion src/burnet/model.py
Original file line number Diff line number Diff line change
@@ -208,7 +208,7 @@ def vm_lookup(self, name):
dom = self._get_vm(name)
info = dom.info()
state = Model.dom_state_map[info[0]]
screenshot = 'images/image-missing.svg'
screenshot = None
cpu_stats = 0
try:
if state == 'running':
9 changes: 8 additions & 1 deletion ui/css/theme-default/list.css
Original file line number Diff line number Diff line change
@@ -192,11 +192,18 @@
.list-vm .tile {
width: 170px;
height: 110px;
background: #222;
box-shadow: -1px -1px 2px rgb(0, 0, 0, .25), 3px 3px 3px #fff;
margin: 10px;
}

.list-vm .shutoff {
box-shadow: none !important;
}

.list-vm .shutoff img {
opacity: 0.4;
}

.list-title {
color: #666;
font-weight: 600;
9 changes: 9 additions & 0 deletions ui/js/src/burnet.guest_main.js
Original file line number Diff line number Diff line change
@@ -91,6 +91,15 @@ burnet.listVmsAuto = function() {
var listHtml='';
var guestTemplate = $('#tmpl-guest').html();
$.each(result, function(index, value) {
if (value.state == 'running') {
image = value.screenshot;
} else {
image = value.icon;
}
if (!image) {
image = "images/icon-vm.svg";
}
value['tile-src'] = image
listHtml+=burnet.template(guestTemplate, value);
});
$('#guestList').html(listHtml);
2 changes: 1 addition & 1 deletion ui/pages/guest.html.tmpl
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@
<div class="subtitle"></div>
</div>
<div class="sortable guest-tile">
<div class="tile"><img alt="" src="{screenshot}" width="170px" height="110px"></div>
<div class="tile {state}"><img alt="" src="{tile-src}" width="170px" height="110px"></div>
</div>
<div class="sortable guest-actions">
<div class="top">

0 comments on commit 0f18271

Please sign in to comment.