don't make the dialogs synchronous

This commit is contained in:
Stephen Birarda 2016-01-20 14:54:52 -08:00
parent 54c13efe6a
commit 278ab0fa8f

View file

@ -330,27 +330,27 @@ function isStackManagerContentPresent() {
} }
function promptToMigrateContent() { function promptToMigrateContent() {
var idx = dialog.showMessageBox({ dialog.showMessageBox({
type: 'question', type: 'question',
buttons: ['Yes', 'No'], buttons: ['Yes', 'No'],
title: 'Migrate Content', title: 'Migrate Content',
message: 'Are you sure?\n\nThis will stop your home server and replace everything in your home with your content from Stack Manager.' message: 'Are you sure?\n\nThis will stop your home server and replace everything in your home with your content from Stack Manager.'
}); }, function(index) {
if (index == 0) {
if (homeServer.state != ProcessGroupStates.STOPPED) {
homeServer.on('state-update', function(processGroup) {
if (processGroup.state == ProcessGroupStates.STOPPED) {
performContentMigration();
}
});
if (idx == 0) { homeServer.stop();
if (homeServer.state != ProcessGroupStates.STOPPED) {
homeServer.on('state-update', function(processGroup) {
if (processGroup.state == ProcessGroupStates.STOPPED) {
performContentMigration();
}
});
homeServer.stop(); } else {
performContentMigration();
} else { }
performContentMigration();
} }
} });
} }
function performContentMigration() { function performContentMigration() {
@ -366,7 +366,7 @@ function performContentMigration() {
buttons: ['OK'], buttons: ['OK'],
title: 'Models File Not Found', title: 'Models File Not Found',
message: 'There is no models file at ' + modelsPath + '\n\nStack Manager content migration can not proceed.' message: 'There is no models file at ' + modelsPath + '\n\nStack Manager content migration can not proceed.'
}); }, null);
return; return;
} }
@ -381,7 +381,7 @@ function performContentMigration() {
buttons: ['OK'], buttons: ['OK'],
title: 'Migration Complete', title: 'Migration Complete',
message: 'Your Stack Manager content has been migrated.\n\nYour home server will now be restarted.' message: 'Your Stack Manager content has been migrated.\n\nYour home server will now be restarted.'
}); }, null);
} else { } else {
// show error message for copy fail // show error message for copy fail
dialog.showMessageBox({ dialog.showMessageBox({
@ -389,7 +389,7 @@ function performContentMigration() {
buttons: ['OK'], buttons: ['OK'],
title: 'Migration Failed', title: 'Migration Failed',
message: 'There was an error copying your Stack Manager content: ' + copyError + '\n\nPlease try again.' message: 'There was an error copying your Stack Manager content: ' + copyError + '\n\nPlease try again.'
}); }, null);
} }
} }