Skip to content

Commit

Permalink
Fix subscriptions to stats (lynckia#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Oct 23, 2020
1 parent d7265d7 commit d3eacae
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
Expand Down
78 changes: 38 additions & 40 deletions public/javascripts/publishers.js
Original file line number Diff line number Diff line change
@@ -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(){

Expand Down Expand Up @@ -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";
Expand Down
80 changes: 41 additions & 39 deletions public/javascripts/rooms.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down

0 comments on commit d3eacae

Please sign in to comment.