diff --git a/src/Setup.react.js b/src/Setup.react.js
index b89e8f06a2..5e48cf41b8 100644
--- a/src/Setup.react.js
+++ b/src/Setup.react.js
@@ -4,6 +4,7 @@ var Radial = require('./Radial.react.js');
var SetupStore = require('./SetupStore');
var RetinaImage = require('react-retina-image');
var Header = require('./Header.react');
+var Util = require('./Util');
var Setup = React.createClass({
mixins: [ Router.Navigation ],
@@ -26,11 +27,18 @@ var Setup = React.createClass({
SetupStore.removeListener(SetupStore.STEP_EVENT, this.update);
SetupStore.removeListener(SetupStore.ERROR_EVENT, this.update);
},
+ handleRetry: function () {
+ SetupStore.run().catch(() => {});
+ },
+ handleOpenWebsite: function () {
+ Util.exec(['open', 'https://www.virtualbox.org/wiki/Downloads']);
+ },
update: function () {
this.setState({
progress: SetupStore.percent(),
step: SetupStore.step(),
- error: SetupStore.error()
+ error: SetupStore.error(),
+ cancelled: SetupStore.cancelled()
});
},
renderContents: function () {
@@ -64,6 +72,25 @@ var Setup = React.createClass({
);
},
+ renderCancelled: function () {
+ return (
+
+
+
+ {this.renderContents()}
+
+
+
+
Installation Cancelled
+
Couldn't Install VirtualBox
+
Kitematic did not receive the administrative privileges required to install VirtualBox.
+
Please retry or download & install VirutalBox manually from the official Oracle website.
+
+
+
+
+ );
+ },
renderError: function () {
return (
@@ -90,7 +117,9 @@ var Setup = React.createClass({
if (!SetupStore.step()) {
return false;
}
- if (this.state.error) {
+ if (this.state.cancelled) {
+ return this.renderCancelled();
+ } else if (this.state.error) {
return this.renderError();
} else {
return this.renderStep();
diff --git a/src/SetupStore.js b/src/SetupStore.js
index fc41688027..358fa9321e 100644
--- a/src/SetupStore.js
+++ b/src/SetupStore.js
@@ -11,6 +11,7 @@ var util = require('./Util');
var SUDO_PROMPT = 'Kitematic requires administrative privileges to install VirtualBox.';
var _currentStep = null;
var _error = null;
+var _cancelled = false;
var _steps = [{
name: 'downloadVirtualBox',
@@ -54,7 +55,8 @@ var _steps = [{
try {
yield util.exec(sudoCmd);
} catch (err) {
- console.log('Could not install virtualbox...');
+ _cancelled = true;
+ throw err;
}
})
}, {
@@ -127,9 +129,14 @@ var SetupStore = assign(EventEmitter.prototype, {
error: function () {
return _error;
},
- run: Promise.coroutine(function* (startAt) {
- startAt = startAt || 0;
- for (let step of _steps.slice(startAt)) {
+ cancelled: function () {
+ return _cancelled;
+ },
+ run: Promise.coroutine(function* () {
+ _error = null;
+ _cancelled = false;
+ var steps = _currentStep ? _steps.slice(_steps.indexOf(_currentStep)) : _steps;
+ for (let step of steps) {
_currentStep = step;
step.percent = 0;
try {
@@ -149,7 +156,6 @@ var SetupStore = assign(EventEmitter.prototype, {
throw err;
}
}
- _currentStep = null;
})
});