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