airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1405924 - in /airavata/sandbox/client-api-demo/src/main/webapp: js/x_app_descriptor_view_jason.js js/x_host_descriptor_save_json.js js/x_host_descriptor_view_json.js x_app_descriptor_view_json.html x_host_descriptor_view_json.html
Date Mon, 05 Nov 2012 19:05:42 GMT
Author: heshan
Date: Mon Nov  5 19:05:42 2012
New Revision: 1405924

URL: http://svn.apache.org/viewvc?rev=1405924&view=rev
Log:
Moving the js logic to seperate js files.

Added:
    airavata/sandbox/client-api-demo/src/main/webapp/js/x_app_descriptor_view_jason.js
    airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_view_json.js
Modified:
    airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_save_json.js
    airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view_json.html
    airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view_json.html

Added: airavata/sandbox/client-api-demo/src/main/webapp/js/x_app_descriptor_view_jason.js
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/js/x_app_descriptor_view_jason.js?rev=1405924&view=auto
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/js/x_app_descriptor_view_jason.js (added)
+++ airavata/sandbox/client-api-demo/src/main/webapp/js/x_app_descriptor_view_jason.js Mon
Nov  5 19:05:42 2012
@@ -0,0 +1,52 @@
+
+$(document).ready(function(){
+
+    $('[name="btn2"]').click(function(){
+
+        $.ajax({
+            beforeSend: function(x) {
+                if (x && x.overrideMimeType) {
+                    x.overrideMimeType("application/j-son;charset=UTF-8");
+                }
+            },
+            type: "GET",
+            dataType: "json",
+            contentType: "application/json;charset=utf-8",
+            url: "http://localhost:7080/airavata-registry-rest-services/registry/api/applicationdescriptor/alldescriptors",
+            /*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);
+            }
+
+        }).done(function(msg) {
+//                        alert( "Data Saved: " + JSON.stringify(msg));
+                $("#jason-text").html(JSON.stringify(msg));
+            });
+
+    });
+});
\ No newline at end of file

Modified: airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_save_json.js
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_save_json.js?rev=1405924&r1=1405923&r2=1405924&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_save_json.js (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_save_json.js Mon
Nov  5 19:05:42 2012
@@ -30,10 +30,6 @@ $(document).ready(function(){
         var hostName = $("#hostName1").val();
         var hostAddress = $("#hostAddress1").val();
         var hostEndpoint = $("#hostEndpoint1").val();
-//        alert(hostEndpoint);
-//        alert(hostEndpoint);
-//        alert("hostEndpoint null  :" + hostEndpoint == null);
-//        alert("hostEndpoint empty :" + hostEndpoint == "");
         var gatekeeperEndpoint = $("#gatekeeperEndpoint1").val();
         var xml = $('<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>'
+ hostName + '</type:hostName><type:hostAddress>' + hostAddress + '</type:hostAddress></type:hostDescription>');
 
@@ -47,10 +43,6 @@ $(document).ready(function(){
         }
         console.log(xmlString);
 
-//        alert(hostName);
-//        alert(hostAddress);
-//        alert(xmlString);
-
         if (("" == hostEndpoint) || ("" == gatekeeperEndpoint)) {
             alert("if Case");
             $.ajax({

Added: airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_view_json.js
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_view_json.js?rev=1405924&view=auto
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_view_json.js (added)
+++ airavata/sandbox/client-api-demo/src/main/webapp/js/x_host_descriptor_view_json.js Mon
Nov  5 19:05:42 2012
@@ -0,0 +1,48 @@
+
+$(document).ready(function(){
+
+    $('[name="btn2"]').click(function(){
+
+        $.ajax({
+            beforeSend: function(x) {
+                if (x && x.overrideMimeType) {
+                    x.overrideMimeType("application/j-son;charset=UTF-8");
+                }
+            },
+            type: "GET",
+            dataType: "json",
+            contentType: "application/json;charset=utf-8",
+            url: "http://localhost:7080/airavata-registry-rest-services/registry/api/get/hostdescriptors",
+            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) {
+         alert( "Data Saved: " + JSON.stringify(msg));
+         });*/
+
+    });
+});
\ No newline at end of file

Modified: airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view_json.html
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view_json.html?rev=1405924&r1=1405923&r2=1405924&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view_json.html (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/x_app_descriptor_view_json.html Mon Nov
 5 19:05:42 2012
@@ -6,69 +6,16 @@
 </head>
 <body>
 
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
+<script type="text/javascript" src="js/x_app_descriptor_view_jason.js" ></script>
+
 <h1>Get Application Descriptor Information </h1>
 <button name="btn2">Click</button>
 
 <table id="display"></table>
 
-<textarea id="jason-text" rows="50" cols="150" placeholder="Describe yourself with 4 words...">
+<textarea id="jason-text" rows="50" cols="150" placeholder="App descriptor in Jason">
 </textarea>
 
-<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
-<script>
-
-    $(document).ready(function(){
-
-        $('[name="btn2"]').click(function(){
-
-            $.ajax({
-                beforeSend: function(x) {
-                    if (x && x.overrideMimeType) {
-                        x.overrideMimeType("application/j-son;charset=UTF-8");
-                    }
-                },
-                type: "GET",
-                dataType: "json",
-                contentType: "application/json;charset=utf-8",
-                url: "http://localhost:7080/airavata-registry-rest-services/registry/api/applicationdescriptor/alldescriptors",
-                /*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);
-                }
-
-            }).done(function(msg) {
-//                        alert( "Data Saved: " + JSON.stringify(msg));
-                        $("#jason-text").html(JSON.stringify(msg));
-                    });
-
-        });
-    });
-</script>
-
 </body>
 </html>
\ No newline at end of file

Modified: airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view_json.html
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view_json.html?rev=1405924&r1=1405923&r2=1405924&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view_json.html (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_view_json.html Mon
Nov  5 19:05:42 2012
@@ -6,62 +6,13 @@
 </head>
 <body>
 
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
+<script type="text/javascript" src="js/x_host_descriptor_view_json.js" ></script>
+
 <h1>Get Host Descriptor Information </h1>
 <button name="btn2">Click</button>
 
 <table id="display"></table>
 
-<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
-<script>
-
-    $(document).ready(function(){
-
-        $('[name="btn2"]').click(function(){
-
-            $.ajax({
-                beforeSend: function(x) {
-                    if (x && x.overrideMimeType) {
-                        x.overrideMimeType("application/j-son;charset=UTF-8");
-                    }
-                },
-                type: "GET",
-                dataType: "json",
-                contentType: "application/json;charset=utf-8",
-                url: "http://localhost:7080/airavata-registry-rest-services/registry/api/get/hostdescriptors",
-                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) {
-                        alert( "Data Saved: " + JSON.stringify(msg));
-                    });*/
-
-        });
-    });
-</script>
-
 </body>
 </html>
\ No newline at end of file



Mime
View raw message