Commit 6d89a2b3 authored by Leo Iannacone's avatar Leo Iannacone

build statuses are now in config - renamed status.classes in status.className in web

parent 4fbb3858
......@@ -13,11 +13,11 @@ function __watch_build_status (socket, status) {
try {
data = JSON.parse(new_content)
} catch (error) { return }
if (data.status == 'building') {
if (data.status == config.status.package.building) {
status.packages.push(data)
}
else if (data.status == 'build-successed'
|| data.status == 'build-failed' )
else if (data.status == config.status.package.sucessed
|| data.status == config.status.package.failed )
{
for(i = 0; i < status.packages.length; i++)
{
......
......@@ -65,7 +65,7 @@ function __send_package_status(socket, data, package_data) {
console.log(base_path)
fs.exists(base_path + '.dsc', function(changes_exists){
if (changes_exists) {
status_data.status = 'build-successed'
status_data.status = config.status.package.successed
socket.emit(event_name, status_data)
}
else {
......@@ -82,9 +82,9 @@ function __send_package_status(socket, data, package_data) {
})
.on('end', function() {
if (count <= 1)
status_data.status = 'building'
status_data.status = config.status.package.building
else
status_data.status = 'build-failed'
status_data.status = config.status.package.failed
socket.emit(event_name, status_data)
});
}
......
......@@ -40,8 +40,16 @@ config.events.client.file = __build_get_set('file')
config.events.client.file_newcontent = 'file_newcontent'
config.events.client.status = 'status'
config.status = {}
config.status.package = {}
config.status.package.building = 'building'
config.status.package.failed = 'build-failed'
config.status.package.successed = 'build-successed'
// export some variable
config.web.paths = config.routes
config.web.events = config.events
config.web.status = config.status
config.web.hostname = config.host + ((config.port == 80) ? null : ':' + config.port)
module.exports = config
......@@ -3,16 +3,16 @@ function Page_Generic()
var socket;
function __get_status_icon_and_class(status_package) {
var _c = config.status.classes
var _c = config.status.className
var _i = config.status.icons
var button_class = null
var icon = null
var s = status_package
if (s.status == 'building') {
if (s.status == config.status.package.building) {
button_class = _c.building
icon = _i.building
}
else if (s.status == 'build-failed') {
else if (s.status == config.status.package.failed) {
button_class = _c.failed
icon = _i.failed
}
......@@ -63,7 +63,7 @@ function Page_Generic()
var li = $("#status li[id='status-" + status_package.distribution + "-" + status_package.package + "']")
if (li.length > 0
&& status_package.status != 'building')
&& status_package.status != config.status.package.building)
{
// Update color and icon
li.html($(__get_status_html(status_package)).children())
......@@ -86,7 +86,7 @@ function Page_Generic()
}, config.status.delay.remove + 2000) // more delay on remove html
}, config.status.delay.remove)
}
else if (status_package.status == 'building') {
else if (status_package.status == config.status.package.building) {
status.append(status_package)
}
}
......
......@@ -46,11 +46,10 @@
<script>
var config = <%- JSON.stringify(web) %>
config.status = {}
config.status.classes = {}
config.status.classes.building = 'info'
config.status.classes.successed = 'success'
config.status.classes.failed = 'danger'
config.status.className = {}
config.status.className.building = 'info'
config.status.className.successed = 'success'
config.status.className.failed = 'danger'
config.status.icons = {}
config.status.icons.building = 'refresh'
......
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