{"size": 1554, "ext": "js", "max_stars_repo_path": "app/components/desired_lrp_detail.js", "max_stars_repo_name": "pivotal-cf-experimental/xray", "max_stars_repo_stars_event_min_datetime": "2015-04-27T06:12:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-19T08:30:59.000Z", "max_issues_repo_path": "app/components/desired_lrp_detail.js", "max_issues_repo_name": "pivotal-cf-experimental/xray", "max_issues_repo_issues_event_min_datetime": "2015-04-27T15:31:43.000Z", "max_issues_repo_issues_event_max_datetime": "2015-11-19T21:04:56.000Z", "max_forks_repo_path": "app/components/desired_lrp_detail.js", "max_forks_repo_name": "pivotal-cf-experimental/xray", "max_forks_repo_forks_event_min_datetime": "2015-04-30T17:25:38.000Z", "max_forks_repo_forks_event_max_datetime": "2015-11-19T21:01:06.000Z"}
{"max_stars_count": 20, "max_issues_count": 7, "max_forks_count": 7, "avg_line_length": 34.5333333333, "max_line_length": 124, "alphanum_fraction": 0.6788931789}
var ActualLrpList = require('./actual_lrp_list');
var DesiredLrp = require('./desired_lrp');
var PureRenderMixin = require('pui-cursor/mixins/pure-render-mixin');
var React = require('react');

var types = React.PropTypes;

var DesiredLrpDetail = React.createClass({
  mixins: [PureRenderMixin],

  propTypes: {
    $receptor: types.object.isRequired,
    $selection: types.object.isRequired,
    $sidebar: types.object.isRequired
  },

  render() {
    var {$receptor, $selection, $sidebar} = this.props;
    var {actualLrpsByProcessGuid = {}, desiredLrpsByProcessGuid = {}} = $receptor.get();
    var {selectedDesiredLrp} = $selection.get();
    var desiredLrp = selectedDesiredLrp && desiredLrpsByProcessGuid[selectedDesiredLrp.process_guid];
    var isDeleted = false;
    if(!desiredLrp) {
      if(selectedDesiredLrp) {
        desiredLrp = selectedDesiredLrp;
        isDeleted = true;
      } else {
        return null;
      }
    }

    var actualLrps = actualLrpsByProcessGuid[desiredLrp.process_guid] || [];
    var $hoverActualLrp = $selection.refine('hoverActualLrp');
    var $hoverSidebarActualLrp = $sidebar.refine('hoverActualLrp');
    return (
      <div className="desired-lrp-detail">
        <DesiredLrp {...{actualLrps, desiredLrp, $selection, $sidebar}}/>
        {isDeleted && <span className="pal">This process has been deleted. Information in this panel is out of date.</span>}
        <ActualLrpList {...{actualLrps, $hoverActualLrp, $hoverSidebarActualLrp}}/>
      </div>
    );
  }
});

module.exports = DesiredLrpDetail;