Commit 0154eeef authored by Leo Iannacone's avatar Leo Iannacone

client emit only one event: get-view

parent 3e408d77
......@@ -39,11 +39,13 @@ app.get('/', routes.index);
io.sockets.on('connection', function(socket) {
send.distributions(socket);
socket.on('get-packages-list', function(distro) {
send.packages_list(socket, distro);
});
socket.on('get-package', function(package_info) {
send.package(socket, package_info);
socket.on('get-view', function(data) {
if (! data.package) {
send.packages_list(socket, data);
}
else {
send.package(socket, data);
}
});
});
......
......@@ -36,11 +36,11 @@ debomatic_sender = {
});
},
packages_list: function(socket, distro) {
distro_path = path.join(BASE_DIR, distro, 'pool');
packages_list: function(socket, data) {
distro_path = path.join(BASE_DIR, data.distribution, 'pool');
get_files_list(distro_path, true, function (packages) {
result = {}
result.distribution = distro;
result.distribution = data.distribution;
result.packages = []
packages.forEach( function (p) {
pack = {}
......
......@@ -8,16 +8,15 @@
<script>
function get_path(path) {
info = path.split('/');
data = {}
if (info.length >= 1) {
socket.emit("get-packages-list", info[0]);
data.distribution = info[0];
}
if (info.length >= 3){
data = {}
data.distribution = info[0];
data.package = info[1];
data.version = info[2];
socket.emit("get-package", data);
}
socket.emit('get-view', data);
}
var socket = io.connect('//localhost:3000');
......
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