Commit 90da97a5 authored by Leo Iannacone's avatar Leo Iannacone

moved get_status_icon_and_className to utils

parent 6d89a2b3
......@@ -2,30 +2,6 @@ function Page_Generic()
{
var socket;
function __get_status_icon_and_class(status_package) {
var _c = config.status.className
var _i = config.status.icons
var button_class = null
var icon = null
var s = status_package
if (s.status == config.status.package.building) {
button_class = _c.building
icon = _i.building
}
else if (s.status == config.status.package.failed) {
button_class = _c.failed
icon = _i.failed
}
else {
button_class = _c.successed
icon = _i.successed
}
return {
button_class: button_class,
icon: icon
}
}
function __get_status_html(status_package) {
var s = status_package
var li = $('<li></li>')
......@@ -36,8 +12,8 @@ function Page_Generic()
button.attr('title', s.status + ': ' + s.distribution + ' > ' + s.package)
button.attr('href', config.paths.distribution + '#' + s.distribution + '/' + s.package.replace('_', '/') + '/datestamp')
button.html(s.package.split('_')[0])
var info = __get_status_icon_and_class(s)
button.addClass('btn-' + info.button_class)
var info = utils.get_status_icon_and_class(s)
button.addClass('btn-' + info.className)
button.html(button.html() + ' <span class="icon glyphicon glyphicon-' + info.icon + '"></span>')
li.html(button)
var result = $('<div></div>')
......
......@@ -47,4 +47,28 @@ var Utils = {
check_data_file: function(data) {
return Utils.check_data_package(data) && data.file && data.file.name
},
get_status_icon_and_class: function (status_data) {
var _c = config.status.className
var _i = config.status.icons
var className = null
var icon = null
var s = status_package
if (s.status == config.status.package.building) {
className = _c.building
icon = _i.building
}
else if (s.status == config.status.package.failed) {
className = _c.failed
icon = _i.failed
}
else {
className = _c.successed
icon = _i.successed
}
return {
className: className,
icon: icon
}
},
}
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