Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
[myslice.git] / portal / templates / slice-tab-experiment.html
index 0ca620a..be351fb 100644 (file)
@@ -1,14 +1,22 @@
 <script type="text/javascript">
+function is_finished(len_platforms, pf_status){
+    if(len_platforms == pf_status){
+        return true;
+    }else{
+        return false;
+    }
+}
+
 // Specific DIVs for each type of testbed
 $(document).ready(function() {
-    console.log('{{platforms}}');
+    var platform_status = Array();
+    var platform_empty = Array();
     {% for platform in platforms %}
     // /sfa/Describe?hrn=onelab.upmc.projectx.slicex&platform[]={{platform}}&type=slice
     $.post("/sfa/Describe",{'hrn':'{{slicename}}', 'type':'slice', 'platform':['{{platform}}']}, function( data ) {
         console.log(data);
         if('parsed' in data['{{platform}}'] && 'rspec' in data['{{platform}}']['parsed']){
             rspec = data['{{platform}}']['parsed']['rspec'];
-            console.log(rspec);
             if('node' in rspec){
                 if(rspec['node'] instanceof Array) {
                     jQuery.each( rspec['node'], function( i, node ) {
@@ -17,20 +25,34 @@ $(document).ready(function() {
                 }else{
                     render_node('{{platform}}',rspec['node']);
                 }
+            }else{
+                platform_empty.push('{{platform}}');
+            }
+        }else{
+            platform_empty.push('{{platform}}');
+        }
+        platform_status.push('{{platform}}');
+        if(is_finished({{len_platforms}},platform_status.length)){
+            $("#loading").hide();
+            if(platform_empty.length == {{len_platforms}}){
+                $("#warning_message").show();
             }
         }
     });
     {% endfor %}
 });
 </script>
-
 <div class="col-md-10 col-md-offset-1">
 <div id="access">
-    <h2>How to access your reserved resources</h2>
+    <h2>How to access your reserved resources?</h2>
     <img src="{{ STATIC_URL }}img/loading.gif" id="loading" alt="Loading reserved resources" />
 </div>
+<div id="warning_message" style="display:none; color:orange; font-weigh:bold;">
+Please add resources to your slice from the left tab <a href="/resources/{{slicename}}">"Resources"</a>
+</div>
 <div id="default">
 </div>
+{% if "ple" in platforms %}
 <div id="ple_header" style="display:none;">
        <h3>PlanetLab Europe</h3>
        
@@ -68,15 +90,12 @@ $(document).ready(function() {
     <script type="text/javascript">
     $(document).ready(function() {
         $.post("/initscript/get/",{'slice_hrn':'{{slicename}}'}, function( data ) {
-            console.log(data);
             jQuery('#initscript_code').val(data['initscript_code']);
         });
     });
     function deploy(slice_hrn){
-        console.log("deploy = "+slice_hrn);
         var initscript_code = jQuery('#initscript_code').val()
         $.post("/initscript/update/",{'slice_hrn':slice_hrn, 'initscript_code':initscript_code}, function( data ) {
-            console.log(data);
             if (data['ret'] == 0) {
                 mysliceAlert('Success: initscript deployed','success', true);
             }else{
@@ -86,9 +105,7 @@ $(document).ready(function() {
         });
     }
     function del(slice_hrn){
-        console.log("delete");
         $.post("/initscript/delete/",{'slice_hrn':slice_hrn}, function( data ) {
-            console.log(data);
             if (data['ret'] == 0) {
                 mysliceAlert('Success: initscript deleted','success', true);
                 jQuery('#initscript_code').val('');
@@ -101,6 +118,8 @@ $(document).ready(function() {
     </script>
     <br>
 </div>
+{% endif %}
+{% if "iotlab" in platforms %}
 <div id="iotlab_header" style="display:none;">
        <h3>FIT IoT-Lab</h3>
        <p>FIT IoT-Lab resources are accessible directly via SSH and <a href="https://www.iot-lab.info/testbed/" target="_blank">web GUI.</a>
@@ -110,6 +129,8 @@ $(document).ready(function() {
 </div>
 <div id="iotlab" style="display:none;">
 </div>
+{% endif %}
+{% if "nitos" in platforms %}
 <div id="nitos_header" style="display:none;">
        <h3>NITOS Volos (Greece)</h3>
        
@@ -131,7 +152,8 @@ $(document).ready(function() {
        <p>To learn more about OMF, please click <a href="http://omf.mytestbed.net/projects/omf/wiki/OMF_Main_Page" target="_blank">here.</a></p>
 
 </div>
-
+{% endif %}
+{% if "nitos-paris" in platforms %}
 <div id="paris.fit-nitos.fr_header" style="display:none;">
        <h4>FIT NITOS-Lab Paris</h4>
 </div>
@@ -147,12 +169,13 @@ $(document).ready(function() {
        </p>
 
        <p>
-       The complete tutorial on NITOS nodes:
-       <a target="_blank" href="http://nitlab.inf.uth.gr/NITlab/index.php/testbed/instructions/basic-tutorial">NITOS basic tutorial</a>
+       The complete tutorial on FIT NITOS nodes:
+       <a target="_blank" href="http://doc.onelab.eu/nitos.html">basic tutorial</a>
        </p>
     <p>OMF based experiments' tutorials are available <a href="http://nitlab.inf.uth.gr/NITlab/index.php/testbed/instructions/omf-tutorials-scenarios" target="_blank">here.</a></p> 
        <p>To learn more about OMF, please click <a href="http://omf.mytestbed.net/projects/omf/wiki/OMF_Main_Page" target="_blank">here.</a></p>
 </div>
+{% endif %}
 <div style="padding-top:20px;">        
        <h2>Available Tools</h2>
        <p><img src="{{ STATIC_URL }}img/terminal_icon.png" width="50"> <b>SSH</b></p>