Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
db1b8d77
Commit
db1b8d77
authored
Mar 09, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added build status watcher - use new module JSONLogger for debomatic
parent
5c6c5d63
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
6 deletions
+39
-6
debomatic-webui/index.js
debomatic-webui/index.js
+37
-3
debomatic-webui/lib/client.js
debomatic-webui/lib/client.js
+0
-2
debomatic-webui/lib/config.js
debomatic-webui/lib/config.js
+1
-0
debomatic-webui/lib/utils.js
debomatic-webui/lib/utils.js
+1
-1
No files found.
debomatic-webui/index.js
View file @
db1b8d77
...
@@ -7,11 +7,17 @@ var express = require('express')
...
@@ -7,11 +7,17 @@ var express = require('express')
,
routes
=
require
(
'
./routes
'
)
,
routes
=
require
(
'
./routes
'
)
,
fs
=
require
(
'
fs
'
)
,
fs
=
require
(
'
fs
'
)
,
path
=
require
(
'
path
'
)
,
path
=
require
(
'
path
'
)
,
Tail
=
require
(
'
tail
'
).
Tail
,
config
=
require
(
'
./lib/config.js
'
)
,
config
=
require
(
'
./lib/config.js
'
)
,
client
=
require
(
'
./lib/client.js
'
)
,
client
=
require
(
'
./lib/client.js
'
)
,
utils
=
require
(
'
./lib/utils.js
'
)
,
utils
=
require
(
'
./lib/utils.js
'
)
var
app
=
module
.
exports
=
express
.
createServer
();
var
app
=
module
.
exports
=
express
.
createServer
();
var
io
=
require
(
'
socket.io
'
).
listen
(
app
);
// status
var
status
=
{}
status
.
packages
=
[]
// Configuration
// Configuration
app
.
configure
(
function
(){
app
.
configure
(
function
(){
...
@@ -33,13 +39,13 @@ app.configure('production', function(){
...
@@ -33,13 +39,13 @@ app.configure('production', function(){
app
.
use
(
express
.
errorHandler
());
app
.
use
(
express
.
errorHandler
());
});
});
var
io
=
require
(
'
socket.io
'
).
listen
(
app
);
// Routes
// Routes
app
.
get
(
'
/
'
,
routes
.
index
);
app
.
get
(
'
/
'
,
routes
.
index
);
app
.
get
(
config
.
routes
.
distribution
,
routes
.
distribution
)
app
.
get
(
config
.
routes
.
distribution
,
routes
.
distribution
)
io
.
sockets
.
on
(
'
connection
'
,
function
(
socket
)
{
io
.
sockets
.
on
(
'
connection
'
,
function
(
socket
)
{
utils
.
send_distributions
(
socket
)
socket
.
emit
(
'
status
'
,
status
)
client
(
socket
)
client
(
socket
)
});
});
...
@@ -47,11 +53,39 @@ io.sockets.on('disconnect', function(socket){
...
@@ -47,11 +53,39 @@ io.sockets.on('disconnect', function(socket){
});
});
// watch
for
new distributions
// watch
er on
new distributions
fs
.
watch
(
config
.
debomatic
.
path
,
{
persistent
:
true
},
function
(
event
,
fileName
)
{
fs
.
watch
(
config
.
debomatic
.
path
,
{
persistent
:
true
},
function
(
event
,
fileName
)
{
utils
.
send_distributions
(
io
.
sockets
);
utils
.
send_distributions
(
io
.
sockets
);
});
});
// watcher on build_status
status_watcher
=
new
Tail
(
config
.
debomatic
.
jsonfile
)
status_watcher
.
on
(
'
line
'
,
function
(
new_content
)
{
data
=
null
try
{
data
=
JSON
.
parse
(
new_content
)
}
catch
(
error
)
{
return
}
if
(
data
.
status
==
'
building
'
)
{
status
.
packages
.
push
(
data
)
}
else
if
(
data
.
status
==
'
build-successed
'
||
data
.
status
==
'
build-failed
'
)
{
for
(
i
=
0
;
i
<
status
.
packages
.
length
;
i
++
)
{
p
=
status
.
packages
[
i
]
if
(
p
.
package
==
data
.
package
&&
p
.
distribution
==
data
.
distribution
)
{
status
.
packages
.
splice
(
i
,
1
)
break
}
}
}
io
.
sockets
.
emit
(
'
status-update
'
,
data
)
})
var
server
=
app
.
listen
(
config
.
port
,
function
(){
var
server
=
app
.
listen
(
config
.
port
,
function
(){
console
.
log
(
"
Express server listening on port %d in %s mode
"
,
app
.
address
().
port
,
app
.
settings
.
env
);
console
.
log
(
"
Express server listening on port %d in %s mode
"
,
app
.
address
().
port
,
app
.
settings
.
env
);
});
});
debomatic-webui/lib/client.js
View file @
db1b8d77
...
@@ -88,8 +88,6 @@ function __handler_file_newcontent(event_name, socket, data) {
...
@@ -88,8 +88,6 @@ function __handler_file_newcontent(event_name, socket, data) {
Client
=
function
(
socket
)
{
Client
=
function
(
socket
)
{
utils
.
send_distributions
(
socket
)
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_distribution
(
data
))
if
(
!
utils
.
check_data_distribution
(
data
))
return
return
...
...
debomatic-webui/lib/config.js
View file @
db1b8d77
...
@@ -5,6 +5,7 @@ config.port = 3000
...
@@ -5,6 +5,7 @@ config.port = 3000
config
.
debomatic
=
{}
config
.
debomatic
=
{}
config
.
debomatic
.
path
=
'
/srv/debomatic-amd64
'
config
.
debomatic
.
path
=
'
/srv/debomatic-amd64
'
config
.
debomatic
.
jsonfile
=
'
/var/log/debomatic.json
'
config
.
routes
=
{}
config
.
routes
=
{}
config
.
routes
.
debomatic
=
'
/debomatic
'
config
.
routes
.
debomatic
=
'
/debomatic
'
...
...
debomatic-webui/lib/utils.js
View file @
db1b8d77
...
@@ -129,7 +129,7 @@ utils = {
...
@@ -129,7 +129,7 @@ utils = {
if
(
!
event_name
)
if
(
!
event_name
)
event_name
=
'
distributions
'
event_name
=
'
distributions
'
return
__send_distributions
(
event_name
,
socket
);
return
__send_distributions
(
event_name
,
socket
);
}
}
,
}
}
module
.
exports
=
utils
module
.
exports
=
utils
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment