Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
authorYasin <mohammed-yasin.rahman@lip6.fr>
Tue, 4 Mar 2014 16:17:22 +0000 (17:17 +0100)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Tue, 4 Mar 2014 16:17:22 +0000 (17:17 +0100)
portal/static/css/onelab.css
portal/static/img/marker1.png [new file with mode: 0644]
portal/static/img/marker2.png [new file with mode: 0644]
portal/static/js/myslice-ui.js
portal/static/js/onelab_slice-resource-view.js
portal/templates/onelab/onelab_slice-resource-view.html

index 300fa93..750af81 100644 (file)
@@ -1,8 +1,11 @@
+html { height: 100% }
+
 body {
     background-color:white;
     color:black;
     margin:0;
     padding:0;
+    height: 100%;
 }
 a, a:active, a:focus {
     outline: 0;
diff --git a/portal/static/img/marker1.png b/portal/static/img/marker1.png
new file mode 100644 (file)
index 0000000..5f29aea
Binary files /dev/null and b/portal/static/img/marker1.png differ
diff --git a/portal/static/img/marker2.png b/portal/static/img/marker2.png
new file mode 100644 (file)
index 0000000..9dce718
Binary files /dev/null and b/portal/static/img/marker2.png differ
index 4437941..0003057 100644 (file)
@@ -5,15 +5,7 @@ $(document).ready(function() {
        var platformParameters = {};
        
                
-       $.get("/rest/platform", function(data) {
-               var list = '<div class="list-group-item sl-platfrom"><span class="list-group-item-heading">Testbeds</span></div>';
-               for(i=0; i<data.length;i++) {
-                       list += '<a href="#" class="list-group-item sl-platfrom" data-platform="'+data[i].platform+'"><span class="list-group-item-heading">'+data[i].platform_longname+'</span><p class="list-group-item-text">'+data[i].platform+'</p></a>';
-               }
-               $('#select-platform').html(list);
-       }).done(function() {
-               
-       });
+       
        
        /* Testbeds list */
        $("div#testbed-list").ready(function() {
@@ -37,7 +29,9 @@ $(document).ready(function() {
                "bAutoHeight": false,
                "fnInitComplete": function(oSettings, json) {
                                for(var i = 0; i < myslice.pending.length; i++) {
-                                       $('*[data-key="'+myslice.pending[i]+'"]').addClass("active");
+                                       var el = $('*[data-key="'+myslice.pending[i]+'"]');
+                                       el.addClass("active");
+                                       el.find('input[type=checkbox]').prop('checked', true);
                                }
                    }
                } );
index c1722e7..52850a3 100644 (file)
@@ -4,5 +4,55 @@ $(document).ready(function() {
         $(this).parent().addClass('active');
         $('div.panel').hide();
         $('div#'+$(this).data('panel')).show();
+        
+        if ($(this).data('panel') == 'map') {
+               mapInit();
+        }
     });
-});
\ No newline at end of file
+    
+    $.get("/rest/platform", function(data) {
+               var list = '<div class="list-group-item sl-platfrom"><span class="list-group-item-heading">Testbeds</span></div>';
+               for(i=0; i<data.length;i++) {
+                       list += '<a href="#" class="list-group-item sl-platfrom" data-platform="'+data[i].platform+'"><span class="list-group-item-heading">'+data[i].platform_longname+'</span><p class="list-group-item-text">'+data[i].platform+'</p></a>';
+               }
+               $('#select-platform').html(list);
+       }).done(function() {
+               
+       });
+       
+   //google.maps.event.addDomListener(window, 'load', initialize);
+});
+
+function mapInit() {
+       
+    $.get("/rest/resource/", {"fields" : ["hostname","latitude","longitude"] }, function(data) {
+       
+               var mapOptions = {
+             center: new google.maps.LatLng(48.8567, 2.3508),
+             zoom: 4,
+             scrollwheel: false
+           };
+           var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
+                marker = new google.maps.Marker({
+                       position: new google.maps.LatLng(48.8567, 2.3508),
+                       map: map,
+                       icon: '/static/img/marker2.png'
+                   });
+               
+               for (i = 0; i < data.length; i++) {  
+                       if (!data[i].longitude) continue;
+                   marker = new google.maps.Marker({
+                       position: new google.maps.LatLng(data[i].latitude, data[i].longitude),
+                       map: map
+                   });
+                       var infowindow = new google.maps.InfoWindow();
+
+                   google.maps.event.addListener(marker, 'click', (function(marker, i) {
+                       return function() {
+                         infowindow.setContent(data[i].hostname);
+                         infowindow.open(map, marker);
+                       };
+               })(marker, i));
+           }
+         });
+}
index c7acf6f..1fcecf9 100644 (file)
@@ -1,6 +1,7 @@
 {% extends "layout_wide.html" %}
 
 {% block head %}
+<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC1RUj824JAiHRVqgc2CSIg4CpKHhh84Lw&sensor=false"></script>
 <script src="{{ STATIC_URL }}js/onelab_slice-resource-view.js"></script>
 {% endblock %}
 
@@ -18,7 +19,7 @@
                </ul>
        
        </div>
-       <div class="col-md-10">
+       <div class="col-md-10" style="height:100%;">
                <div class="row">
                        {% include theme|add:"_widget-slice-sections.html" %}
                </div>
                          <li><a href="#"></a></li>
                        </ul>
                </div>
-               <div id="resources" class="panel">
-                       <table cellpadding="0" cellspacing="0" border="0" class="table" id="objectList"></table>
-               </div>
-               <div id="map" class="panel" style="display:none;">
-                       Map
+               <div class="row" style="height:100%;">
+                       <div id="resources" class="panel">
+                               <table cellpadding="0" cellspacing="0" border="0" class="table" id="objectList"></table>
+                       </div>
+                       <div id="map" class="panel" style="height:370px;display:none;">
+                               <div id="map-canvas" style="height:100%;"></div>
+                       </div>
                </div>
        </div>
 {% endblock %}
\ No newline at end of file