Commit 4179b71c authored by Leo Iannacone's avatar Leo Iannacone

fix appending more than one package with status building to status.packages -...

fix appending more than one package with status building to status.packages - preventing user double upload same package and ui store two same entries with status.building
parent 87084343
...@@ -14,24 +14,36 @@ function __watch_build_status (socket, status) { ...@@ -14,24 +14,36 @@ function __watch_build_status (socket, status) {
utils.errors_handler('Broadcaster:__watch_build_status:JSON.parse(new_content) - ', err, socket) utils.errors_handler('Broadcaster:__watch_build_status:JSON.parse(new_content) - ', err, socket)
return return
} }
if (data.status == config.status.package.building) {
status.packages.push(data) // looking for same package already in status.packages
} var index = -1
else if (data.status == config.status.package.sucessed
|| data.status == config.status.package.failed )
{
for(i = 0; i < status.packages.length; i++) for(i = 0; i < status.packages.length; i++)
{ {
p = status.packages[i] p = status.packages[i]
if ( p.package == data.package if ( p.package == data.package
&& p.distribution == data.distribution ) && p.distribution == data.distribution )
{ {
status.packages.splice(i, 1) index = i
break break
} }
} }
if (data.status == config.status.package.building) {
if (index == -1) { // not found in status.packages
status.packages.push(data)
socket.emit(config.events.broadcast.status_update, data)
return
}
}
if (data.status == config.status.package.successed
|| data.status == config.status.package.failed )
{
if (index >= 0) { // found in status.packages - remove
status.packages.splice(index, 1)
} }
socket.emit(config.events.broadcast.status_update, data) socket.emit(config.events.broadcast.status_update, 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