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
90daeec8
Commit
90daeec8
authored
Sep 22, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add disk usage function
parent
6fa988bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
debomatic-webui/lib/config.coffee
debomatic-webui/lib/config.coffee
+9
-0
debomatic-webui/lib/stats.coffee
debomatic-webui/lib/stats.coffee
+39
-1
No files found.
debomatic-webui/lib/config.coffee
View file @
90daeec8
...
@@ -90,6 +90,15 @@ config.debomatic.excluded_files = [
...
@@ -90,6 +90,15 @@ config.debomatic.excluded_files = [
"json"
"json"
]
]
###
List of subdirectories in distributions to show in disk usage
###
config
.
debomatic
.
disk_usage_subdirs
=
[
"aptcache"
"pool"
"chroot"
]
###
###
The routes, that are the pages urls
The routes, that are the pages urls
###
###
...
...
debomatic-webui/lib/stats.coffee
View file @
90daeec8
fs
=
require
(
'fs'
)
fs
=
require
(
'fs'
)
glob
=
require
(
'glob'
)
glob
=
require
(
'glob'
)
exec
=
require
(
'child_process'
).
exec
config
=
require
(
'./config'
)
config
=
require
(
'./config'
)
utils
=
require
(
'./utils'
)
utils
=
require
(
'./utils'
)
...
@@ -13,7 +14,7 @@ get_all_packages = (cb) ->
...
@@ -13,7 +14,7 @@ get_all_packages = (cb) ->
glob
"
#{
config
.
debomatic
.
path
}
/*/pool/*/*.json"
,
{},
(
err
,
files
)
->
glob
"
#{
config
.
debomatic
.
path
}
/*/pool/*/*.json"
,
{},
(
err
,
files
)
->
if
err
?
if
err
?
utils
.
errors_handler
"
history
:get_all_packages"
,
err
utils
.
errors_handler
"
stats
:get_all_packages"
,
err
return
return
packages
=
[]
packages
=
[]
for
f
in
files
for
f
in
files
...
@@ -30,4 +31,41 @@ get_all_packages = (cb) ->
...
@@ -30,4 +31,41 @@ get_all_packages = (cb) ->
cb
(
packages
)
cb
(
packages
)
get_disk_usage
=
(
cb
)
->
exec
"du -d 2
#{
config
.
debomatic
.
path
}
"
,
(
error
,
stdout
,
stderr
)
->
if
error
?
utils
.
errors_handler
"stats:get_disk_usage"
,
err
return
if
stderr
?
utils
.
errors_handler
"disk usage error: "
,
stderr
result
=
{}
for
line
in
stdout
.
split
(
'
\n
'
)
continue
if
line
==
''
info
=
line
.
replace
(
/\t+/g
,
' '
).
split
(
' '
)
size
=
info
[
0
]
dirs
=
info
[
1
].
replace
(
"
#{
config
.
debomatic
.
path
}
"
,
''
).
split
(
'/'
)
# case total size for debomatic incoming
if
dirs
.
length
<=
1
result
[
'size'
]
=
size
continue
distribution
=
dirs
[
1
]
if
not
result
[
distribution
]
?
result
[
distribution
]
=
{}
# case total size for distribution
if
dirs
.
length
==
2
result
[
distribution
][
'size'
]
=
size
continue
# case size for distribution/subdir
subdir
=
dirs
[
2
]
subdir
=
"chroot"
if
distribution
==
subdir
if
subdir
in
config
.
debomatic
.
disk_usage_subdirs
result
[
distribution
][
subdir
]
=
size
cb
(
result
)
module
.
exports
.
get_all_packages
=
get_all_packages
module
.
exports
.
get_all_packages
=
get_all_packages
module
.
exports
.
get_disk_usage
=
get_disk_usage
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