Commit c4289870 authored by Leo Iannacone's avatar Leo Iannacone

refactored functions name

parent 37f31637
...@@ -22,8 +22,8 @@ function Page_Generic() ...@@ -22,8 +22,8 @@ function Page_Generic()
return result.html() return result.html()
} }
var update = { var distributions = {
distributions: function(distributions) { set: function(distributions) {
$('#distributions ul').html(''); $('#distributions ul').html('');
if(distributions.length < 1) { if(distributions.length < 1) {
$('#distributions ul').append('<li><a title="There is no distribution at the moment" onclick="return false">None</li>') $('#distributions ul').append('<li><a title="There is no distribution at the moment" onclick="return false">None</li>')
...@@ -40,8 +40,22 @@ function Page_Generic() ...@@ -40,8 +40,22 @@ function Page_Generic()
} }
} }
}, },
}
status: function(status_package) { var status = {
set: function(data_status) {
$("#status ul").html('')
if (data_status.packages.length > 0) {
data_status.packages.forEach(function(p){
status.append(p)
})
}
},
append: function(status_package) {
$('#status .idle').hide()
$("#status ul").html($("#status ul").html() + " " + __get_status_html(status_package))
},
update: function(status_package) {
var li = $("#status li[id='status-" + status_package.distribution + "-" + status_package.package + "']") var li = $("#status li[id='status-" + status_package.distribution + "-" + status_package.package + "']")
if (li.length > 0 if (li.length > 0
...@@ -71,22 +85,7 @@ function Page_Generic() ...@@ -71,22 +85,7 @@ function Page_Generic()
else if (status_package.status == config.status.package.building) { else if (status_package.status == config.status.package.building) {
status.append(status_package) status.append(status_package)
} }
}
}
var status = {
set: function(data_status) {
$("#status ul").html('')
if (data_status.packages.length > 0) {
data_status.packages.forEach(function(p){
status.append(p)
})
}
}, },
append: function(status_package) {
$('#status .idle').hide()
$("#status ul").html($("#status ul").html() + " " + __get_status_html(status_package))
}
} }
this.init = function(mysocket) { this.init = function(mysocket) {
...@@ -95,18 +94,18 @@ function Page_Generic() ...@@ -95,18 +94,18 @@ function Page_Generic()
socket = mysocket socket = mysocket
// update distributions // update distributions
socket.on(_e.broadcast.distributions, function(distributions) { socket.on(_e.broadcast.distributions, function(socket_distributions) {
update.distributions(distributions) distributions.set(socket_distributions)
}); });
socket.on('error', function(data) { consol_e.error(data) }); socket.on('error', function(data) { consol_e.error(data) });
socket.on(_e.client.status, function(packages) { socket.on(_e.client.status, function(packages_status) {
status.set(packages) status.set(packages_status)
}) })
socket.on(_e.broadcast.status_update, function(package_status) { socket.on(_e.broadcast.status_update, function(package_status) {
update.status(package_status) status.update(package_status)
}) })
} }
} }
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