<commit_before>(function(){
  const {React, rpc}=Serverboards

  class Mini5 extends React.Component{
    constructor(props){
      super(props)
      this.state = {
        title: undefined, color: undefined,
        text_left: undefined, text_right: undefined,
        icon_left: undefined, icon_right: undefined,
        expr_left: undefined, expr_right: undefined
      }
    }
    componentDidMount(){
      const props = this.props
      props.setClass( `${props.config.color || "grey"} card` )
      props.setTitle(" ")

      rpc.call("dashboard.widget.extract", [props.uuid]).then( newstate => {
        let state = newstate[0]
        state.expr_left=state.expr_left.rows[0][0]
        state.expr_right=state.expr_right.rows[0][0]
        this.setState(state)
      })
    }<commit_msg>[WIP] Mini5 accepts config updates<commit_after>(function(){
  const {React, rpc}=Serverboards

  class Mini5 extends React.Component{
    constructor(props){
      super(props)
      this.state = {
        title: props.config.title, color: props.config.color,
        text_left: props.config.text_left, text_right: props.config.text_right,
        icon_left: props.config.icon_left, icon_right: props.config.icon_right,
        expr_left: undefined, expr_right: undefined
      }
    }
    componentDidMount(){
      const props = this.props
      props.setTitle(" ")

      this.updateData(props)
    }
    updateData(props){
      props.setClass( `${props.config.color || "grey"} card` )
      rpc.call("dashboard.widget.extract", [props.uuid]).then( newstate => {
        let state = newstate[0]
        state.expr_left=state.expr_left.rows[0][0]
        state.expr_right=state.expr_right.rows[0][0]
        console.log("Got new state", state)
        this.setState(state)
      })
    }
    componentWillReceiveProps(newprops){
      if (!Serverboards.utils.object_is_equal(newprops.config, this.props.config)){
        console.log("New props: ", newprops)
        this.updateData(newprops)
      }
    }
{'fraction_non_alphanumeric': 0.12967581047381546, 'fraction_numerical': 0.006483790523690773, 'mean_word_length': 2.842911877394636, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2631708', 'n_tokens_mistral': 619, 'n_tokens_neox': 614, 'n_words': 108}