Check for update feedback

This commit is contained in:
Ruud
2012-02-11 14:40:34 +01:00
parent 625bd9db70
commit 2791ca0230
3 changed files with 31 additions and 17 deletions
+19 -15
View File
@@ -135,7 +135,7 @@ var CouchPotato = new Class({
Api.request('app.shutdown', {
'onComplete': self.blockPage.bind(self)
});
self.checkAvailable();
self.checkAvailable(1000);
},
restart: function(){
@@ -143,32 +143,36 @@ var CouchPotato = new Class({
self.blockPage('Restarting... please wait. If this takes to long, something must have gone wrong.');
Api.request('app.restart');
self.checkAvailable();
self.checkAvailable(1000);
},
checkAvailable: function(){
checkAvailable: function(delay){
var self = this;
Api.request('app.available', {
'onFailure': function(){
self.checkAvailable.delay(1000, self);
self.fireEvent('unload');
},
'onSuccess': function(){
self.unBlockPage();
self.fireEvent('load');
}
});
(function(){
Api.request('app.available', {
'onFailure': function(){
self.checkAvailable.delay(1000, self);
self.fireEvent('unload');
},
'onSuccess': function(){
self.unBlockPage();
self.fireEvent('load');
}
});
}).delay(delay || 0)
},
blockPage: function(message){
blockPage: function(message, title){
var self = this;
if(!self.mask){
var body = $(document.body);
self.mask = new Spinner(document.body, {
'message': new Element('div').adopt(
new Element('h1', {'text': 'Unavailable.'}),
new Element('h1', {'text': title || 'Unavailable'}),
new Element('div', {'text': message || 'Something must have crashed.. check the logs ;)'})
)
});
+11 -2
View File
@@ -85,10 +85,16 @@ var AboutSettingTab = new Class({
}).inject(self.content).adopt(
new Element('dl.info').adopt(
new Element('dt[text=Version]'),
self.version_text = new Element('dd', {
self.version_text = new Element('dd.version', {
'text': 'Getting version...',
'events': {
'click': self.checkForUpdate.bind(self)
'click': self.checkForUpdate.bind(self),
'mouseenter': function(){
this.set('text', 'Check for updates')
},
'mouseleave': function(){
self.fillVersion(Updater.getInfo())
}
}
}),
new Element('dt[text=Directories]'),
@@ -137,6 +143,9 @@ var AboutSettingTab = new Class({
Updater.check(function(json){
self.fillVersion(json)
})
App.blockPage('Please wait. If this takes to long, something must have gone wrong.', 'Checking for updates');
App.checkAvailable(3000);
}
});
@@ -532,6 +532,7 @@
margin: 0;
font-style: italic;
}
.page .tab_about .info dd.version { cursor: pointer; }
.page .tab_about .group_actions > div {
padding: 30px;