var $ = require('jquery'); var React = require('react/addons'); var Router = require('react-router'); var remote = require('remote'); var dialog = remote.require('dialog'); var ContainerStore = require('./ContainerStore'); var ContainerListItem = React.createClass({ handleItemMouseEnter: function () { var $action = $(this.getDOMNode()).find('.action'); $action.show(); }, handleItemMouseLeave: function () { var $action = $(this.getDOMNode()).find('.action'); $action.hide(); }, handleDeleteContainer: function () { dialog.showMessageBox({ message: 'Are you sure you want to delete this container?', buttons: ['Delete', 'Cancel'] }, function (index) { if (index === 0) { ContainerStore.remove(this.props.container.Name, function (err) { console.error(err); var containers = ContainerStore.sorted(); if (containers.length === 1) { $(document.body).find('.new-container-item').parent().fadeIn(); } }); } }.bind(this)); return false; }, render: function () { var self = this; var container = this.props.container; var imageName = container.Config.Image; // Synchronize all animations var style = { WebkitAnimationDelay: (self.props.start - Date.now()) + 'ms' }; var state; if (container.State.Downloading) { state =
; } else if (container.State.Running && !container.State.Paused) { state =
; } else if (container.State.Restarting) { state =
; } else if (container.State.Paused) { state =
; } else if (container.State.ExitCode) { // state =
; state =
; } else { state =
; } return (
  • {state}
    {container.Name}
    {imageName}
  • ); } }); module.exports = ContainerListItem;