var React = require('react/addons'); var Router = require('react-router'); var Modal = require('react-bootstrap/Modal'); var RetinaImage = require('react-retina-image'); var ModalTrigger = require('react-bootstrap/ModalTrigger'); var ContainerModal = require('./ContainerModal.react'); var ContainerStore = require('./ContainerStore'); var Header = require('./Header.react'); var async = require('async'); var _ = require('underscore'); var docker = require('./docker'); var $ = require('jquery'); var Link = Router.Link; var RouteHandler = Router.RouteHandler; var Navigation= Router.Navigation; var ContainerList = React.createClass({ mixins: [Navigation], getInitialState: function () { return { active: null, containers: [] }; }, componentDidMount: function () { this.update(); if (this.state.containers.length > 0) { var name = this.state.containers[0].Name.replace('/', ''); active = name; ContainerStore.setActive(name); } ContainerStore.addChangeListener(ContainerStore.CONTAINERS, this.update); ContainerStore.addChangeListener(ContainerStore.ACTIVE, this.update); }, componentWillMount: function () { this._start = Date.now(); }, componentWillUnmount: function () { ContainerStore.removeChangeListener(ContainerStore.CONTAINERS, this.update); ContainerStore.removeChangeListener(ContainerStore.ACTIVE, this.update); }, componentDidUpdate: function () { }, update: function () { var containers = _.values(ContainerStore.containers()).sort(function (a, b) { return a.Name.localeCompare(b.Name); }); this.setState({ active: ContainerStore.active(), containers: containers }); if (ContainerStore.active()) { this.transitionTo('container', {name: ContainerStore.active()}); } }, handleClick: function (containerId) { ContainerStore.setActive(name); }, render: function () { var self = this; var containers = this.state.containers.map(function (container) { var downloadingImage = null, downloading = false; var env = container.Config.Env; if (env.length) { var obj = _.object(env.map(function (e) { return e.split('='); })); if (obj.KITEMATIC_DOWNLOADING) { downloading = true; } downloadingImage = obj.KITEMATIC_DOWNLOADING_IMAGE || null; } var imageName = downloadingImage || container.Config.Image; var state; // Synchronize all animations var style = { WebkitAnimationDelay: (self._start - Date.now()) + 'ms' }; if (downloading) { state =