1 $(document).ready(function() {
2 $('li#GoogleMap').click(function (e) {
3 $('.'+this.id).trigger('show');
6 $('a.sl-platform').click(function (e) {
7 $('.'+this.id).trigger('show');
11 $('ul.nav-resources a').click(function() {
12 $('ul.nav-resources li').removeClass('active');
13 $(this).parent().addClass('active');
14 $('div.panel').hide();
15 $('div#'+$(this).data('panel')).show();
17 if ($(this).data('panel') == 'map') {
22 $('div.list-resources a').click(function() {
23 $('div.list-resources a').removeClass('active');
24 $(this).addClass('active');
25 $('div.panel').hide();
26 $('div#'+$(this).data('panel')).show();
30 // Unused "List of testbeds" tab
32 $.get("/rest/network", function(data) {
33 var list = '<div class="list-group-item sl-platform"><span class="list-group-item-heading">Testbeds</span></div>';
34 for(i=0; i<data.length;i++) {
35 list += '<a href="#" class="list-group-item sl-platform" data-platform="'+data[i].network_hrn+'"><span class="list-group-item-heading">'+data[i].network_longname+'</span><p class="list-group-item-text">'+data[i].network_hrn+'</p></a>';
37 $('#select-platform').html(list);
43 $('button#ApplyPendind').click(function() {
45 // $.each(myslice.pending, function(k, p) {
48 // $.post("/update/slice", {}, function() {
53 //google.maps.event.addDomListener(window, 'load', initialize);
58 $.get("/rest/resource/", {"fields" : ["hostname","latitude","longitude"] }, function(data) {
61 center: new google.maps.LatLng(48.8567, 2.3508),
65 var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
66 marker = new google.maps.Marker({
67 position: new google.maps.LatLng(48.8567, 2.3508),
69 icon: '/static/img/marker2.png'
72 for (i = 0; i < data.length; i++) {
73 if (!data[i].longitude) continue;
74 marker = new google.maps.Marker({
75 position: new google.maps.LatLng(data[i].latitude, data[i].longitude),
78 var infowindow = new google.maps.InfoWindow();
80 google.maps.event.addListener(marker, 'click', (function(marker, i) {
82 infowindow.setContent(data[i].hostname);
83 infowindow.open(map, marker);