<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'stripes-connect';
import ModuleForm from './ModuleForm';
import { removeEmpty } from '../utils/removeEmptyObjectsFromArrays';


class ModuleEdit extends Component {
  static contextTypes = {
    router: PropTypes.object.isRequired
  };

  static manifest = { 'modules': { type: 'okapi',
                                   path: '_/proxy/modules/:moduleid'
                                 }
                    };

  update(data) {
    removeEmpty(data);
    this.props.mutator['modules'].PUT(data).then(()=>
      this.context.router.push('/okapi-console/modules/list')
    )
  }

  cancel(data) {
    this.context.router.push('/okapi-console/modules/list');
  }

  render() {
    const { data: {modules}, mutator } = this.props;

    let moduleid = this.props.params.moduleid;
    let module = modules.find((module) =>  { return module.id === moduleid });
    if (!module || !module.provides) {
      return <div/>;
    }
    return <ModuleForm initialValues={module} onSubmit={this.update.bind(this)} cancelForm={this.cancel.bind(this)} />
  }
}

export default connect(ModuleEdit, 'okapi-console');
<commit_msg>Removes check for 'provision' being present, not mandatory<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'stripes-connect';
import ModuleForm from './ModuleForm';
import { removeEmpty } from '../utils/removeEmptyObjectsFromArrays';


class ModuleEdit extends Component {
  static contextTypes = {
    router: PropTypes.object.isRequired
  };

  static manifest = { 'modules': { type: 'okapi',
                                   path: '_/proxy/modules/:moduleid'
                                 }
                    };

  update(data) {
    removeEmpty(data);
    this.props.mutator['modules'].PUT(data).then(()=>
      this.context.router.push('/okapi-console/modules/list')
    )
  }

  cancel(data) {
    this.context.router.push('/okapi-console/modules/list');
  }

  render() {
    const { data: {modules}, mutator } = this.props;

    let moduleid = this.props.params.moduleid;
    let module = modules.find((module) =>  { return module.id === moduleid });
    if (!module) {
      return <div/>;
    }
    return <ModuleForm initialValues={module} onSubmit={this.update.bind(this)} cancelForm={this.cancel.bind(this)} />
  }
}

export default connect(ModuleEdit, 'okapi-console');

{'fraction_non_alphanumeric': 0.14870954526833266, 'fraction_numerical': 0.0, 'mean_word_length': 2.7978227060653187, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4805326', 'n_tokens_mistral': 713, 'n_tokens_neox': 704, 'n_words': 142}