<commit_before>import React, { Component, PropTypes } from 'react'
import { connect } from 'stripes-connect';
import DeploymentForm from './DeploymentForm'


export class Deployments extends Component {

  static manifest = { 'discovery_modules':  { type: 'okapi',
                                              path: '_/discovery/modules',
                                              pk: 'instId'
                                            },
                      'discovery_nodes':    { type: 'okapi',
                                              path: '_/discovery/nodes',
                                              pk:   'nodeId'
                                            },
                      'deployment_modules': { type: 'okapi',
                                              path: '_/deployment/modules', 
                                              pk: 'instId',
                                              clientGeneratePk: false
                                            }
                    };

  constructor(props) {
    super(props);
  }

  addDeploy (data) {
    this.props.mutator['deployment_modules'].create(data).then(() =>
      this.props.refreshRemote(this.props)
    );
  }

  deleteDeploy (data) {
    this.props.mutator['deployment_modules'].delete(data).then(() =>
      this.props.refreshRemote(this.props)
    );
  }

  render () {

    const srvcId = this.props.srvcId;
    
    let nextindex=this.props.data['discovery_modules'].length;
    let discoveryNodes = this.props.data['discovery_nodes'];
    if (discoveryNodes.length==0) {
      return <div/>
    }
    return (
     <div>
     {this.props.data['discovery_modules'].map((deployment, index) =>
       {if (deployment.srvcId===srvcId) {
         return (
        <DeploymentForm
          key={index}
          deployNodes={discoveryNodes}
          formKey={index.toString()}
          initialValues={deployment}
          onSubmit={this.deleteDeploy.bind(this)}
          disable={true} />);
       }}
      )}
     <br/>
     <DeploymentForm 
       key={nextindex}
       deployNodes={discoveryNodes}
       formKey={nextindex.toString()}
       initialValues={ {srvcId: srvcId} }
       onSubmit={this.addDeploy.bind(this)}
       disable={false}/>
     </div>
    );
  }
}

export default connect(Deployments, 'okapi-console');<commit_msg>Changes name of form identifier<commit_after>import React, { Component, PropTypes } from 'react'
import { connect } from 'stripes-connect';
import DeploymentForm from './DeploymentForm'


export class Deployments extends Component {

  static manifest = { 'discovery_modules':  { type: 'okapi',
                                              path: '_/discovery/modules',
                                              pk: 'instId'
                                            },
                      'discovery_nodes':    { type: 'okapi',
                                              path: '_/discovery/nodes',
                                              pk:   'nodeId'
                                            },
                      'deployment_modules': { type: 'okapi',
                                              path: '_/deployment/modules', 
                                              pk: 'instId',
                                              clientGeneratePk: false
                                            }
                    };

  constructor(props) {
    super(props);
  }

  addDeploy (data) {
    this.props.mutator['deployment_modules'].create(data).then(() => {
      this.props.refreshRemote(this.props)
    }
    );
  }

  deleteDeploy (data) {
    this.props.mutator['deployment_modules'].delete(data).then(() =>
      this.props.refreshRemote(this.props)
    );
  }

  render () {

    const srvcId = this.props.srvcId;
    
    let nextindex=this.props.data['discovery_modules'].length;
    let discoveryNodes = this.props.data['discovery_nodes'];
    if (discoveryNodes.length==0) {
      return <div/>
    }
    return (
     <div>
     {this.props.data['discovery_modules'].map((deployment, index) =>
       {if (deployment.srvcId===srvcId) {
         return (
        <DeploymentForm
          form={'dep-' + index.toString()}
          deployNodes={discoveryNodes}
          initialValues={deployment}
          onSubmit={this.deleteDeploy.bind(this)}
          disable={true} />);
       }}
      )}
     <br/>
     <DeploymentForm 
       form={'dep-' + nextindex.toString()}
       deployNodes={discoveryNodes}
       initialValues={ {srvcId: srvcId} }
       onSubmit={this.addDeploy.bind(this)}
       disable={false}/>
     </div>
    );
  }
}

export default connect(Deployments, 'okapi-console');
{'fraction_non_alphanumeric': 0.1213024047669717, 'fraction_numerical': 0.00042562247286656737, 'mean_word_length': 1.422680412371134, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7041736', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1171, 'n_words': 195}