commit e2ccad35c2b6b5281aa1983c27ebb806a54dcce5
Author: Dimitris Moraitis <dimo@unweb.me>
Date:   Fri Apr 1 21:07:55 2011 +0300

    fix wave in list view & minor css improvements - refs #293

diff --git a/ui/static/main.css b/ui/static/main.css
index c5844bf..2c8ab93 100644
--- a/ui/static/main.css
+++ b/ui/static/main.css
@@ -897,10 +897,10 @@ div.confirm_single button, div.confirm_multiple button, div.action_error button{
     color: #3D3D3D;
     cursor: pointer;
     padding: 0px;
+    height: 20px !important;
 }
 
 div.confirm_single button, .action_error button {
-    height: 20px !important;
     width: 80px !important;
 }
 div.confirm_single button.yes, div.confirm_multiple button.yes {
@@ -941,7 +941,7 @@ div.action_error {
 
 div.confirm_multiple {
     width: 692px;
-    height: 25px;
+    height: 28px;
     margin: 0 0 10px -32px;
 }
 
diff --git a/ui/templates/home.html b/ui/templates/home.html
index fcbb1ca..a3e5e72 100644
--- a/ui/templates/home.html
+++ b/ui/templates/home.html
@@ -48,9 +48,9 @@
             '501' : '{% trans "This server has not been implemented yet." %}',
             // service unavailable
             '503' : '{% trans "This service is unavailable right now, please try again later." %}',
-            // no images unavailable
+            // no images found
             'NO_IMAGES' : '{% trans "Cannot show the Create machine wizard: No images found." %}',
-            // no images unavailable
+            // no flavors found
             'NO_FLAVORS' : '{% trans "Cannot show the Create machine wizard: No machine configurations found." %}'
         };
         
diff --git a/ui/templates/list.html b/ui/templates/list.html
index b690918..22d326e 100644
--- a/ui/templates/list.html
+++ b/ui/templates/list.html
@@ -175,7 +175,7 @@ function update_machines_view(data){
         current = -1;
         // check server status to select the appropriate OS icon
         osTag = image_tags[server.imageRef]
-        var osIcon = osTag + ".png", imgStr;
+        var osIcon = osTag + ".png", imgStr, imgSrc;
 
 		// check if the server already exists in the datatable
 		tableData.forEach(function(row,index){
@@ -189,36 +189,33 @@ function update_machines_view(data){
 			try {
 				console.info(server.name + ' from ' 
 							+ tableData[current][5] + ' to ' + STATUS_MESSAGES[server.status]);
-			} catch(err) {}
+			} catch(err) {}		
 			if (server.status == "DELETED") {
 				vmTable.fnDeleteRow(current);	
-			} else {
-				// update status
-				tableData[current][0] = "<input class="+server.status+" id="+server.id+" type=checkbox>";
+			} else { // server exists and should not be deleted		
                 // check server status to select the appropriate OS icon
                 if (['ERROR', 'STOPPED'].indexOf(server.status) >= 0) {
                     osIcon = osTag + "-off.png";
                 }
-				
-				if (tableData[current][5].indexOf(STATUS_MESSAGES[server.status]) > -1 ||
-					$('#'+server.id).parent().parent().find('.list-logo').attr('src').indexOf('wave')>-1){
-					imgStr = "<img class=list-logo src=static/os_logos/" + osIcon +
-                                        " title=" + osTag + " height=16 width=16 />";
-				} else {
-					imgStr = "<img class=list-logo src=static/wave.gif height=16 width=16 />";	
-				}
-                tableData[current][1] = "<span class=imagetag>" + osTag + 
-                                        "</span>" + imgStr;
-				tableData[current][5] = "<span class=status>" + STATUS_MESSAGES[server.status] + "</span>";
-				// TODO: update name & ip
-				vmTable.fnUpdate(tableData[current],current);
-				imgStr = "<img class=list-logo src=static/os_logos/" + osIcon +
-                                        " title=" + osTag + " height=16 width=16 />";
-                tableData[current][1] = "<span class=imagetag>" + osTag + 
-                                        "</span>" + imgStr;
-				//setTimeout($('#'+server.id).parent().parent().find('.list-logo').attr, 2000,'src',imgStr);
-				//setTimeout("vmTable.fnUpdate('"+tableData[current]+"','"+current+"')",2000);
+				// if the new state does not differ from the previous one
+				if (tableData[current][5].indexOf(STATUS_MESSAGES[server.status]) > -1){
+					// do nothing
+				} else { // state has changed
+					//$('#'+server.id).parent().parent().find('.list-logo').attr('src').indexOf('wave')>-1){
+					
+					imgSrc = "static/wave.gif";
+					tableData[current][0] = "<input class="+server.status+" id="+server.id+" type=checkbox>";
+					imgStr = "<img class=list-logo src=" + imgSrc + " title=" + osTag + " height=16 width=16 />";
+					tableData[current][1] = "<span class=imagetag>" + osTag + "</span>" + imgStr;
+					tableData[current][2] = "<a class=name><span class=name>" + server.name + "</span></a>";
+					tableData[current][3] = "<a class=ip><span class=public>"+ server.addresses.public.ip.addr + "</span></a>";
+					//tableData[current][4] = "group"; //TODO
+					tableData[current][5] = "<span class=status>" + STATUS_MESSAGES[server.status] + "</span>";
+					vmTable.fnUpdate(tableData[current],current);
 
+					//try{console.info('vm ' + server.id + ' from ' + tableData[current][5] + ' to ' + STATUS_MESSAGES[server.status])} catch(err) {}						
+					setTimeout("$('#"+server.id+"').parent().parent().find('.list-logo').attr('src','static/os_logos/" + osIcon+"')", 2000);					
+				}
 			}
 			updateActions();
         } else if (server.status != "DELETED") { // does not exist, we should create it
@@ -249,7 +246,7 @@ function update_machines_view(data){
     }
 	
 	// set confirm box position
-    if (window.innerHeight - 235 < $('#machinesview').height())
+    if (window.innerHeight - 200 < $('#machinesview').height())
         $('.confirm_multiple').addClass('fixed');
     else
         $('.confirm_multiple').removeClass('fixed');
diff --git a/ui/templates/machines.html b/ui/templates/machines.html
index 3369988..e1d3685 100644
--- a/ui/templates/machines.html
+++ b/ui/templates/machines.html
@@ -447,7 +447,7 @@ if (flavors.length > 0) {
 $("ul.tabs").tabs("div.panes ul");
 
 $(window).resize(function(){
-    if (this.innerHeight - 240 < $('#machinesview').height())
+    if (this.innerHeight - 200 < $('#machinesview').height())
         $('.confirm_multiple').addClass('fixed');
     else
         $('.confirm_multiple').removeClass('fixed');
diff --git a/ui/templates/standard.html b/ui/templates/standard.html
index de517b0..5f0255b 100644
--- a/ui/templates/standard.html
+++ b/ui/templates/standard.html
@@ -246,7 +246,7 @@ function update_machines_view(data){
     }
     
     // set confirm box position
-    if (window.innerHeight - 235 < $('#machinesview').height())
+    if (window.innerHeight - 200 < $('#machinesview').height())
         $('.confirm_multiple').addClass('fixed');
     else
         $('.confirm_multiple').removeClass('fixed');
