Commit 7595a9a6 authored by Leo Iannacone's avatar Leo Iannacone

do not use two events "get" and "set" for the same event name - useless

parent accf5a4f
......@@ -130,9 +130,9 @@ function __handler_get_file(socket, data) {
socket.emit(event_name, data);
});
if (config.web.file.preview.indexOf(data.file.name) >= 0 && !data.file.force)
__send_file(_e.file.set, socket, data, config.web.file.num_lines);
__send_file(_e.file, socket, data, config.web.file.num_lines);
else
__send_file(_e.file.set, socket, data);
__send_file(_e.file, socket, data);
}
function Client(socket) {
......@@ -142,21 +142,21 @@ function Client(socket) {
utils.send_distributions(socket);
// init events
socket.on(_e.distribution_packages.get, function (data) {
socket.on(_e.distribution_packages, function (data) {
if (!utils.check_data_distribution(data))
return;
var distribution_path = path.join(config.debomatic.path, data.distribution.name, 'pool');
utils.generic_handler_watcher(_e.distribution_packages.set, socket, data, distribution_path, __send_distribution_packages);
utils.generic_handler_watcher(_e.distribution_packages, socket, data, distribution_path, __send_distribution_packages);
});
socket.on(_e.package_files_list.get, function (data) {
socket.on(_e.package_files_list, function (data) {
if (!utils.check_data_package(data))
return;
var package_path = utils.get_package_path(data);
utils.generic_handler_watcher(_e.package_files_list.set, socket, data, package_path, __send_package_files_list);
utils.generic_handler_watcher(_e.package_files_list, socket, data, package_path, __send_package_files_list);
});
socket.on(_e.file.get, function (data) {
socket.on(_e.file, function (data) {
if (!utils.check_data_file(data))
return;
__handler_get_file(socket, data);
......
......@@ -69,15 +69,6 @@ config.web.preferences.debug = 0; // debug level - 0 means disabled
config.version = '0.4.1';
// A simple function to quickly have
// get and set strings for client events
function _event_get_set(event_name) {
return {
set: event_name,
get: 'get_' + event_name
};
}
config.debomatic.pidfile = "/var/run/debomatic-" +
require('crypto')
.createHash('sha256')
......@@ -92,10 +83,10 @@ config.events.broadcast.status_update = 'status_update';
config.events.broadcast.status_debomatic = 'status_debomatic';
config.events.client = {};
config.events.client.distribution_packages = _event_get_set('distribution_packages');
config.events.client.distribution_packages = 'distribution_packages';
config.events.client.distribution_packages.status = 'package_status';
config.events.client.package_files_list = _event_get_set('package_files_list');
config.events.client.file = _event_get_set('file');
config.events.client.package_files_list = 'package_files_list';
config.events.client.file = 'file';
config.events.client.file_newcontent = 'file_newcontent';
config.events.client.status = 'status';
......
......@@ -159,8 +159,8 @@ function Page_Distrubion(socket) {
if (Utils.check_view_distribution(view)) {
var query_data = {};
query_data.distribution = view.distribution;
debug_socket('emit', _e.distribution_packages.get, query_data);
socket.emit(_e.distribution_packages.get, query_data);
debug_socket('emit', _e.distribution_packages, query_data);
socket.emit(_e.distribution_packages, query_data);
}
},
select: function () {
......@@ -256,8 +256,8 @@ function Page_Distrubion(socket) {
var query_data = {};
query_data.distribution = view.distribution;
query_data.package = view.package;
debug_socket('emit', _e.package_files_list.get, query_data);
socket.emit(_e.package_files_list.get, query_data);
debug_socket('emit', _e.package_files_list, query_data);
socket.emit(_e.package_files_list, query_data);
}
},
select: function () {
......@@ -331,8 +331,8 @@ function Page_Distrubion(socket) {
// get a feedback to user while downloading file
$('#file pre').html('Downloading file, please wait a while ...');
$('#file').show();
debug_socket('emit', _e.file.get, query_data);
socket.emit(_e.file.get, query_data);
debug_socket('emit', _e.file, query_data);
socket.emit(_e.file, query_data);
}
},
set_preview: function (preview) {
......@@ -584,13 +584,13 @@ function Page_Distrubion(socket) {
welcome.set(socket_data);
});
socket.on(_e.distribution_packages.set, function (socket_data) {
debug_socket('received', _e.distribution_packages.set, socket_data);
socket.on(_e.distribution_packages, function (socket_data) {
debug_socket('received', _e.distribution_packages, socket_data);
packages.set(socket_data);
});
socket.on(_e.distribution_packages.status, function (socket_data) {
debug_socket('received', _e.distribution_packages.set, socket_data);
debug_socket('received', _e.distribution_packages, socket_data);
packages.set_status(socket_data);
sticky.set_status(socket_data);
});
......@@ -600,13 +600,13 @@ function Page_Distrubion(socket) {
sticky.set_status(socket_data);
});
socket.on(_e.package_files_list.set, function (socket_data) {
debug_socket('received', _e.package_files_list.set, socket_data);
socket.on(_e.package_files_list, function (socket_data) {
debug_socket('received', _e.package_files_list, socket_data);
files.set(socket_data);
});
socket.on(_e.file.set, function (socket_data) {
debug_socket('received', _e.file.set, socket_data);
socket.on(_e.file, function (socket_data) {
debug_socket('received', _e.file, socket_data);
file.set(socket_data);
});
......@@ -648,7 +648,7 @@ function Page_Distrubion(socket) {
// when page is loaded sidebar has offset().top
// equals 0. This is because html is loaded on socket
// events. Sleep a while and call stiky.reset()
setTimeout(sticky.reset, 500);
setTimeout(sticky.r, 500);
// WORKAROUND:
// On incoming hundred of lines browser goes crazy.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment