You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by he...@apache.org on 2012/11/02 13:31:13 UTC

svn commit: r1404948 - /airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view.html

Author: heshan
Date: Fri Nov  2 12:31:13 2012
New Revision: 1404948

URL: http://svn.apache.org/viewvc?rev=1404948&view=rev
Log:
Displaying host descriptors.

Modified:
    airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view.html

Modified: airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view.html
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view.html?rev=1404948&r1=1404947&r2=1404948&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view.html (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view.html Fri Nov  2 12:31:13 2012
@@ -28,24 +28,36 @@
                 dataType: "json",
                 contentType: "application/json;charset=utf-8",
                 url: "http://localhost:7080/airavata-registry-rest-services/registry/api/get/hostdescriptors",
-                success: function(responseData, status, settings) {
-//                    alert(data);
-//                    var data = JSON.stringify(responseData);
-//                    $.each(data, function(key, val) {
-//                        var tr=$('<tr></tr>');
-//                        $.each(val, function(k, v){
-//                            $('<td>'+v+'</td>').appendTo(tr);
-//                        });
-//                        tr.appendTo('#display');
-//                    });
+                success: function(data, status, settings) {
+                    var keys=[],result='';
+                    $.each(data.hostDescriptions,function(i,row){
+                        $.each(row,function(key,value){
+                            if ($.inArray(key,keys)==-1) keys.push(key);
+                        })
+                    });
+                    result+="<thead><tr>";
+                    $.each(keys,function(i,key){
+                        result+="<th>"+key+"<\/th>";
+                    });
+                    result+="<\/tr><\/thead><tbody>";
+                    $.each(data.hostDescriptions,function(i,row){
+                        result+="<tr>";
+                        $.each(keys,function(i,key){
+                            result+="<td>"+ (row[key]||'') + "<\/td>";
+                        });
+                        result+="<\/tr>";
+                    });
+                    result+="<\/tbody>";
+                    $('#display').html(result);
+
                 },
                 error: function(ajaxrequest, ajaxOptions, thrownError){
                     alert(thrownError);
                 }
 
-            }).done(function(msg) {
+            });/*.done(function(msg) {
                         alert( "Data Saved: " + JSON.stringify(msg));
-                    });
+                    });*/
 
         });
     });