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
8125968a
Commit
8125968a
authored
Sep 15, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'github/master' into portable
parents
8225c468
300f0309
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
41 deletions
+77
-41
debomatic-webui/lib/client.coffee
debomatic-webui/lib/client.coffee
+5
-0
debomatic-webui/lib/config.coffee
debomatic-webui/lib/config.coffee
+1
-0
debomatic-webui/lib/debomatic.coffee
debomatic-webui/lib/debomatic.coffee
+2
-11
debomatic-webui/lib/stats.coffee
debomatic-webui/lib/stats.coffee
+33
-0
debomatic-webui/lib/utils.coffee
debomatic-webui/lib/utils.coffee
+10
-0
debomatic-webui/public/javascripts/page_history.js
debomatic-webui/public/javascripts/page_history.js
+24
-14
debomatic-webui/routes/index.coffee
debomatic-webui/routes/index.coffee
+2
-15
debomatic-webui/views/history.ejs
debomatic-webui/views/history.ejs
+0
-1
No files found.
debomatic-webui/lib/client.coffee
View file @
8125968a
...
@@ -2,6 +2,7 @@ fs = require("fs")
...
@@ -2,6 +2,7 @@ fs = require("fs")
path
=
require
(
"path"
)
path
=
require
(
"path"
)
config
=
require
(
"./config"
)
config
=
require
(
"./config"
)
utils
=
require
(
"./utils"
)
utils
=
require
(
"./utils"
)
stats
=
require
(
"./stats"
)
e
=
config
.
events
.
client
e
=
config
.
events
.
client
get_files_list_from_package
=
(
data
,
callback
)
->
get_files_list_from_package
=
(
data
,
callback
)
->
...
@@ -138,6 +139,10 @@ class Client
...
@@ -138,6 +139,10 @@ class Client
read_package_status
data
,
(
content
)
=>
read_package_status
data
,
(
content
)
=>
@
socket
.
emit
e
.
package_info
,
content
@
socket
.
emit
e
.
package_info
,
content
@
socket
.
on
e
.
history
,
()
=>
stats
.
get_all_packages
(
packages
)
=>
@
socket
.
emit
e
.
history
,
packages
# on client disconnection close all watchers
# on client disconnection close all watchers
@
socket
.
on
"disconnect"
,
=>
@
socket
.
on
"disconnect"
,
=>
socket_watchers
=
@
socket
.
watchers
socket_watchers
=
@
socket
.
watchers
...
...
debomatic-webui/lib/config.coffee
View file @
8125968a
...
@@ -117,6 +117,7 @@ config.events.client.package_info = "c.package_info"
...
@@ -117,6 +117,7 @@ config.events.client.package_info = "c.package_info"
config
.
events
.
client
.
file
=
"c.file"
config
.
events
.
client
.
file
=
"c.file"
config
.
events
.
client
.
file_newcontent
=
"c.file_newcontent"
config
.
events
.
client
.
file_newcontent
=
"c.file_newcontent"
config
.
events
.
client
.
status
=
"c.status"
config
.
events
.
client
.
status
=
"c.status"
config
.
events
.
client
.
history
=
"c.history"
###
###
The status according with JSONLogger.py module
The status according with JSONLogger.py module
...
...
debomatic-webui/lib/debomatic.coffee
View file @
8125968a
fs
=
require
(
"fs"
)
fs
=
require
(
"fs"
)
glob
=
require
(
"glob"
)
config
=
require
(
"./config"
)
config
=
require
(
"./config"
)
utils
=
require
(
"./utils"
)
utils
=
require
(
"./utils"
)
Tail
=
utils
.
Tail
Tail
=
utils
.
Tail
e
=
config
.
events
.
broadcast
e
=
config
.
events
.
broadcast
_get_distributions
=
(
callback
)
->
glob
"
#{
config
.
debomatic
.
path
}
/*/pool"
,
{},
(
err
,
directories
)
->
distributions
=
[]
for
dir
in
directories
name
=
dir
.
split
(
'/'
)[
-
2
..][
0
]
distributions
.
push
name
callback
(
distributions
)
class
Debomatic
class
Debomatic
...
@@ -20,13 +11,13 @@ class Debomatic
...
@@ -20,13 +11,13 @@ class Debomatic
@
status
=
{}
@
status
=
{}
@
distributions
=
[]
@
distributions
=
[]
@
running
=
fs
.
existsSync
(
config
.
debomatic
.
pidfile
)
@
running
=
fs
.
existsSync
(
config
.
debomatic
.
pidfile
)
_
get_distributions
(
distributions
)
=>
@
distributions
=
distributions
utils
.
get_distributions
(
distributions
)
=>
@
distributions
=
distributions
# watcher on new distributions
# watcher on new distributions
watch_distributions
:
->
watch_distributions
:
->
fs
.
watch
config
.
debomatic
.
path
,
(
event
,
fileName
)
=>
fs
.
watch
config
.
debomatic
.
path
,
(
event
,
fileName
)
=>
check
=
=>
check
=
=>
_
get_distributions
(
new_distributions
)
=>
utils
.
get_distributions
(
new_distributions
)
=>
if
not
utils
.
arrayEqual
(
@
distributions
,
new_distributions
)
if
not
utils
.
arrayEqual
(
@
distributions
,
new_distributions
)
@
distributions
=
new_distributions
@
distributions
=
new_distributions
@
sockets
.
emit
(
e
.
distributions
,
@
distributions
)
@
sockets
.
emit
(
e
.
distributions
,
@
distributions
)
...
...
debomatic-webui/lib/stats.coffee
0 → 100644
View file @
8125968a
fs
=
require
(
'fs'
)
glob
=
require
(
'glob'
)
config
=
require
(
'./config'
)
utils
=
require
(
'./utils'
)
get_all_packages
=
(
cb
)
->
compare
=
(
a
,
b
)
->
if
a
.
start
<
b
.
start
return
-
1
if
a
.
start
>
b
.
start
return
1
return
0
glob
"
#{
config
.
debomatic
.
path
}
/*/pool/*/*.json"
,
{},
(
err
,
files
)
->
if
err
?
utils
.
errors_handler
"history:get_all_packages"
,
err
return
packages
=
[]
for
f
in
files
fs
.
readFile
f
,
(
readerr
,
data
)
->
if
readerr
?
utils
.
errors_handler
"history:get_all_packages:readFile"
,
readerr
json
=
''
else
json
=
JSON
.
parse
(
data
)
delete
json
.
files
packages
.
push
(
json
)
if
packages
.
length
==
files
.
length
packages
.
sort
(
compare
)
cb
(
packages
)
module
.
exports
.
get_all_packages
=
get_all_packages
debomatic-webui/lib/utils.coffee
View file @
8125968a
path
=
require
(
"path"
)
path
=
require
(
"path"
)
fs
=
require
(
"fs"
)
fs
=
require
(
"fs"
)
config
=
require
(
"./config"
)
config
=
require
(
"./config"
)
glob
=
require
(
"glob"
)
Tail
=
require
(
"tail"
).
Tail
Tail
=
require
(
"tail"
).
Tail
_check_no_backward
=
(
backward_path
)
->
_check_no_backward
=
(
backward_path
)
->
...
@@ -27,6 +28,14 @@ check_data_file = (data) ->
...
@@ -27,6 +28,14 @@ check_data_file = (data) ->
_check_no_backward
(
data
.
file
.
name
)
_check_no_backward
(
data
.
file
.
name
)
get_distributions
=
(
callback
)
->
glob
"
#{
config
.
debomatic
.
path
}
/*/pool"
,
{},
(
err
,
directories
)
->
if
err
errors_handler
"get_distributions"
,
err
return
distributions
=
(
dir
.
split
(
path
.
sep
)[
-
2
...
-
1
]
for
dir
in
directories
)
callback
(
distributions
)
get_distribution_pool_path
=
(
data
)
->
get_distribution_pool_path
=
(
data
)
->
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
"pool"
)
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
"pool"
)
...
@@ -132,6 +141,7 @@ Tail::close = ->
...
@@ -132,6 +141,7 @@ Tail::close = ->
module
.
exports
.
check_data_distribution
=
check_data_distribution
module
.
exports
.
check_data_distribution
=
check_data_distribution
module
.
exports
.
check_data_package
=
check_data_package
module
.
exports
.
check_data_package
=
check_data_package
module
.
exports
.
check_data_file
=
check_data_file
module
.
exports
.
check_data_file
=
check_data_file
module
.
exports
.
get_distributions
=
get_distributions
module
.
exports
.
get_distribution_pool_path
=
get_distribution_pool_path
module
.
exports
.
get_distribution_pool_path
=
get_distribution_pool_path
module
.
exports
.
get_package_path
=
get_package_path
module
.
exports
.
get_package_path
=
get_package_path
module
.
exports
.
get_file_path
=
get_file_path
module
.
exports
.
get_file_path
=
get_file_path
...
...
debomatic-webui/public/javascripts/page_history.js
View file @
8125968a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
/* global Chartist: false */
/* global Chartist: false */
/* global debug: false */
/* global debug: false */
/* global debug_socket: false */
/* global debug_socket: false */
/* global
dom_history
: false */
/* global
socket
: false */
function
Page_History
()
{
function
Page_History
()
{
...
@@ -234,21 +234,31 @@ function Page_History() {
...
@@ -234,21 +234,31 @@ function Page_History() {
socket
.
on
(
config
.
events
.
broadcast
.
status_update
,
function
(
socket_data
)
{
socket
.
on
(
config
.
events
.
broadcast
.
status_update
,
function
(
socket_data
)
{
// TODO - implements _update_table
// TODO - implements _update_table
});
});
};
socket
.
on
(
config
.
events
.
client
.
history
,
function
(
socket_data
)
{
debug_socket
(
'
received
'
,
config
.
events
.
client
.
history
,
socket_data
);
distributions_counter
=
{};
days_counter
=
{};
all_distributions
=
[];
all_days
=
[];
$
(
'
#history .tbody
'
).
html
(
''
);
// init table and some objects
for
(
var
i
=
0
;
i
<
socket_data
.
length
;
i
++
)
{
var
p
=
socket_data
[
i
];
_add_row
(
p
);
// count stats
_count_distributions
(
p
);
_count_days
(
p
);
}
all_distributions
.
sort
();
_sort_table
();
_create_graph_distributions
();
_create_graph_days
();
});
// init table and some objects
debug_socket
(
'
emit
'
,
config
.
events
.
client
.
history
,
''
);
for
(
var
i
=
0
;
i
<
dom_history
.
length
;
i
++
)
{
socket
.
emit
(
config
.
events
.
client
.
history
);
var
p
=
dom_history
[
i
];
};
_add_row
(
p
);
// count stats
_count_distributions
(
p
);
_count_days
(
p
);
}
all_distributions
.
sort
();
_sort_table
();
_create_graph_distributions
();
_create_graph_days
();
$
(
'
#download
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#download
'
).
on
(
'
click
'
,
function
()
{
_exportTableToCSV
.
apply
(
this
,
[
$
(
'
#history
'
),
'
history.csv
'
]);
_exportTableToCSV
.
apply
(
this
,
[
$
(
'
#history
'
),
'
history.csv
'
]);
...
...
debomatic-webui/routes/index.coffee
View file @
8125968a
...
@@ -19,18 +19,5 @@ exports.commands = (req, res) ->
...
@@ -19,18 +19,5 @@ exports.commands = (req, res) ->
return
return
exports
.
history
=
(
req
,
res
)
->
exports
.
history
=
(
req
,
res
)
->
glob
"
#{
config
.
debomatic
.
path
}
/*/pool/*/*.json"
,
{},
(
err
,
files
)
->
res
.
render
"history"
,
config
get_info
=
(
json_path
)
->
return
json
=
JSON
.
parse
(
fs
.
readFileSync
(
json_path
,
'utf8'
))
delete
json
.
files
return
json
compare
=
(
a
,
b
)
->
if
a
.
start
<
b
.
start
return
-
1
if
a
.
start
>
b
.
start
return
1
return
0
config
.
history
=
(
get_info
(
f
)
for
f
in
files
)
config
.
history
.
sort
(
compare
)
res
.
render
"history"
,
config
debomatic-webui/views/history.ejs
View file @
8125968a
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
<p class="lead text-muted">
<p class="lead text-muted">
The log of packages
The log of packages
</p>
</p>
<script> var dom_history = <%- JSON.stringify(history) %> </script>
<div id="charts">
<div id="charts">
<div id="days-chart" class="ct-chart"></div>
<div id="days-chart" class="ct-chart"></div>
<div id="distributions-chart" class="ct-chart"></div>
<div id="distributions-chart" class="ct-chart"></div>
...
...
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