X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fmyslice-ui.js;h=b8b331a7eac53a0c12f05ce07636fab231597486;hb=4f412c5d376e32ebace33044d493b59db70761c5;hp=e2e8ad949ce169f17250ee8e84d2b7c06b409a66;hpb=6049329c319ed167723f805f732977fc1c462b39;p=unfold.git diff --git a/portal/static/js/myslice-ui.js b/portal/static/js/myslice-ui.js index e2e8ad94..b8b331a7 100644 --- a/portal/static/js/myslice-ui.js +++ b/portal/static/js/myslice-ui.js @@ -2,19 +2,30 @@ /* * Call it with level: success, info, warning, danger */ -function mysliceAlert(msg, level = 'warning') { - var el = $('#myslice-message') +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.alert('close');},5000); + } +}; /* Table initialisation */ $(document).ready(function() { + $('button[type=submit]').click(function() { + $('form').submit(); + }); var platformParameters = {}; - - + $('#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) { @@ -35,10 +46,12 @@ $(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(); } + */ } } } ); @@ -52,18 +65,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(); - } + }*/ } }); });