diff --git a/common/api.js b/common/api.js index 91b10da..5aae60a 100644 --- a/common/api.js +++ b/common/api.js @@ -59,7 +59,7 @@ const sendStatsToClients = (event) => { const subscribeToLicodeStatsStream = (streamId, duration, interval) => { log.debug(`Subscribing to licode stat stream id ${streamId} for ${duration}s with interval ${interval}s`); return new Promise((resolve, reject) => { - amqper.broadcast('ErizoJS', {method: 'subscribeToStats', args: [streamId, duration, interval]}, + amqper.broadcast('ErizoJS', {method: 'subscribeToStats', args: [parseInt(streamId), duration, interval]}, (response) => { resolve(response); }) diff --git a/public/javascripts/publishers.js b/public/javascripts/publishers.js index 82cecfa..dddf8ba 100644 --- a/public/javascripts/publishers.js +++ b/public/javascripts/publishers.js @@ -1,6 +1,43 @@ var socket = io(); var view_type = "list"; -var search; +var search = function() { + var filter_array = new Array(); + var filter = $('#searchBar')[0].value.toLowerCase(); // no need to call jQuery here + filter_array = filter.split(' '); // split the user input at the spaces + var arrayLength = filter_array.length; // Get the length of the filter array + + if (view_type == "grid" || view_type == "failed") { + $('.publisherContainer').each(function() { + var _this = $(this); + var title = _this.find('.pubName').text().toLowerCase(); + var hidden = 0; + for (var i = 0; i < arrayLength; i++) { + if (title.indexOf(filter_array[i]) < 0) { + _this.hide(); + hidden = 1; + } + } + if (hidden == 0) { + _this.show(); + } + }); + } else { + $('.publisher').each(function() { + var _this = $(this); + var title = _this.find('.pubName').text().toLowerCase(); + var hidden = 0; + for (var i = 0; i < arrayLength; i++) { + if (title.indexOf(filter_array[i]) < 0) { + _this.hide(); + hidden = 1; + } + } + if (hidden == 0) { + _this.show(); + } + }); + } +}; $(document).ready(function(){ @@ -41,45 +78,6 @@ $(document).ready(function(){ search(); }); - search = function() { - var filter_array = new Array(); - var filter = $('#searchBar')[0].value.toLowerCase(); // no need to call jQuery here - filter_array = filter.split(' '); // split the user input at the spaces - var arrayLength = filter_array.length; // Get the length of the filter array - - if (view_type == "grid" || view_type == "failed") { - $('.publisherContainer').each(function() { - var _this = $(this); - var title = _this.find('.pubName').text().toLowerCase(); - var hidden = 0; - for (var i = 0; i < arrayLength; i++) { - if (title.indexOf(filter_array[i]) < 0) { - _this.hide(); - hidden = 1; - } - } - if (hidden == 0) { - _this.show(); - } - }); - } else { - $('.publisher').each(function() { - var _this = $(this); - var title = _this.find('.pubName').text().toLowerCase(); - var hidden = 0; - for (var i = 0; i < arrayLength; i++) { - if (title.indexOf(filter_array[i]) < 0) { - _this.hide(); - hidden = 1; - } - } - if (hidden == 0) { - _this.show(); - } - }); - } - } - $('#list').click(function() { if (!$(this).hasClass("active")){ view_type = "list"; diff --git a/public/javascripts/rooms.js b/public/javascripts/rooms.js index ab9bb0c..7f00d81 100644 --- a/public/javascripts/rooms.js +++ b/public/javascripts/rooms.js @@ -1,51 +1,53 @@ var socket = io(); var show_grid = false; +var search = function() { + var filter_array = new Array(); + var filter = $('#searchBar')[0].value.toLowerCase(); // no need to call jQuery here + filter_array = filter.split(' '); // split the user input at the spaces + var arrayLength = filter_array.length; // Get the length of the filter array + if (show_grid) { + $('.roomContainer').each(function() { + var _this = $(this); + var title1 = _this.find('.roomId').text().toLowerCase(); + var title2 = _this.find('.roomName').text().toLowerCase(); + var hidden = 0; + for (var i = 0; i < arrayLength; i++) { + if (title1.indexOf(filter_array[i]) < 0 && title2.indexOf(filter_array[i]) < 0) { + _this.hide(); + hidden = 1; + } + } + if (hidden == 0) { + _this.show(); + } + }); + } else { + $('.room').each(function() { + var _this = $(this); + var title1 = _this.find('.roomID').text().toLowerCase(); + var title2 = _this.find('.roomName').text().toLowerCase(); + var hidden = 0; + for (var i = 0; i < arrayLength; i++) { + if (title1.indexOf(filter_array[i]) < 0 && title2.indexOf(filter_array[i]) < 0) { + _this.hide(); + hidden = 1; + } + } + if (hidden == 0) { + _this.show(); + } + }); + } +}; + $(document).ready(function(){ //Åšearch bar code $('#searchBar').keyup(function () { search(); }); - var search = function() { - var filter_array = new Array(); - var filter = $('#searchBar')[0].value.toLowerCase(); // no need to call jQuery here - filter_array = filter.split(' '); // split the user input at the spaces - var arrayLength = filter_array.length; // Get the length of the filter array - if (show_grid) { - $('.roomContainer').each(function() { - var _this = $(this); - var title1 = _this.find('.roomId').text().toLowerCase(); - var title2 = _this.find('.roomName').text().toLowerCase(); - var hidden = 0; - for (var i = 0; i < arrayLength; i++) { - if (title1.indexOf(filter_array[i]) < 0 && title2.indexOf(filter_array[i]) < 0) { - _this.hide(); - hidden = 1; - } - } - if (hidden == 0) { - _this.show(); - } - }); - } else { - $('.room').each(function() { - var _this = $(this); - var title1 = _this.find('.roomID').text().toLowerCase(); - var title2 = _this.find('.roomName').text().toLowerCase(); - var hidden = 0; - for (var i = 0; i < arrayLength; i++) { - if (title1.indexOf(filter_array[i]) < 0 && title2.indexOf(filter_array[i]) < 0) { - _this.hide(); - hidden = 1; - } - } - if (hidden == 0) { - _this.show(); - } - }); - } - } + // Grid/List switch $('#list').click(function() {