airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1405006 - /airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view.html
Date Fri, 02 Nov 2012 15:24:05 GMT
Author: heshan
Date: Fri Nov  2 15:24:05 2012
New Revision: 1405006

URL: http://svn.apache.org/viewvc?rev=1405006&view=rev
Log:
Rendering the response for App descriptirons (there is a rendering issue and this needs to
be fixed).

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

Modified: airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view.html
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view.html?rev=1405006&r1=1405005&r2=1405006&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view.html (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view.html Fri Nov  2
15:24:05 2012
@@ -28,16 +28,31 @@
                 dataType: "json",
                 contentType: "application/json;charset=utf-8",
                 url: "http://localhost:7080/airavata-registry-rest-services/registry/api/applicationdescriptor/alldescriptors",
-                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.applicationDescriptors,function(i,row){
+                        $.each(row,function(key,value){
+                            if ($.inArray(key,keys)==-1) {
+                                if (key != "serviceDescriptor") {
+                                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);



Mime
View raw message