var React = require('react/addons'); var Router = require('react-router'); var Radial = require('./Radial.react.js'); var SetupStore = require('./SetupStore'); var RetinaImage = require('react-retina-image'); var Setup = React.createClass({ mixins: [ Router.Navigation ], getInitialState: function () { return { progress: 0, name: '' }; }, componentWillMount: function () { SetupStore.on(SetupStore.PROGRESS_EVENT, this.update); SetupStore.on(SetupStore.STEP_EVENT, this.update); SetupStore.on(SetupStore.ERROR_EVENT, this.update); }, componentDidMount: function () { this.update(); }, update: function () { this.setState({ progress: SetupStore.percent(), step: SetupStore.step(), error: SetupStore.error() }); }, renderDownloadingVirtualboxStep: function () { var message = 'Kitematic needs VirtualBox to run containers. VirtualBox is being downloaded from Oracle\'s website.'; return (

Downloading VirtualBox

{message}

); }, renderInstallingVirtualboxStep: function () { var message = 'VirtualBox is being installed. Administrative privileges are required.'; return (

Installing VirtualBox

{message}

); }, renderInitBoot2DockerStep: function () { var message = 'Containers run in a virtual machine provided by Boot2Docker. Kitematic is setting up that Linux VM.'; return (

Setting up the Docker VM

{message}

); }, renderStartBoot2DockerStep: function () { var message = 'Kitematic is starting the Boot2Docker Linux VM.'; return (

Starting the Docker VM

{message}

); }, renderStep: function () { switch(this.state.step) { case 'download_virtualbox': return this.renderDownloadingVirtualboxStep(); case 'install_virtualbox': return this.renderInstallingVirtualboxStep(); case 'cleanup_kitematic': return this.renderInitBoot2DockerStep(); case 'init_boot2docker': return this.renderInitBoot2DockerStep(); case 'start_boot2docker': return this.renderStartBoot2DockerStep(); default: return false; } }, render: function () { var step = this.renderStep(); if (this.state.error) { return (
;

Error: {this.state.error}

); } else { return step; } } }); module.exports = Setup;