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
5c3ecd2d
Commit
5c3ecd2d
authored
Apr 08, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into portable
parents
5dab766b
94ee6bd6
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
277 additions
and
152 deletions
+277
-152
debomatic-modules/JSONLogger.py
debomatic-modules/JSONLogger.py
+53
-25
debomatic-webui/debomatic-webui
debomatic-webui/debomatic-webui
+2
-3
debomatic-webui/lib/broadcaster.js
debomatic-webui/lib/broadcaster.js
+30
-30
debomatic-webui/lib/client.js
debomatic-webui/lib/client.js
+6
-7
debomatic-webui/lib/config.js
debomatic-webui/lib/config.js
+8
-8
debomatic-webui/public/javascripts/main.js
debomatic-webui/public/javascripts/main.js
+1
-1
debomatic-webui/public/javascripts/page_distribution.js
debomatic-webui/public/javascripts/page_distribution.js
+51
-24
debomatic-webui/public/javascripts/page_generic.js
debomatic-webui/public/javascripts/page_generic.js
+60
-29
debomatic-webui/public/javascripts/utils.js
debomatic-webui/public/javascripts/utils.js
+11
-9
debomatic-webui/views/distribution.ejs
debomatic-webui/views/distribution.ejs
+6
-2
debomatic-webui/views/footer.ejs
debomatic-webui/views/footer.ejs
+17
-13
debomatic-webui/views/header.ejs
debomatic-webui/views/header.ejs
+2
-1
scripts/do_release.sh
scripts/do_release.sh
+30
-0
No files found.
debomatic-modules/JSONLogger.py
View file @
5c3ecd2d
...
@@ -17,47 +17,75 @@
...
@@ -17,47 +17,75 @@
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# Log information about building packages in a JSON format.
# Log information about debomatic status in a JSON format.
#
# If you want to config this module, please add this info
# to your debomatic.conf
# [jsonlogger]
# jsonfile = /path/to/jsonfile.log
import
os
import
os
from
time
import
time
from
json
import
dumps
as
toJSON
from
json
import
dumps
as
toJSON
class
DebomaticModule_JSONLogger
:
class
DebomaticModule_JSONLogger
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
logfile
=
'/var/log/debomatic-json.log'
self
.
jsonfile
=
'/var/log/debomatic-json.log'
def
_set_jsonfile
(
self
,
args
):
"""If debomatic config file has section [jsonlogger] try to get
'jsonfile' option and override the default value."""
if
'opts'
in
args
and
args
[
'opts'
].
has_section
(
'jsonlogger'
):
self
.
jsonfile
=
args
[
'opts'
].
get
(
'jsonlogger'
,
'jsonfile'
).
strip
()
def
_set_logfile
(
self
,
args
):
def
_append_info_to_logfile
(
self
,
args
,
info
):
if
args
[
'opts'
].
has_section
(
'jsonlogger'
):
"""Write info to jsonfile converted in JSON format."""
self
.
logfile
=
args
[
'opts'
].
get
(
'jsonlogger'
,
'jsonfile'
).
strip
()
self
.
_set_jsonfile
(
args
)
info
[
'time'
]
=
int
(
time
())
with
open
(
self
.
jsonfile
,
'a'
)
as
logfd
:
json
=
toJSON
(
info
)
logfd
.
write
(
json
+
'
\
n
'
)
def
_get_info
(
self
,
args
):
def
_get_distribution_info
(
self
,
args
):
"""From args to distribution info."""
info
=
{}
info
[
'status'
]
=
args
[
'cmd'
]
info
[
'distribution'
]
=
args
[
'distribution'
]
if
'success'
in
args
:
info
[
'success'
]
=
args
[
'success'
]
return
info
def
_get_package_info
(
self
,
args
):
"""From args to package info."""
keys
=
[
'package'
,
'distribution'
,
'uploader'
]
keys
=
[
'package'
,
'distribution'
,
'uploader'
]
info
=
{}
info
=
{}
for
k
in
keys
:
for
k
in
keys
:
if
args
.
has_key
(
k
)
:
if
k
in
args
:
info
[
k
]
=
args
[
k
]
info
[
k
]
=
args
[
k
]
return
info
return
info
def
pre_chroot
(
self
,
args
):
distribution
=
self
.
_get_distribution_info
(
args
)
self
.
_append_info_to_logfile
(
args
,
distribution
)
def
post_chroot
(
self
,
args
):
distribution
=
self
.
_get_distribution_info
(
args
)
self
.
_append_info_to_logfile
(
args
,
distribution
)
def
pre_build
(
self
,
args
):
def
pre_build
(
self
,
args
):
self
.
_set_logfile
(
args
)
package
=
self
.
_get_package_info
(
args
)
with
open
(
self
.
logfile
,
'a'
)
as
fd
:
package
[
'status'
]
=
'build'
package
=
self
.
_get_info
(
args
)
self
.
_append_info_to_logfile
(
args
,
package
)
package
[
'status'
]
=
'building'
json
=
toJSON
(
package
)
fd
.
write
(
json
+
'
\
n
'
)
def
post_build
(
self
,
args
):
def
post_build
(
self
,
args
):
self
.
_set_logfile
(
args
)
package
=
self
.
_get_package_info
(
args
)
with
open
(
self
.
logfile
,
'a'
)
as
fd
:
package
[
'status'
]
=
'build'
status
=
'build-failed'
package
[
'success'
]
=
False
package
=
self
.
_get_info
(
args
)
resultdir
=
os
.
path
.
join
(
args
[
'directory'
],
'pool'
,
args
[
'package'
])
resultdir
=
os
.
path
.
join
(
args
[
'directory'
],
'pool'
,
args
[
'package'
])
for
filename
in
os
.
listdir
(
resultdir
):
for
filename
in
os
.
listdir
(
resultdir
):
if
filename
.
endswith
(
'.dsc'
):
if
filename
.
endswith
(
'.dsc'
):
status
=
'build-successed'
package
[
'success'
]
=
True
break
break
package
[
'status'
]
=
status
self
.
_append_info_to_logfile
(
args
,
package
)
json
=
toJSON
(
package
)
fd
.
write
(
json
+
'
\
n
'
)
debomatic-webui/debomatic-webui
View file @
5c3ecd2d
...
@@ -59,15 +59,14 @@ server.listen(config.port, config.host, null, function(err){
...
@@ -59,15 +59,14 @@ server.listen(config.port, config.host, null, function(err){
}
}
// statuses
// statuses
var status = {}
var status = []
status.packages = []
var broadcast = new Broadcaster(io.sockets, status)
var broadcast = new Broadcaster(io.sockets, status)
io.sockets.on('connection', function(socket) {
io.sockets.on('connection', function(socket) {
var client = new Client(socket)
var client = new Client(socket)
client.start()
client.start()
if (status.
packages.
length > 0)
if (status.length > 0)
client.send_status(status)
client.send_status(status)
});
});
...
...
debomatic-webui/lib/broadcaster.js
View file @
5c3ecd2d
...
@@ -2,9 +2,24 @@ var config = require('./config.js')
...
@@ -2,9 +2,24 @@ var config = require('./config.js')
,
fs
=
require
(
'
fs
'
)
,
fs
=
require
(
'
fs
'
)
,
Tail
=
require
(
'
./tail.js
'
)
,
Tail
=
require
(
'
./tail.js
'
)
function
__watch_status_check_same_obj
(
obj1
,
obj2
)
{
if
(
obj1
.
status
==
obj2
.
status
)
{
if
(
obj1
.
distribution
==
obj2
.
distribution
)
{
if
(
obj1
.
hasOwnProperty
(
'
package
'
)
&&
obj2
.
hasOwnProperty
(
'
package
'
))
{
if
(
obj1
.
package
==
obj2
.
package
)
return
true
;
return
false
}
return
true
}
}
return
false
}
// watcher on build_status
// watcher on build_status
function
__watch_
build_
status
(
socket
,
status
)
{
function
__watch_status
(
socket
,
status
)
{
var
watcher
=
new
Tail
(
config
.
debomatic
.
jsonfile
)
var
watcher
=
new
Tail
(
config
.
debomatic
.
jsonfile
)
watcher
.
on
(
'
line
'
,
function
(
new_content
)
{
watcher
.
on
(
'
line
'
,
function
(
new_content
)
{
...
@@ -12,39 +27,24 @@ function __watch_build_status (socket, status) {
...
@@ -12,39 +27,24 @@ function __watch_build_status (socket, status) {
try
{
try
{
data
=
JSON
.
parse
(
new_content
)
data
=
JSON
.
parse
(
new_content
)
}
catch
(
err
)
{
}
catch
(
err
)
{
utils
.
errors_handler
(
'
Broadcaster:__watch_
build_
status:JSON.parse(new_content) -
'
,
err
,
socket
)
utils
.
errors_handler
(
'
Broadcaster:__watch_status:JSON.parse(new_content) -
'
,
err
,
socket
)
return
return
}
}
// looking for same status already in statuses lists
// looking for same package already in status.packages
if
(
data
.
hasOwnProperty
(
'
success
'
))
{
var
index
=
-
1
for
(
i
=
0
;
i
<
status
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
status
.
packages
.
length
;
i
++
)
if
(
__watch_status_check_same_obj
(
data
,
status
[
i
]))
{
{
status
.
splice
(
i
,
1
)
p
=
status
.
packages
[
i
]
break
;
if
(
p
.
package
==
data
.
package
&&
p
.
distribution
==
data
.
distribution
)
{
index
=
i
break
}
}
else
continue
;
}
}
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
}
}
}
else
{
status
.
push
(
data
)
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
)
}
})
})
watcher
.
on
(
'
error
'
,
function
(
msg
)
{
watcher
.
on
(
'
error
'
,
function
(
msg
)
{
socket
.
emit
(
config
.
events
.
error
,
msg
)
socket
.
emit
(
config
.
events
.
error
,
msg
)
...
@@ -65,7 +65,7 @@ function Broadcaster (sockets, status) {
...
@@ -65,7 +65,7 @@ function Broadcaster (sockets, status) {
var
sockets
=
sockets
var
sockets
=
sockets
__watch_
build_
status
(
sockets
,
status
)
__watch_status
(
sockets
,
status
)
__watch_distributions
(
sockets
)
__watch_distributions
(
sockets
)
...
...
debomatic-webui/lib/client.js
View file @
5c3ecd2d
...
@@ -52,6 +52,7 @@ function __send_package_status(socket, data, package_data) {
...
@@ -52,6 +52,7 @@ function __send_package_status(socket, data, package_data) {
new_data
.
package
=
package_data
new_data
.
package
=
package_data
var
status_data
=
{}
var
status_data
=
{}
status_data
.
status
=
config
.
status
.
build
status_data
.
distribution
=
data
.
distribution
.
name
status_data
.
distribution
=
data
.
distribution
.
name
status_data
.
package
=
package_data
.
orig_name
status_data
.
package
=
package_data
.
orig_name
...
@@ -62,9 +63,9 @@ function __send_package_status(socket, data, package_data) {
...
@@ -62,9 +63,9 @@ function __send_package_status(socket, data, package_data) {
// + building: wc -l .datestamp == 1 (FIX_ME)
// + building: wc -l .datestamp == 1 (FIX_ME)
// + failed: else
// + failed: else
var
base_path
=
path
.
join
(
package_path
,
package_data
.
orig_name
)
var
base_path
=
path
.
join
(
package_path
,
package_data
.
orig_name
)
fs
.
exists
(
base_path
+
'
.dsc
'
,
function
(
changes
_exists
){
fs
.
exists
(
base_path
+
'
.dsc
'
,
function
(
dsc
_exists
){
if
(
changes
_exists
)
{
if
(
dsc
_exists
)
{
status_data
.
s
tatus
=
config
.
status
.
package
.
successed
status_data
.
s
uccess
=
config
.
status
.
success
socket
.
emit
(
event_name
,
status_data
)
socket
.
emit
(
event_name
,
status_data
)
}
}
else
{
else
{
...
@@ -80,10 +81,8 @@ function __send_package_status(socket, data, package_data) {
...
@@ -80,10 +81,8 @@ function __send_package_status(socket, data, package_data) {
if
(
chunk
[
i
]
==
10
)
count
++
;
if
(
chunk
[
i
]
==
10
)
count
++
;
})
})
.
on
(
'
end
'
,
function
()
{
.
on
(
'
end
'
,
function
()
{
if
(
count
<=
1
)
if
(
count
>
1
)
status_data
.
status
=
config
.
status
.
package
.
building
status_data
.
success
=
config
.
status
.
fail
else
status_data
.
status
=
config
.
status
.
package
.
failed
socket
.
emit
(
event_name
,
status_data
)
socket
.
emit
(
event_name
,
status_data
)
});
});
}
}
...
...
debomatic-webui/lib/config.js
View file @
5c3ecd2d
...
@@ -51,7 +51,7 @@ config.web.preferences = {}
...
@@ -51,7 +51,7 @@ config.web.preferences = {}
config
.
web
.
preferences
.
autoscroll
=
true
config
.
web
.
preferences
.
autoscroll
=
true
config
.
web
.
preferences
.
header
=
true
config
.
web
.
preferences
.
header
=
true
config
.
web
.
preferences
.
sidebar
=
true
config
.
web
.
preferences
.
sidebar
=
true
config
.
web
.
preferences
.
glossy_theme
=
fals
e
config
.
web
.
preferences
.
glossy_theme
=
tru
e
config
.
web
.
preferences
.
file_background
=
true
config
.
web
.
preferences
.
file_background
=
true
config
.
web
.
preferences
.
file_fontsize
=
13
// valid values are [13..16]
config
.
web
.
preferences
.
file_fontsize
=
13
// valid values are [13..16]
config
.
web
.
preferences
.
debug
=
0
// debug level - 0 means disabled
config
.
web
.
preferences
.
debug
=
0
// debug level - 0 means disabled
...
@@ -61,7 +61,7 @@ config.web.preferences.debug = 0 // debug level - 0 means disabled
...
@@ -61,7 +61,7 @@ config.web.preferences.debug = 0 // debug level - 0 means disabled
// DO NOT TOUCH these ones
// DO NOT TOUCH these ones
config
.
version
=
'
0.
1-b1
'
config
.
version
=
'
0.
2.0
'
// A simple function to quickly have
// A simple function to quickly have
// get and set strings for client events
// get and set strings for client events
...
@@ -86,13 +86,13 @@ config.events.client.file = _event_get_set('file')
...
@@ -86,13 +86,13 @@ config.events.client.file = _event_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
'
//
packages
status according with JSONLogger.py module
//
debomatic
status according with JSONLogger.py module
config
.
status
=
{}
config
.
status
=
{}
config
.
status
.
package
=
{}
config
.
status
.
build
=
'
build
'
config
.
status
.
package
.
building
=
'
building
'
config
.
status
.
create
=
'
create
'
config
.
status
.
package
.
failed
=
'
build-failed
'
config
.
status
.
update
=
'
update
'
config
.
status
.
package
.
successed
=
'
build-successed
'
config
.
status
.
success
=
true
config
.
status
.
fail
=
false
// read user configuration and merge it
// read user configuration and merge it
/*
/*
...
...
debomatic-webui/public/javascripts/main.js
View file @
5c3ecd2d
debomatic-webui/public/javascripts/page_distribution.js
View file @
5c3ecd2d
// function to get all files in on click
// event comes from HTML
function
download_all
(
div_id
)
{
frame_id
=
'
downloadAllFrame
'
if
(
$
(
"
#
"
+
frame_id
).
length
>
0
)
frame
=
$
(
$
(
"
#
"
+
frame_id
)[
0
])
else
{
frame
=
$
(
'
<iframe></iframe>
'
)
frame
.
hide
()
frame
.
attr
(
'
id
'
,
frame_id
)
$
(
'
body
'
).
append
(
frame
)
}
files
=
$
(
div_id
).
find
(
'
ul li a
'
)
$
.
each
(
files
,
function
(
index
,
item
)
{
setTimeout
(
function
()
{
frame
.
attr
(
'
src
'
,
item
.
href
)
},
index
*
1000
)
})
}
function
Page_Distrubion
(
socket
)
function
Page_Distrubion
(
socket
)
{
{
...
@@ -16,6 +36,7 @@ function Page_Distrubion(socket)
...
@@ -16,6 +36,7 @@ function Page_Distrubion(socket)
view.package.version
view.package.version
view.package.orig_name
view.package.orig_name
view.package.status
view.package.status
view.package.success
view.package.files = [file]
view.package.files = [file]
view.package.debs = [file]
view.package.debs = [file]
view.package.sources = [file]
view.package.sources = [file]
...
@@ -34,7 +55,8 @@ function Page_Distrubion(socket)
...
@@ -34,7 +55,8 @@ function Page_Distrubion(socket)
status_data = {}
status_data = {}
status_data.distribution --- the distribution name
status_data.distribution --- the distribution name
status_data.package --- the package name as name_version
status_data.package --- the package name as name_version
status_data.status --- one of config.status.*.*
status_data.status --- one of config.status.[build|create|update]
status_data.success --- true | false
*/
*/
...
@@ -112,7 +134,7 @@ function Page_Distrubion(socket)
...
@@ -112,7 +134,7 @@ function Page_Distrubion(socket)
$
(
'
#packages ul
'
).
append
(
'
<li class="text-muted">No packages yet</li>
'
)
$
(
'
#packages ul
'
).
append
(
'
<li class="text-muted">No packages yet</li>
'
)
}
}
packages
.
show
()
packages
.
show
()
sticky
.
re
set
()
sticky
.
updateOff
set
()
},
},
clean
:
function
()
{
clean
:
function
()
{
$
(
'
#packages ul
'
).
html
(
''
)
$
(
'
#packages ul
'
).
html
(
''
)
...
@@ -139,7 +161,11 @@ function Page_Distrubion(socket)
...
@@ -139,7 +161,11 @@ function Page_Distrubion(socket)
if
(
view
.
distribution
.
name
==
status_data
.
distribution
if
(
view
.
distribution
.
name
==
status_data
.
distribution
&&
view
.
packages
[
status_data
.
package
]
)
&&
view
.
packages
[
status_data
.
package
]
)
{
{
view
.
packages
[
status_data
.
package
].
status
=
Utils
.
clone
(
status_data
.
status
)
view
.
packages
[
status_data
.
package
].
status
=
status_data
.
status
if
(
status_data
.
hasOwnProperty
(
'
success
'
))
view
.
packages
[
status_data
.
package
].
success
=
status_data
.
success
else
delete
(
view
.
packages
[
status_data
.
package
].
success
)
}
}
// and in html
// and in html
var
p_html
=
$
(
"
#packages li[id='package-
"
+
status_data
.
package
+
"
'] a
"
)
var
p_html
=
$
(
"
#packages li[id='package-
"
+
status_data
.
package
+
"
'] a
"
)
...
@@ -150,7 +176,7 @@ function Page_Distrubion(socket)
...
@@ -150,7 +176,7 @@ function Page_Distrubion(socket)
&&
view
.
distribution
.
name
==
status_data
.
distribution
)
&&
view
.
distribution
.
name
==
status_data
.
distribution
)
{
{
// in case user is watching this package, update also view.package
// in case user is watching this package, update also view.package
view
.
package
.
status
=
Utils
.
clone
(
status_data
.
status
)
view
.
package
=
Utils
.
clone
(
view
.
packages
[
status_data
.
package
]
)
}
}
},
},
show
:
function
()
{
show
:
function
()
{
...
@@ -201,7 +227,7 @@ function Page_Distrubion(socket)
...
@@ -201,7 +227,7 @@ function Page_Distrubion(socket)
$
(
'
#sources
'
).
show
()
$
(
'
#sources
'
).
show
()
}
}
files
.
show
()
files
.
show
()
sticky
.
re
set
()
sticky
.
updateOff
set
()
},
},
clean
:
function
()
{
clean
:
function
()
{
$
(
'
#logs ul
'
).
html
(
''
);
$
(
'
#logs ul
'
).
html
(
''
);
...
@@ -310,20 +336,21 @@ function Page_Distrubion(socket)
...
@@ -310,20 +336,21 @@ function Page_Distrubion(socket)
sticky
.
show
()
sticky
.
show
()
}
else
{
}
else
{
sticky
.
hide
()
sticky
.
hide
()
sticky
.
updateOffset
()
}
}
},
},
start
:
function
()
{
start
:
function
()
{
$
(
window
).
scroll
(
sticky
.
init
)
$
(
window
).
scroll
(
sticky
.
init
)
},
},
stop
:
function
()
{
$
(
window
).
off
(
"
scroll
"
)
},
reset
:
function
()
{
reset
:
function
()
{
sticky
.
stop
()
sticky
.
stop
()
sticky
.
update
()
sticky
.
update
()
sticky
.
init
()
sticky
.
init
()
sticky
.
start
()
sticky
.
start
()
},
},
stop
:
function
()
{
$
(
window
).
off
(
"
scroll
"
)
},
show
:
function
()
{
show
:
function
()
{
if
(
config
.
preferences
.
sidebar
)
{
if
(
config
.
preferences
.
sidebar
)
{
$
(
"
#sticky
"
).
addClass
(
'
fixed
'
)
$
(
"
#sticky
"
).
addClass
(
'
fixed
'
)
...
@@ -336,8 +363,7 @@ function Page_Distrubion(socket)
...
@@ -336,8 +363,7 @@ function Page_Distrubion(socket)
$
(
"
#sticky-package
"
).
fadeOut
(
150
)
$
(
"
#sticky-package
"
).
fadeOut
(
150
)
},
},
update
:
function
()
{
update
:
function
()
{
var
sidebar
=
$
(
"
#files
"
)
sticky
.
updateOffset
()
sidebarOffset
=
sidebar
.
offset
().
top
if
(
Utils
.
check_view_distribution
(
view
))
if
(
Utils
.
check_view_distribution
(
view
))
$
(
"
#sticky-package .distribution
"
).
html
(
view
.
distribution
.
name
)
$
(
"
#sticky-package .distribution
"
).
html
(
view
.
distribution
.
name
)
if
(
Utils
.
check_view_package
(
view
))
{
if
(
Utils
.
check_view_package
(
view
))
{
...
@@ -346,12 +372,18 @@ function Page_Distrubion(socket)
...
@@ -346,12 +372,18 @@ function Page_Distrubion(socket)
sticky
.
set_status
()
sticky
.
set_status
()
}
}
},
},
updateOffset
:
function
()
{
var
sidebar
=
$
(
"
#files
"
)
sidebarOffset
=
sidebar
.
offset
().
top
},
set_status
:
function
(
status_data
)
{
set_status
:
function
(
status_data
)
{
if
(
!
status_data
)
{
if
(
!
status_data
)
{
status_data
=
{}
status_data
=
{}
status_data
.
distribution
=
view
.
distribution
.
name
status_data
.
distribution
=
view
.
distribution
.
name
status_data
.
package
=
view
.
package
.
orig_name
status_data
.
package
=
view
.
package
.
orig_name
status_data
.
status
=
view
.
package
.
status
status_data
.
status
=
view
.
package
.
status
if
(
view
.
package
.
hasOwnProperty
(
'
success
'
))
status_data
.
success
=
view
.
package
.
success
}
}
if
(
Utils
.
check_view_package
(
view
)
if
(
Utils
.
check_view_package
(
view
)
&&
status_data
.
distribution
==
view
.
distribution
.
name
&&
status_data
.
distribution
==
view
.
distribution
.
name
...
@@ -472,21 +504,16 @@ function Page_Distrubion(socket)
...
@@ -472,21 +504,16 @@ function Page_Distrubion(socket)
populate
()
populate
()
return
return
}
}
else
if
(
!
Utils
.
check_view_package
(
old_view
)
else
if
(
!
Utils
.
check_view_package
(
old_view
)
||
||
!
Utils
.
check_view_package
(
view
)
!
Utils
.
check_view_package
(
view
)
||
||
view
.
package
.
orig_name
!=
old_view
.
package
.
orig_name
view
.
package
.
orig_name
!=
old_view
.
package
.
orig_name
)
)
{
// new package view
{
// new package view
// set status from packages
if
(
view
.
packages
[
view
.
package
.
orig_name
])
view
.
package
.
status
=
view
.
packages
[
view
.
package
.
orig_name
].
status
files
.
get
()
files
.
get
()
file
.
get
()
file
.
get
()
}
}
else
if
(
!
Utils
.
check_view_file
(
old_view
)
else
if
(
!
Utils
.
check_view_file
(
old_view
)
||
||
!
Utils
.
check_view_file
(
view
)
!
Utils
.
check_view_file
(
view
)
||
||
view
.
file
.
name
!=
old_view
.
file
.
name
view
.
file
.
name
!=
old_view
.
file
.
name
)
)
{
// new file view
{
// new file view
file
.
get
()
file
.
get
()
}
}
...
@@ -560,12 +587,12 @@ function Page_Distrubion(socket)
...
@@ -560,12 +587,12 @@ function Page_Distrubion(socket)
// reset current view
// reset current view
view
.
distribution
=
Utils
.
clone
(
new_view
.
distribution
)
view
.
distribution
=
Utils
.
clone
(
new_view
.
distribution
)
view
.
package
=
Utils
.
clone
(
new_view
.
package
)
view
.
package
=
Utils
.
clone
(
new_view
.
package
)
if
(
view
.
packages
[
view
.
package
.
orig_name
])
if
(
view
.
packages
[
new_
view
.
package
.
orig_name
])
view
.
package
.
status
=
view
.
packages
[
view
.
package
.
orig_name
].
status
view
.
package
=
Utils
.
clone
(
view
.
packages
[
new_view
.
package
.
orig_name
])
view
.
file
=
Utils
.
clone
(
new_view
.
file
)
view
.
file
=
Utils
.
clone
(
new_view
.
file
)
update
.
page
(
old_view
)
update
.
page
(
old_view
)
$
(
'
html,body
'
).
animate
({
scrollTop
:
0
},
0
);
$
(
'
html,body
'
).
animate
({
scrollTop
:
0
},
0
);
debug
(
1
,
"
changing view
"
,
"
old:
"
,
old_view
,
"
new:
"
,
new_
view
)
debug
(
1
,
"
changing view
"
,
"
old:
"
,
old_view
,
"
new:
"
,
view
)
});
});
if
(
!
__check_hash_makes_sense
())
if
(
!
__check_hash_makes_sense
())
...
...
debomatic-webui/public/javascripts/page_generic.js
View file @
5c3ecd2d
...
@@ -2,20 +2,49 @@ function Page_Generic()
...
@@ -2,20 +2,49 @@ function Page_Generic()
{
{
var
_e
=
config
.
events
var
_e
=
config
.
events
function
__get_status_html
(
status_package
)
{
function
__get_status_html_id
(
status_data
)
{
var
s
=
status_package
var
result
=
'
status-
'
+
status_data
.
status
+
'
-
'
+
status_data
.
distribution
if
(
status_data
.
hasOwnProperty
(
'
package
'
))
result
+=
'
-
'
+
status_data
.
package
return
result
}
function
__get_status_html_href
(
status_data
)
{
result
=
config
.
paths
.
distribution
+
'
#
'
+
status_data
.
distribution
if
(
status_data
.
hasOwnProperty
(
'
package
'
))
result
+=
'
/
'
+
status_data
.
package
.
replace
(
'
_
'
,
'
/
'
)
+
'
/datestamp
'
return
result
}
function
__get_status_html_title
(
status_data
)
{
result
=
status_data
.
status
+
'
:
'
+
status_data
.
distribution
if
(
status_data
.
hasOwnProperty
(
'
package
'
))
result
+=
'
>
'
+
status_data
.
package
if
(
status_data
.
hasOwnProperty
(
'
uploader
'
)
&&
status_data
.
uploader
.
length
>
0
)
result
+=
'
by
'
+
status_data
.
uploader
return
result
}
function
__get_status_html_inner
(
status_data
)
{
if
(
status_data
.
hasOwnProperty
(
'
package
'
))
return
status_data
.
package
;
return
status_data
.
distribution
}
function
__get_status_html
(
status_data
)
{
var
_s
=
status_data
var
li
=
$
(
'
<li></li>
'
)
var
li
=
$
(
'
<li></li>
'
)
li
.
attr
(
'
id
'
,
'
status-
'
+
s
.
distribution
+
"
-
"
+
s
.
package
)
li
.
attr
(
'
id
'
,
__get_status_html_id
(
status_data
)
)
var
button
=
$
(
'
<a></a>
'
)
var
button
=
$
(
'
<a></a>
'
)
button
.
addClass
(
'
btn btn-xs
'
)
button
.
addClass
(
'
btn btn-xs
'
)
button
.
addClass
(
s
.
status
)
button
.
addClass
(
_
s
.
status
)
button
.
attr
(
'
title
'
,
s
.
status
+
'
:
'
+
s
.
distribution
+
'
>
'
+
s
.
package
)
button
.
attr
(
'
title
'
,
__get_status_html_title
(
_s
)
)
button
.
attr
(
'
href
'
,
config
.
paths
.
distribution
+
'
#
'
+
s
.
distribution
+
'
/
'
+
s
.
package
.
replace
(
'
_
'
,
'
/
'
)
+
'
/datestamp
'
)
button
.
attr
(
'
href
'
,
__get_status_html_href
(
_s
)
)
button
.
html
(
s
.
package
.
split
(
'
_
'
)[
0
]
)
button
.
html
(
__get_status_html_inner
(
_s
)
)
var
info
=
Utils
.
get_status_icon_and_class
(
s
)
var
info
=
Utils
.
get_status_icon_and_class
(
_
s
)
button
.
addClass
(
'
btn-
'
+
info
.
className
)
button
.
addClass
(
'
btn-
'
+
info
.
className
)
// add icon
// add icon
button
.
html
(
button
.
html
()
+
'
'
+
Utils
.
get_status_icon_html
(
s
))
button
.
html
(
button
.
html
()
+
'
'
+
Utils
.
get_status_icon_html
(
_
s
))
li
.
html
(
button
)
li
.
html
(
button
)
var
result
=
$
(
'
<div></div>
'
)
var
result
=
$
(
'
<div></div>
'
)
result
.
html
(
li
)
result
.
html
(
li
)
...
@@ -45,36 +74,37 @@ function Page_Generic()
...
@@ -45,36 +74,37 @@ function Page_Generic()
var
status
=
{
var
status
=
{
set
:
function
(
data_status
)
{
set
:
function
(
data_status
)
{
$
(
"
#status ul
"
).
html
(
''
)
$
(
"
#status ul
"
).
html
(
''
)
if
(
data_status
.
packages
.
length
>
0
)
{
if
(
data_status
.
length
>
0
)
{
data_status
.
packages
.
forEach
(
function
(
p
){
data_status
.
forEach
(
function
(
s
){
status
.
append
(
p
)
status
.
append
(
s
)
})
})
}
}
},
},
append
:
function
(
status_
package
)
{
append
:
function
(
status_
data
)
{
$
(
'
#status .idle
'
).
hide
()
$
(
'
#status .idle
'
).
hide
()
$
(
"
#status ul
"
).
append
(
__get_status_html
(
status_
package
))
$
(
"
#status ul
"
).
append
(
__get_status_html
(
status_
data
))
},
},
update
:
function
(
status_
package
)
{
update
:
function
(
status_
data
)
{
var
li
=
$
(
"
#status li[id='
status-
"
+
status_package
.
distribution
+
"
-
"
+
status_package
.
package
+
"
']
"
)
var
li
=
$
(
"
#status li[id='
"
+
__get_status_html_id
(
status_data
)
+
"
']
"
)
if
(
li
.
length
>
0
if
(
li
.
length
>
0
&&
status_
package
.
status
!=
config
.
status
.
package
.
building
)
&&
status_
data
.
hasOwnProperty
(
'
success
'
)
)
{
{
// Update color and icon
// Update color and icon
li
.
html
(
$
(
__get_status_html
(
status_package
)).
children
())
li
=
$
(
li
[
0
])
li
.
html
(
$
(
__get_status_html
(
status_data
)).
children
())
li
.
attr
(
'
id
'
,
''
)
li
.
attr
(
'
id
'
,
''
)
// This is a chain to have a fadeOut and correctly
// This is a chain to have a fadeOut and correctly
// delete
package
from list.
// delete
status li
from list.
// The first timemout fades out the
package
.
// The first timemout fades out the
status element
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
li
.
children
().
fadeOut
(
config
.
status
.
delay
.
fadeOut
)
li
.
children
().
fadeOut
(
config
.
status
.
delay
.
fadeOut
)
// Then resize
packages
list.
// Then resize list.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
li
.
animate
({
width
:
'
toggle
'
})
li
.
animate
({
width
:
'
toggle
'
})
},
config
.
status
.
delay
.
fadeOut
)
},
config
.
status
.
delay
.
fadeOut
)
// Finally remove
package
html
// Finally remove
status
html
// and show idle
status
if necessary.
// and show idle
label
if necessary.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
li
.
remove
()
li
.
remove
()
if
(
$
(
'
#status li
'
).
length
==
0
)
if
(
$
(
'
#status li
'
).
length
==
0
)
...
@@ -82,8 +112,8 @@ function Page_Generic()
...
@@ -82,8 +112,8 @@ 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
==
config
.
status
.
package
.
building
)
{
else
if
(
!
status_data
.
hasOwnProperty
(
'
success
'
)
)
{
status
.
append
(
status_
package
)
status
.
append
(
status_
data
)
}
}
},
},
}
}
...
@@ -99,6 +129,7 @@ function Page_Generic()
...
@@ -99,6 +129,7 @@ function Page_Generic()
}
}
if
(
config
.
preferences
.
glossy_theme
)
{
if
(
config
.
preferences
.
glossy_theme
)
{
if
(
$
(
"
head
"
).
find
(
"
link[href='/external_libs/bootstrap-3.1.1-dist/css/bootstrap-theme.min.css']
"
).
length
==
0
)
$
(
"
head
"
).
append
(
'
<link rel="stylesheet" href="/external_libs/bootstrap-3.1.1-dist/css/bootstrap-theme.min.css">
'
)
$
(
"
head
"
).
append
(
'
<link rel="stylesheet" href="/external_libs/bootstrap-3.1.1-dist/css/bootstrap-theme.min.css">
'
)
}
}
else
{
else
{
...
@@ -121,9 +152,9 @@ function Page_Generic()
...
@@ -121,9 +152,9 @@ function Page_Generic()
distributions
.
set
(
socket_distributions
)
distributions
.
set
(
socket_distributions
)
});
});
socket
.
on
(
_e
.
client
.
status
,
function
(
packages
_status
)
{
socket
.
on
(
_e
.
client
.
status
,
function
(
socket
_status
)
{
debug_socket
(
"
received
"
,
_e
.
client
.
status
,
packages
_status
)
debug_socket
(
"
received
"
,
_e
.
client
.
status
,
socket
_status
)
status
.
set
(
packages
_status
)
status
.
set
(
socket
_status
)
})
})
socket
.
on
(
_e
.
broadcast
.
status_update
,
function
(
package_status
)
{
socket
.
on
(
_e
.
broadcast
.
status_update
,
function
(
package_status
)
{
...
...
debomatic-webui/public/javascripts/utils.js
View file @
5c3ecd2d
...
@@ -56,17 +56,19 @@ var Utils = {
...
@@ -56,17 +56,19 @@ var Utils = {
var
_s
=
status_data
var
_s
=
status_data
var
className
=
null
var
className
=
null
var
icon
=
null
var
icon
=
null
if
(
_s
.
status
==
config
.
status
.
package
.
building
)
{
if
(
_s
.
hasOwnProperty
(
'
success
'
))
{
className
=
_c
.
building
if
(
_s
.
success
==
true
)
{
icon
=
_i
.
building
className
=
_c
.
success
icon
=
_i
.
success
}
else
{
className
=
_c
.
fail
icon
=
_i
.
fail
}
}
else
if
(
_s
.
status
==
config
.
status
.
package
.
failed
)
{
className
=
_c
.
failed
icon
=
_i
.
failed
}
}
else
{
else
{
className
=
_c
.
successed
className
=
_c
[
_s
.
status
]
icon
=
_i
.
successed
icon
=
_i
[
_s
.
status
]
}
}
return
{
return
{
className
:
className
,
className
:
className
,
...
...
debomatic-webui/views/distribution.ejs
View file @
5c3ecd2d
...
@@ -28,7 +28,11 @@
...
@@ -28,7 +28,11 @@
<ul></ul>
<ul></ul>
</nav>
</nav>
<nav id="debs">
<nav id="debs">
<h4>Debs</h4>
<h4>Debs
<a class="btn btn-link" title="Get all debs in one click" onclick="download_all('#debs')">
<span class="glyphicon glyphicon-download-alt"></span>
</a>
</h4>
<ul></ul>
<ul></ul>
</nav>
</nav>
</div>
</div>
...
...
debomatic-webui/views/footer.ejs
View file @
5c3ecd2d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</div>
</div>
</footer>
</footer>
<script src='/socket.io/socket.io.js'></script>
<script src='/socket.io/socket.io.js
?<%= version %>
'></script>
<script src='/external_libs/jquery/jquery-1.11.0.min.js'></script>
<script src='/external_libs/jquery/jquery-1.11.0.min.js'></script>
<script src="/external_libs/bootstrap-3.1.1-dist/js/bootstrap.min.js"></script>
<script src="/external_libs/bootstrap-3.1.1-dist/js/bootstrap.min.js"></script>
...
@@ -18,14 +18,18 @@
...
@@ -18,14 +18,18 @@
var config = <%- JSON.stringify(web) %>
var config = <%- JSON.stringify(web) %>
config.status.className = {}
config.status.className = {}
config.status.className.building = 'info'
config.status.className.build = 'info'
config.status.className.successed = 'success'
config.status.className.create = 'warning'
config.status.className.failed = 'danger'
config.status.className.update = 'default'
config.status.className.success = 'success'
config.status.className.fail = 'danger'
config.status.icons = {}
config.status.icons = {}
config.status.icons.building = 'refresh'
config.status.icons.build = 'refresh'
config.status.icons.successed = 'ok'
config.status.icons.create = 'asterisk'
config.status.icons.failed = 'remove'
config.status.icons.update = 'upload'
config.status.icons.success = 'ok'
config.status.icons.fail = 'remove'
config.status.delay = {}
config.status.delay = {}
config.status.delay.remove = 10000
config.status.delay.remove = 10000
...
@@ -33,12 +37,12 @@
...
@@ -33,12 +37,12 @@
</script>
</script>
<script src='/javascripts/debug.js'></script>
<script src='/javascripts/debug.js
?<%= version %>
'></script>
<script src='/javascripts/utils.js'></script>
<script src='/javascripts/utils.js
?<%= version %>
'></script>
<script src='/javascripts/preferences.js'></script>
<script src='/javascripts/preferences.js
?<%= version %>
'></script>
<script src='/javascripts/page_generic.js'></script>
<script src='/javascripts/page_generic.js
?<%= version %>
'></script>
<script src='/javascripts/page_distribution.js'></script>
<script src='/javascripts/page_distribution.js
?<%= version %>
'></script>
<script src='/javascripts/main.js'></script>
<script src='/javascripts/main.js
?<%= version %>
'></script>
</body>
</body>
</html>
</html>
debomatic-webui/views/header.ejs
View file @
5c3ecd2d
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
<title><
%=
web
.
title
%
></title>
<title><
%=
web
.
title
%
></title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"/external_libs/bootstrap-3.1.1-dist/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"/external_libs/bootstrap-3.1.1-dist/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"/stylesheets/style.css"
>
<link
rel=
"stylesheet"
href=
"/external_libs/bootstrap-3.1.1-dist/css/bootstrap-theme.min.css"
>
<link
rel=
"stylesheet"
href=
"/stylesheets/style.css?<%= version %>"
>
</head>
</head>
<body>
<body>
...
...
scripts/do_release.sh
0 → 100644
View file @
5c3ecd2d
#!/bin/bash
if
[
$#
==
0
]
;
then
echo
"Please specify a version number."
exit
fi
VERSION
=
$1
BASE_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
/.."
CONFIG
=
${
BASE_DIR
}
/debomatic-webui/lib/config.js
CURRENT
=
"
`
grep
"^config.version"
${
CONFIG
}
|
awk
-F
"'"
'{print $2}'
`
"
y
=
'n'
echo
-n
"Current version is
${
CURRENT
}
. Bump to
${
VERSION
}
? [y/N] "
read
y
if
[
"
$y
"
==
"y"
-o
"
$y
"
==
"Y"
]
;
then
sed
-r
"s/^config.version = '(.*)'/config.version = '
${
VERSION
}
'/"
-i
$CONFIG
||
exit
1
y
=
'n'
echo
-n
"Do git-commit? [y/N] "
read
y
if
[
"
$y
"
==
"y"
-o
"
$y
"
==
"Y"
]
;
then
git commit
-m
"Bumped version
${
VERSION
}
"
${
CONFIG
}
y
=
'n'
echo
-n
"Do git-tag? [y/N] "
read
y
if
[
"
$y
"
==
"y"
-o
"
$y
"
==
"Y"
]
;
then
git tag
-m
"Released version
${
VERSION
}
"
"v
${
VERSION
}
"
fi
fi
fi
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