mysliceMessage() js function can be used to display a message
[unfold.git] / portal / static / js / myslice-ui.js
index 1f62c47..060269a 100644 (file)
@@ -1,18 +1,22 @@
 
+/*
+ * Call it with level: success, info, warning, danger
+ */
+function mysliceAlert(msg, level) {
+       level = typeof level !== 'undefined' ? level : 'success';
+       var el = $('#myslice-message');
+       el.find('.message').text(msg);
+       el.addClass('alert-' + level);
+       el.fadeIn('fast');
+};
 /* 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() {
-                       
-               });
-       });
+       
        
        $("#objectList").load("/table/resource/", {"fields" : ["hostname","hrn","country","type"], "options": ["checkbox"] }, function(data) {
                $(this).dataTable( {
@@ -29,7 +33,13 @@ $(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();
+                                       }
                                }
                    }
                } );