<commit_before>import React from "react";
import simpleStorage from './../../../vendor/simpleStorage.js';
export default React.createClass( {
  componentDidUpdate(){
    if(this.props.result !== 'IN_PROGRESS' ){
      this._webNotifyCompletion();
    }
  },
  render(){
    const buildActions = [];
    if(this.props.inProgress){
      this._add(buildActions,"cancel", <a onClick={this._cancelBuild} href="#">Cancel</a>);
      if(this._supportsNotifications()){
        this._add(buildActions,"visibility", <a onClick={this._watchBuild} href="#">Watch</a>);
      }
    }else{
      this._add(buildActions,"autorenew", <a href={this.props.number+"/rebuild"}>Restart</a>);
    }
    this._add(buildActions,"delete", <a href={this.props.number+"/confirmDelete"}>Delete</a>);
    this._add(buildActions,"label",
              <a href={this.props.number+"/detail"}>More...</a>);
              return <span> {buildActions} </span>
  },
  _supportsNotifications(){
    return simpleStorage.canUse() && ("Notification" in window);
  },
  _watchBuild(e){
    e.preventDefault();
    Notification.requestPermission((result)=>{
      if(result === 'granted'){
        const url = this.props.cancelUrl;
        simpleStorage.set(url, true, {TTL: 7200000}) // 2 hrs
      }
    });
  },
  _webNotifyCompletion(){
    const url = this.props.cancelUrl;
    if(simpleStorage.get(url)){
      new Notification(`Build #${this.props.number} finished with ${this.props.result}`, {body:`${this.props.commit.get('message')}`, icon: "<iron-icon icon='done'></iron-icon>"});
      simpleStorage.deleteKey(url);
    }
  },
  _cancelBuild(e){
    e.preventDefault();
    const appActions = this.props.actions;
    appActions.CancelBuild(this.props.cancelUrl);
  },
  _add(actions, icon,action){
    actions.push(
      <paper-icon-item key={icon}>
        <iron-icon icon={icon} />{action}
      </paper-icon-item>
    );
  }
})<commit_msg>Removing build number from rebuild, delete, and more links<commit_after>import React from "react";
import page from 'page';
import simpleStorage from './../../../vendor/simpleStorage.js';
export default React.createClass( {
  componentDidUpdate(){
    if(this.props.result !== 'IN_PROGRESS' ){
      this._webNotifyCompletion();
    }
  },
  render(){
    const buildActions = [];
    if(this.props.inProgress){
      this._add(buildActions,"cancel", <a onClick={this._cancelBuild} href="#">Cancel</a>);
      if(this._supportsNotifications()){
        this._add(buildActions,"visibility", <a onClick={this._watchBuild} href="#">Watch</a>);
      }
    }else{
      this._add(buildActions,"autorenew", <a href={this._actionUrl("rebuild")}>Restart</a>);
    }
    this._add(buildActions,"delete", <a href={this._actionUrl("confirmDelete")}>Delete</a>);
    this._add(buildActions,"label",
              <a href={this._actionUrl("detail")}>More...</a>);
              return <span> {buildActions} </span>
  },
  _supportsNotifications(){
    return simpleStorage.canUse() && ("Notification" in window);
  },
  _watchBuild(e){
    e.preventDefault();
    Notification.requestPermission((result)=>{
      if(result === 'granted'){
        const url = this.props.cancelUrl;
        simpleStorage.set(url, true, {TTL: 7200000}) // 2 hrs
      }
    });
  },
  _webNotifyCompletion(){
    const url = this.props.cancelUrl;
    if(simpleStorage.get(url)){
      new Notification(`Build #${this.props.number} finished with ${this.props.result}`, {body:`${this.props.commit.get('message')}`, icon: "<iron-icon icon='done'></iron-icon>"});
      simpleStorage.deleteKey(url);
    }
  },
  _actionUrl(action) {
    return page.base() + "/" + this.props.number + "/" + action;
  },
  _cancelBuild(e){
    e.preventDefault();
    const appActions = this.props.actions;
    appActions.CancelBuild(this.props.cancelUrl);
  },
  _add(actions, icon,action){
    actions.push(
      <paper-icon-item key={icon}>
        <iron-icon icon={icon} />{action}
      </paper-icon-item>
    );
  }
})
{'fraction_non_alphanumeric': 0.18726497869140135, 'fraction_numerical': 0.004011030333416896, 'mean_word_length': 3.4382647385984426, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 39, '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': '7053373', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1250, 'n_words': 203}