Commit e3912e86 authored by Leo Iannacone's avatar Leo Iannacone

made broadcasting events configurable and exported to web

parent 9abed306
......@@ -83,7 +83,7 @@ status_watcher.on('line', function(new_content) {
}
}
}
io.sockets.emit('status-update', data)
io.sockets.emit(config.events.broadcast.status_update, data)
})
var server = app.listen(config.port, function(){
......
......@@ -16,7 +16,16 @@ config.web.title = "deb-o-matic web.ui"
config.web.description = "This is a web interface for debomatic"
config.web.footer = "Fork me on github.com"
config.web.autoscroll = true
// do not edit these ones
config.events = {}
config.events.broadcast = {}
config.events.broadcast.distributions = 'distributions'
config.events.broadcast.status_update = 'status_update'
config.web.paths = config.routes
config.web.events = config.events
config.web.hostname = config.host + ((config.port == 80) ? null : ':' + config.port)
module.exports = config
......@@ -134,7 +134,7 @@ utils = {
},
send_distributions: function (socket, event_name) {
if (! event_name)
event_name = 'distributions'
event_name = config.events.broadcast.distributions
return __send_distributions(event_name, socket);
},
}
......
// update distributions
socket.on('distributions', function(distributions) {
socket.on(config.events.broadcast.distributions, function(distributions) {
$('#distributions ul').html('');
distributions.forEach(function (name){
$('#distributions ul').append('<li id="distribution-' + name +'"><a href="'+ config.paths.distribution + '#'+ name + '">' + name + '</li>');
......@@ -13,8 +13,8 @@ socket.on('status', function(data) {
console.log(data)
})
socket.on('status-update', function(data) {
console.log('status')
socket.on(config.events.broadcast.status_update, function(data) {
console.log('status_update')
console.log(data)
})
......
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