added google map
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Tue, 4 Mar 2014 15:34:59 +0000 (16:34 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Tue, 4 Mar 2014 15:34:59 +0000 (16:34 +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..1f62c47 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() {
index c1722e7..f2bd93d 100644 (file)
@@ -5,4 +5,44 @@ $(document).ready(function() {
         $('div.panel').hide();
         $('div#'+$(this).data('panel')).show();
     });
+    
+    $.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() {
+               
+       });
+       
+    $.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"), 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
+           });
+       
+           google.maps.event.addListener(marker, 'click', (function(marker, i) {
+               return function() {
+                 infowindow.setContent(data[i].hostname);
+                 infowindow.open(map, marker);
+               };
+       })(marker, i));
+    }
+  });
+   //google.maps.event.addDomListener(window, 'load', initialize);
 });
\ No newline at end of file
index c7acf6f..895e2ed 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;" style="display:none;"></div>
                </div>
        </div>
 {% endblock %}
\ No newline at end of file