Check for update feedback

This commit is contained in:
Ruud committed 2012-02-11 14:40:34 +01:00
1 parent 625bd9db70
commit 2791ca0230
3 files changed
+31 -17

No files matched your search

+19 -15
View File
@@ -135,7 +135,7 @@ var CouchPotato = new Class({
Api.request('app.shutdown', { Api.request('app.shutdown', {
'onComplete': self.blockPage.bind(self) 'onComplete': self.blockPage.bind(self)
}); });
self.checkAvailable(); self.checkAvailable(1000);
}, },
restart: function(){ 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.'); self.blockPage('Restarting... please wait. If this takes to long, something must have gone wrong.');
Api.request('app.restart'); Api.request('app.restart');
self.checkAvailable(); self.checkAvailable(1000);
}, },
checkAvailable: function(){ checkAvailable: function(delay){
var self = this; var self = this;
Api.request('app.available', { (function(){
'onFailure': function(){
self.checkAvailable.delay(1000, self); Api.request('app.available', {
self.fireEvent('unload'); 'onFailure': function(){
}, self.checkAvailable.delay(1000, self);
'onSuccess': function(){ self.fireEvent('unload');
self.unBlockPage(); },
self.fireEvent('load'); 'onSuccess': function(){
} self.unBlockPage();
}); self.fireEvent('load');
}
});
}).delay(delay || 0)
}, },
blockPage: function(message){ blockPage: function(message, title){
var self = this; var self = this;
if(!self.mask){ if(!self.mask){
var body = $(document.body); var body = $(document.body);
self.mask = new Spinner(document.body, { self.mask = new Spinner(document.body, {
'message': new Element('div').adopt( '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 ;)'}) 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( }).inject(self.content).adopt(
new Element('dl.info').adopt( new Element('dl.info').adopt(
new Element('dt[text=Version]'), new Element('dt[text=Version]'),
self.version_text = new Element('dd', { self.version_text = new Element('dd.version', {
'text': 'Getting version...', 'text': 'Getting version...',
'events': { '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]'), new Element('dt[text=Directories]'),
@@ -137,6 +143,9 @@ var AboutSettingTab = new Class({
Updater.check(function(json){ Updater.check(function(json){
self.fillVersion(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; margin: 0;
font-style: italic; font-style: italic;
} }
.page .tab_about .info dd.version { cursor: pointer; }
.page .tab_about .group_actions > div { .page .tab_about .group_actions > div {
padding: 30px; padding: 30px;