Pretty restart questions

This commit is contained in:
Ruud
2012-04-16 00:37:48 +02:00
parent 1dc5b4bac4
commit 7b95fd1a3c
+47 -2
View File
@@ -70,13 +70,13 @@ var CouchPotato = new Class({
[new Element('a.orange', {
'text': 'Restart',
'events': {
'click': self.restart.bind(self)
'click': self.restartQA.bind(self)
}
}),
new Element('a.red', {
'text': 'Shutdown',
'events': {
'click': self.shutdown.bind(self)
'click': self.shutdownQA.bind(self)
}
}),
new Element('a', {
@@ -161,6 +161,29 @@ var CouchPotato = new Class({
self.checkAvailable(1000);
},
shutdownQA: function(){
var self = this;
new Question('Are you sure you want to shutdown CouchPotato?', '', [{
'text': 'Shutdown',
'class': 'shutdown red',
'events': {
'click': function(e){
(e).preventDefault();
self.blockPage('You have shutdown. This is what suppose to happen ;)');
Api.request('app.shutdown', {
'onComplete': self.blockPage.bind(self)
});
self.checkAvailable(1000);
}
}
}, {
'text': 'No, nevah!',
'cancel': true
}]);
},
restart: function(message, title){
var self = this;
@@ -169,6 +192,28 @@ var CouchPotato = new Class({
self.checkAvailable(1000);
},
restartQA: function(message, title){
var self = this;
new Question('Are you sure you want to restart CouchPotato?', '', [{
'text': 'Restart',
'class': 'restart orange',
'events': {
'click': function(e){
(e).preventDefault();
self.blockPage(message || 'Restarting... please wait. If this takes to long, something must have gone wrong.', title);
Api.request('app.restart');
self.checkAvailable(1000);
}
}
}, {
'text': 'No, nevah!',
'cancel': true
}]);
},
checkForUpdate: function(func){
var self = this;