Commit cd9b8916 authored by Leo Iannacone's avatar Leo Iannacone

improved welcome view

parent 47a122f0
...@@ -50,10 +50,7 @@ function Page_Distrubion(socket) ...@@ -50,10 +50,7 @@ function Page_Distrubion(socket)
return false return false
} }
if (! window.location.hash) { if (! window.location.hash) {
title.set("Please select a distribution") welcome.show()
file.clean()
files.hide()
unselect()
return false return false
} }
var info = window.location.hash.split('/') var info = window.location.hash.split('/')
...@@ -91,7 +88,7 @@ function Page_Distrubion(socket) ...@@ -91,7 +88,7 @@ function Page_Distrubion(socket)
var packages = { var packages = {
set: function (socket_data) { set: function (socket_data) {
$('#packages ul').html('') packages.clean()
var tmp = Utils.clone(socket_data) var tmp = Utils.clone(socket_data)
tmp.file = null tmp.file = null
view.packages = {} view.packages = {}
...@@ -107,6 +104,7 @@ function Page_Distrubion(socket) ...@@ -107,6 +104,7 @@ function Page_Distrubion(socket)
else { else {
$('#packages ul').append('<li class="text-muted">No packages yet</li>') $('#packages ul').append('<li class="text-muted">No packages yet</li>')
} }
packages.show()
}, },
clean: function () { clean: function () {
...@@ -147,6 +145,12 @@ function Page_Distrubion(socket) ...@@ -147,6 +145,12 @@ function Page_Distrubion(socket)
// 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.status = Utils.clone(status_data.status)
} }
},
show: function() {
$("#packages").show()
},
hide: function() {
$("#packages").hide()
} }
} }
...@@ -372,6 +376,35 @@ function Page_Distrubion(socket) ...@@ -372,6 +376,35 @@ function Page_Distrubion(socket)
}, },
} }
var welcome = {
set: function(distributions) {
welcome.clean()
if(distributions.length < 1) {
$('#welcome').append('<p class="lead text-muted">There is no distribution at the moment</p>')
}
else {
distributions.forEach(function (name){
$('#welcome').append('<a class="btn btn-lg btn-primary" href="'+ config.paths.distribution + '#'+ name + '">' + name + '</a>');
});
}
},
show: function() {
title.set("Please select a distribution")
breadcrumb.update("Select a distribution")
packages.hide()
file.clean()
files.hide()
unselect()
$("#welcome").show()
},
clean: function() {
$("#welcome").html('')
},
hide: function() {
$("#welcome").hide()
}
}
var preferences = function() { var preferences = function() {
if (! config.preferences.sidebar) { if (! config.preferences.sidebar) {
debug(2, "no sidebar - updating html") debug(2, "no sidebar - updating html")
...@@ -405,6 +438,7 @@ function Page_Distrubion(socket) ...@@ -405,6 +438,7 @@ function Page_Distrubion(socket)
} }
var clean = function() { var clean = function() {
welcome.hide()
title.clean() title.clean()
packages.clean() packages.clean()
files.clean() files.clean()
...@@ -471,6 +505,11 @@ function Page_Distrubion(socket) ...@@ -471,6 +505,11 @@ function Page_Distrubion(socket)
error.set(socket_error) error.set(socket_error)
}) })
socket.on(config.events.broadcast.distributions, function (socket_data) {
debug_socket("received", config.events.broadcast.distributions, socket_data)
welcome.set(socket_data)
})
socket.on(_e.distribution_packages.set, function (socket_data){ socket.on(_e.distribution_packages.set, function (socket_data){
debug_socket("received", _e.distribution_packages.set, socket_data) debug_socket("received", _e.distribution_packages.set, socket_data)
packages.set(socket_data) packages.set(socket_data)
......
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
margin: 0; margin: 0;
} }
#welcome .btn-lg {
margin: 10px;
}
aside .nav-pills li { aside .nav-pills li {
line-height: 10px; line-height: 10px;
} }
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
<header> <header>
<h1 id="title"></h1> <h1 id="title"></h1>
</header> </header>
<div id="welcome"></div>
<div id="file"> <div id="file">
<pre></pre> <pre></pre>
<div id="fileOffset"></div> <div id="fileOffset"></div>
......
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