X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fmyslice-ui.js;h=bd31f5be6c3b64bff2464eb0b6b5b33ceb4e29a7;hb=52a0b9984635eab3576e652a3a55c7bb15f564d6;hp=4437941191bb5efd6760040cc6feb1042396878e;hpb=60d5030ca5a218e494a384ff61b1e24770da9f78;p=unfold.git diff --git a/portal/static/js/myslice-ui.js b/portal/static/js/myslice-ui.js index 44379411..bd31f5be 100644 --- a/portal/static/js/myslice-ui.js +++ b/portal/static/js/myslice-ui.js @@ -1,26 +1,28 @@ +/* + * Call it with level: success, info, warning, danger + */ +function mysliceAlert(msg, level, timeout) { + level = typeof level !== 'undefined' ? level : 'success'; + timeout = typeof timeout !== 'undefined' ? timeout : false; + var el = $('#myslice-message'); + el.find('.message').text(msg); + el.addClass('alert-' + level); + el.fadeIn('fast'); + el.parent().fadeIn('fast'); + if (timeout) { + setTimeout(function(){el.hide();},5000); + } +}; /* Table initialisation */ $(document).ready(function() { - - var platformParameters = {}; - - - $.get("/rest/platform", function(data) { - var list = '
Testbeds
'; - for(i=0; i'+data[i].platform_longname+'

'+data[i].platform+'

'; - } - $('#select-platform').html(list); - }).done(function() { - + $('button[type=submit]').click(function() { + $('form').submit(); }); - /* Testbeds list */ - $("div#testbed-list").ready(function() { - $("table#testbedList").load("/table/network/", { "fields" : ["network_hrn","description"], "options": ["checkbox"] }, function() { - - }); - }); + var platformParameters = {}; + + //mysliceAlert('hello','danger'); $("#objectList").load("/table/resource/", {"fields" : ["hostname","hrn","country","type"], "options": ["checkbox"] }, function(data) { $(this).dataTable( { @@ -37,7 +39,15 @@ $(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); + /* + if (myslice.count() > 0) { + $('#badge-pending').text(myslice.count()); + $('#badge-pending').show(); + } + */ } } } ); @@ -51,18 +61,20 @@ $(document).ready(function() { row.removeClass("active"); myslice.del(id); cnt = myslice.count(); + /* $('#badge-pending').text(cnt); if (cnt <= 0) { $('#badge-pending').hide(); - } + }*/ } else { row.addClass("active"); myslice.add(id); + /* cnt = myslice.count(); $('#badge-pending').text(cnt); if (cnt > 0) { $('#badge-pending').show(); - } + }*/ } }); });