var _ = require('underscore'); var $ = require('jquery'); var React = require('react/addons'); var Radial = require('./Radial.react'); var ContainerHomePreview = require('./ContainerHomePreview.react'); var ContainerHomeLogs = require('./ContainerHomeLogs.react'); var ContainerHomeFolders = require('./ContainerHomeFolders.react'); var shell = require('shell'); var ContainerHome = React.createClass({ contextTypes: { router: React.PropTypes.func }, componentDidMount: function() { this.handleResize(); window.addEventListener('resize', this.handleResize); }, componentWillUnmount: function() { window.removeEventListener('resize', this.handleResize); }, componentDidUpdate: function () { this.handleResize(); }, handleResize: function () { $('.left .wrapper').height(window.innerHeight - 240); $('.right .wrapper').height(window.innerHeight / 2 - 100); }, handleErrorClick: function () { shell.openExternal('https://github.com/kitematic/kitematic/issues/new'); }, render: function () { if (!this.props.container) { return; } let body; if (this.props.container.Error) { body = (

An error occurred:

{this.props.container.Error.message}

If you feel that this error is invalid, please file a ticket on our GitHub repo.

); } else if (this.props.container && this.props.container.State.Downloading) { if (this.props.container.Progress !== undefined) { if (this.props.container.Progress > 0) { body = (

Downloading Image

); } else { body = (

Downloading Image

); } } else if (this.props.container.State.Waiting) { body = (

Waiting For Another Download

); } else { body = (

Connecting to Docker Hub

); } } else { if (this.props.defaultPort) { body = (
); } else { var right; if (_.keys(this.props.ports) > 0) { right = (
); } else { right = (
); } body = (
{right}
); } } return body; } }); module.exports = ContainerHome;