X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fmyslice-ui.js;h=1c91ccd2983d6a7c17475fa95529f55b16238978;hb=e7c6e9d4d40c322684dc0433eb85a7bf85f68f7f;hp=0003057f24f33958bf644dca9deefce950142ba6;hpb=bc8220e51030e8263081d53c7793a4a350a6e314;p=unfold.git diff --git a/portal/static/js/myslice-ui.js b/portal/static/js/myslice-ui.js index 0003057f..1c91ccd2 100644 --- a/portal/static/js/myslice-ui.js +++ b/portal/static/js/myslice-ui.js @@ -1,18 +1,29 @@ +/* + * 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.parent().fadeIn('fast'); + if (timeout) { + setTimeout(function(){el.alert('close');},5000); + } +}; /* Table initialisation */ $(document).ready(function() { var platformParameters = {}; - - - - /* Testbeds list */ - $("div#testbed-list").ready(function() { - $("table#testbedList").load("/table/network/", { "fields" : ["network_hrn","description"], "options": ["checkbox"] }, function() { - - }); + $('#myslice-message').bind('closed.bs.alert', function () { + $(this).parent().hide(); }); + + mysliceAlert('hello','danger'); + $("#objectList").load("/table/resource/", {"fields" : ["hostname","hrn","country","type"], "options": ["checkbox"] }, function(data) { $(this).dataTable( { @@ -32,6 +43,10 @@ $(document).ready(function() { 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(); + } } } } );