Commit 54e883e8 authored by Leo Iannacone's avatar Leo Iannacone

added current debomatic status to footer

parent 45373a00
...@@ -2,6 +2,49 @@ function Page_Generic() ...@@ -2,6 +2,49 @@ function Page_Generic()
{ {
var socket; var socket;
function __get_status_html(status_package) {
classes = {}
classes.building = 'warning'
classes.successed = 'success'
classes.failed = 'danger'
icons = {}
icons.building = 'refresh'
icons.successed = ''
icons.failed = ''
s = status_package
li = $('<li></li>')
li.attr('id', 'status-' + s.distribution + "-" + s.package)
button = $('<a></a>')
button.addClass('btn btn-xs')
button.addClass(s.status)
button.attr('title', s.status + ': ' + s.distribution + ' > ' + s.package)
button.attr('href', config.paths.distribution + '#' + s.distribution + '/' + s.package.replace('_', '/') + '/datestamp')
button.html(s.package.split('_')[0])
//button.html(button.html() + ' <small class="distribution">[' + s.distribution + ']</small>')
if (s.status == 'building') {
button_class = classes.building
icon = icons.building
}
else if (s.status == 'build-failed') {
button_class = classes.failed
icon = icons.failed
}
else {
button_class = classes.successed
icon = icons.successed
}
button.addClass('btn-' + button_class)
button.html(button.html() + ' <span class="icon glyphicon glyphicon-' + icon + '"></span>')
li.html(button)
result = $('<div></div>')
result.html(li)
return result.html()
}
var update = { var update = {
distributions: function(distributions) { distributions: function(distributions) {
$('#distributions ul').html(''); $('#distributions ul').html('');
...@@ -14,6 +57,22 @@ function Page_Generic() ...@@ -14,6 +57,22 @@ function Page_Generic()
$("#distributions li[id='distribution-" + data.distribution.name + "']").addClass('active') $("#distributions li[id='distribution-" + data.distribution.name + "']").addClass('active')
} }
} }
},
status: function(new_package) {
}
}
var status = {
set: function(data_status) {
$("#status ul").html('')
if (data_status.packages.length > 0) {
$('#status .idle').hide()
data_status.packages.forEach(function(p){
$("#status ul").html($("#status ul").html() + " " + __get_status_html(p))
})
}
} }
} }
...@@ -28,9 +87,8 @@ function Page_Generic() ...@@ -28,9 +87,8 @@ function Page_Generic()
socket.on('error', function(data) { console.error(data) }); socket.on('error', function(data) { console.error(data) });
socket.on('status', function(data) { socket.on('status', function(data_status) {
console.log('status') status.set(data_status)
console.log(data)
}) })
socket.on(config.events.broadcast.status_update, function(data) { socket.on(config.events.broadcast.status_update, function(data) {
......
...@@ -28,6 +28,7 @@ footer { ...@@ -28,6 +28,7 @@ footer {
#status span { #status span {
font-weight: bold; font-weight: bold;
font-size: small;
} }
#status .packages { #status .packages {
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<%= web.footer %> <%= web.footer %>
</small> </small>
<div id="status" class="clearfix"> <div id="status" class="clearfix">
<span>status:</span> <span class="idle text-muted">Idle</span> <span class="label label-default">status:</span> <span class="idle text-muted">Idle</span>
<ul class="packages list-inline"></ul> <ul class="packages list-inline"></ul>
</div> </div>
</footer> </footer>
......
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