<commit_before>var isFunction = require('lodash/lang/isFunction');
var dispatcher = require('focus-core').dispatcher;
var Empty = require('../../common/empty').component;
module.exports = {
    /**
     * Register the cartridge.
     */
    _registerCartridge: function registerCartridge(){
      this.cartridgeConfiguration = this.cartridgeConfiguration || this.props.cartridgeConfiguration;
      if(!isFunction(this.cartridgeConfiguration)){
        this.cartridgeConfiguration = function cartridgeConfiguration(){
          return {};
        };
        console.warn(`
          Your detail page does not have any cartrige configuration, this is not mandarory but recommended.
          It should be a component attribute return by a function.
          function cartridgeConfiguration(){
            var cartridgeConfiguration = {
              summary: {component: "A React Component", props: {id: this.props.id}},
              cartridge: {component: "A React Component"},
              actions: {components: "react actions"}
            };
            return cartridgeConfiguration;
          }
        `);
      }
      var cartridgeConf = this.cartridgeConfiguration();
      dispatcher.handleViewAction({
        data: {
          cartridgeComponent: cartridgeConf.cartridge || {component: Empty},
          summaryComponent: cartridgeConf.summary|| {component: Empty},
          actions: cartridgeConf.actions|| {primary: [], secondary: Empty},
          barContentLeftComponent: cartridgeConf.barLeft || {component: Empty}
        },
        type: 'update'
      });
    },
    componentWillMount: function pageMixinWillMount(){
      this._registerCartridge();
    }
};<commit_msg>[cartridge] Fix #715<commit_after>var isFunction = require('lodash/lang/isFunction');
var dispatcher = require('focus-core').dispatcher;
var Empty = require('../../common/empty').component;
module.exports = {
    /**
     * Register the cartridge.
     */
    _registerCartridge: function registerCartridge(){
      this.cartridgeConfiguration = this.cartridgeConfiguration || this.props.cartridgeConfiguration;
      if(!isFunction(this.cartridgeConfiguration)){
        this.cartridgeConfiguration = function cartridgeConfiguration(){
          return {};
        };
        console.warn(`
          Your detail page does not have any cartrige configuration, this is not mandarory but recommended.
          It should be a component attribute return by a function.
          function cartridgeConfiguration(){
            var cartridgeConfiguration = {
              summary: {component: "A React Component", props: {id: this.props.id}},
              cartridge: {component: "A React Component"},
              actions: {components: "react actions"}
            };
            return cartridgeConfiguration;
          }
        `);
      }
      var cartridgeConf = this.cartridgeConfiguration();
      dispatcher.handleViewAction({
        data: {
          cartridgeComponent: cartridgeConf.cartridge || {component: Empty},
          summaryComponent: cartridgeConf.summary|| {component: Empty},
          actions: cartridgeConf.actions|| {primary: [], secondary: []},
          barContentLeftComponent: cartridgeConf.barLeft || {component: Empty}
        },
        type: 'update'
      });
    },
    componentWillMount: function pageMixinWillMount(){
      this._registerCartridge();
    }
};
{'fraction_non_alphanumeric': 0.10989982321744254, 'fraction_numerical': 0.0008839127872716559, 'mean_word_length': 2.6862106406080346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '656096', 'n_tokens_mistral': 865, 'n_tokens_neox': 785, 'n_words': 203}