Tools tab: handle async Describe calls and gives a warning if no resources are reserv...
[unfold.git] / portal / templates / slice-tab-experiment.html
index 0ca620a..9673ad6 100644 (file)
@@ -1,6 +1,16 @@
 <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() {
+    var platform_status = Array();
+    var platform_empty = Array();
     console.log('{{platforms}}');
     {% for platform in platforms %}
     // /sfa/Describe?hrn=onelab.upmc.projectx.slicex&platform[]={{platform}}&type=slice
@@ -18,6 +28,15 @@ $(document).ready(function() {
                     render_node('{{platform}}',rspec['node']);
                 }
             }
+        }else{
+            platform_empty.push('{{platform}}');
+        }
+        platform_status.push('{{platform}}');
+        if(is_finished({{len_platforms}},platform_status.length)){
+            $("#loading").hide();
+            if(platform_empty.length > 0){
+                $("#warning_message").show();
+            }
         }
     });
     {% endfor %}
@@ -26,11 +45,15 @@ $(document).ready(function() {
 
 <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>
        
@@ -101,6 +124,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 +135,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 +158,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>
@@ -153,6 +181,7 @@ $(document).ready(function() {
     <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>