<commit_before>import React from 'react';
import Relay from 'react-relay';
import DocumentTitle from 'react-document-title';

import PageWithContainer from '../../shared/PageWithContainer';

import Agents from './agents';
import AgentTokens from './agent-tokens';
import AgentInstallation from './installation';
import QuickStart from './quick-start';

class AgentIndex extends React.Component {
  static propTypes = {
    location: React.PropTypes.shape({
      query: React.PropTypes.object
    }).isRequired,
    organization: React.PropTypes.shape({
      name: React.PropTypes.string.isRequired,
      permissions: React.PropTypes.shape({
        agentTokenView: React.PropTypes.shape({
          allowed: React.PropTypes.bool.isRequired
        }).isRequired
      }).isRequired
    }).isRequired,
    viewer: React.PropTypes.object.isRequired
  };

  render() {
    return (
      <DocumentTitle title={`Agents · ${this.props.organization.name}`}>
        <PageWithContainer>
          {this.renderContent()}
        </PageWithContainer>
      </DocumentTitle>
    );
  }

  renderContent() {
    const { organization, viewer, location, location: { query } } = this.props;

    // Switches between showing just the agents, or the agents along with
    // registration tokens.
    if (organization.permissions.agentTokenView.allowed) {
      if (query.setup === 'true') {
        return (
          <div className="clearfix mxn3 md-col-9 lg-col-8 mx-auto">
            <QuickStart
              title="Select the environment to set up your first agent"
              center={false}
              organization={organization}
              viewer={viewer}
              location={location}
            />
            <AgentInstallation organization={organization} />
            <AgentTokens
              title="Your agent token"
              organization={organization}
            />
          </div>
        );
      }

      return (
        <div className="clearfix mxn3">
          <div className="sm-col sm-col-8 px3">
            <QuickStart
              organization={organization}
              viewer={viewer}
              location={location}
            />
            <Agents organization={organization} />
          </div>
          <div className="sm-col sm-col-4 px3">
            <AgentTokens organization={organization} />
          </div>
        </div>
      );
    } else {
      return (
        <Agents organization={organization} />
      );
    }
  }
}

export default Relay.createContainer(AgentIndex, {
  fragments: {
    viewer: () => Relay.QL`
      fragment on Viewer {
        ${QuickStart.getFragment('viewer')}
      }
    `,
    organization: () => Relay.QL`
      fragment on Organization {
        ${Agents.getFragment('organization')}
        ${AgentTokens.getFragment('organization')}
        ${AgentInstallation.getFragment('organization')}
        ${QuickStart.getFragment('organization')}
        name
        permissions {
          agentTokenView {
            allowed
          }
        }
      }
    `
  }
});
<commit_msg>Roll back the local vars<commit_after>import React from 'react';
import Relay from 'react-relay';
import DocumentTitle from 'react-document-title';

import PageWithContainer from '../../shared/PageWithContainer';

import Agents from './agents';
import AgentTokens from './agent-tokens';
import AgentInstallation from './installation';
import QuickStart from './quick-start';

class AgentIndex extends React.Component {
  static propTypes = {
    location: React.PropTypes.shape({
      query: React.PropTypes.object
    }).isRequired,
    organization: React.PropTypes.shape({
      name: React.PropTypes.string.isRequired,
      permissions: React.PropTypes.shape({
        agentTokenView: React.PropTypes.shape({
          allowed: React.PropTypes.bool.isRequired
        }).isRequired
      }).isRequired
    }).isRequired,
    viewer: React.PropTypes.object.isRequired
  };

  render() {
    return (
      <DocumentTitle title={`Agents · ${this.props.organization.name}`}>
        <PageWithContainer>
          {this.renderContent()}
        </PageWithContainer>
      </DocumentTitle>
    );
  }

  renderContent() {
    // Switches between showing just the agents, or the agents along with
    // registration tokens.
    if (this.props.organization.permissions.agentTokenView.allowed) {
      if (this.props.location.query.setup == 'true') {
        return (
          <div className="clearfix mxn3 md-col-9 lg-col-8 mx-auto">
            <QuickStart
              title="Select the environment to set up your first agent"
              center={false}
              organization={this.props.organization}
              viewer={this.props.viewer}
              location={this.props.location}
            />
            <AgentInstallation organization={this.props.organization} />
            <AgentTokens
              title="Your agent token"
              organization={this.props.organization}
            />
          </div>
        );
      }

      return (
        <div className="clearfix mxn3">
          <div className="sm-col sm-col-8 px3">
            <QuickStart
              organization={this.props.organization}
              viewer={this.props.viewer}
              location={this.props.location}
            />
            <Agents organization={this.props.organization} />
          </div>
          <div className="sm-col sm-col-4 px3">
            <AgentTokens organization={this.props.organization} />
          </div>
        </div>
      );
    } else {
      return (
        <Agents organization={this.props.organization} />
      );
    }
  }
}

export default Relay.createContainer(AgentIndex, {
  fragments: {
    viewer: () => Relay.QL`
      fragment on Viewer {
        ${QuickStart.getFragment('viewer')}
      }
    `,
    organization: () => Relay.QL`
      fragment on Organization {
        ${Agents.getFragment('organization')}
        ${AgentTokens.getFragment('organization')}
        ${AgentInstallation.getFragment('organization')}
        ${QuickStart.getFragment('organization')}
        name
        permissions {
          agentTokenView {
            allowed
          }
        }
      }
    `
  }
});

{'fraction_non_alphanumeric': 0.1204877266163966, 'fraction_numerical': 0.002566982191561046, 'mean_word_length': 2.086138613861386, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 45, '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': '1539217', 'n_tokens_mistral': 1666, 'n_tokens_neox': 1655, 'n_words': 343}