<commit_before>/** @jsx React.DOM */

define(
  [
    'react',
    'backbone'
  ],
  function (React, Backbone) {

    return React.createClass({
      displayName: "Status",

      propTypes: {
        volume: React.PropTypes.instanceOf(Backbone.Model).isRequired,
        instances: React.PropTypes.instanceOf(Backbone.Collection).isRequired
      },

      render: function () {
        var status = this.props.volume.get('status'),
            placeholderMessage = status;

        if(status === "available"){
          placeholderMessage = "Unattached";
        }else if(status === "in-use"){
          var attachData = this.props.volume.get('attach_data');
          var instance = this.props.instances.get(attachData.instance_id);
          if(instance) {
            placeholderMessage = "Attached to " + instance.get('name') + " as device " + attachData.device;
          }else{
            placeholderMessage = "Attached to instance outside project (" + attachData.instance_id + ")";
          }
        }

        return (
          <span>
            {placeholderMessage}
          </span>
        );
      }

    });

  });
<commit_msg>show volume status as bar in table (like instance)<commit_after>/** @jsx React.DOM */

define(
  [
    'react',
    'backbone',
    'components/projects/common/StatusLight.react',
    '../instance/StatusBar.react'
  ],
  function (React, Backbone, StatusLight, StatusBar) {

    return React.createClass({
      displayName: "Status",

      propTypes: {
        volume: React.PropTypes.instanceOf(Backbone.Model).isRequired,
        instances: React.PropTypes.instanceOf(Backbone.Collection).isRequired
      },

      render: function () {
        var volumeState = this.props.volume.get('state');
        var status = volumeState.get('status');
        var activity = volumeState.get('activity');
        var placeholderMessage = status;

        if(status === "available"){
          placeholderMessage = "Unattached";
        }else if(status === "in-use"){
          var attachData = this.props.volume.get('attach_data');
          var instance = this.props.instances.get(attachData.instance_id);
          var style = {};

          if(instance) {
            placeholderMessage = "Attached to " + instance.get('name');
          }else{
            placeholderMessage = "Attached to instance outside project (" + attachData.instance_id + ")";
            style = {color: "#d44950"}
          }
        }

//        return (
//          <span>
//            {placeholderMessage}
//          </span>
//        );

        return (
          <span>
            <div>
              <StatusLight state={volumeState}/>
              <span style={style}>{placeholderMessage}</span>
            </div>
            <StatusBar state={volumeState} activity={activity}/>
          </span>
        );
      }

    });

  });

{'fraction_non_alphanumeric': 0.13707708405999303, 'fraction_numerical': 0.0017439832577607255, 'mean_word_length': 2.006289308176101, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2657263', 'n_tokens_mistral': 795, 'n_tokens_neox': 776, 'n_words': 149}