<commit_before>import React, {Component, PropTypes} from 'react';
import classNames from 'classnames';

import Doughnut from 'react-chartjs/lib/doughnut';
import CircularProgress from 'material-ui/lib/circular-progress';

export default class StatsPanel extends Component {

  constructor(props, context) {
    super(props, context);
  }

  _generateLifecycleStateDoughnutData(data, docType) {
    let doughnutData = [];
    doughnutData.push({ value: data[docType].new, color: "#949FB1", highlight: "#A8B3C5", label: "New" });      
    doughnutData.push({ value: data[docType].enabled, color: "#FDB45C", highlight: "#FFC870", label: "Enabled" });   
    doughnutData.push({ value: data[docType].published, color: "#46BFBD", highlight: "#5AD3D1", label: "Published" }),
    doughnutData.push({ value: data[docType].disabled, color:"#F7464A", highlight: "#FF5A5E", label: "Disabled" })   
    return doughnutData;
  }  

  _generateTwoSliceDoughnutData(total, subset, labels) {
	    let doughnutData = [];
	    let totalMinusSubset = total - subset;
	    doughnutData.push({ value: totalMinusSubset, color: "#46BFBD", highlight: "#5AD3D1", label: labels[0] }),
	    doughnutData.push({ value: subset, color:"#F7464A", highlight: "#FF5A5E", label: labels[1] })   
	    return doughnutData;
  }   
  
  render() {
    
	if (!this.props.data.success) {
		return ( 
			<div className={classNames('col-xs-12', 'col-md-6')}>
				<CircularProgress mode="indeterminate" size={3} />
			</div>
		);
	}
	
    let dataResponse = this.props.data.response;
    let docType = this.props.docType;	
	let lifecycleStateDoughnutData = this._generateLifecycleStateDoughnutData(dataResponse, docType);

    return (
		<div className={classNames('col-xs-12', 'col-md-6')}>
    		<h2>{this.props.headerText}</h2>
    		<p><strong>Total:</strong> {dataResponse[docType].total}</p>
    		<p><strong>New:</strong> {dataResponse[docType].new}</p>
    		<p><strong>Enabled:</strong> {dataResponse[docType].enabled}</p>
    		<p><strong>Published:</strong> {dataResponse[docType].published}</p> 
    		<p><strong>Disabled:</strong> {dataResponse[docType].disabled}</p> 
    		<Doughnut data={lifecycleStateDoughnutData} />
    		
    		<p><strong>Created Today:</strong> {dataResponse[docType].created_today}</p>                         
    		<p><strong>Modified Today:</strong> {dataResponse[docType].modified_today}</p> 
    		<p><strong>Created Within Last 7 Days:</strong> {dataResponse[docType].created_within_7_days}</p>                         

    		<p><strong>Available In Childrens Archive:</strong> {dataResponse[docType].available_in_childrens_archive}</p>     		
    		
    		<p><strong>Most Recently Modified:</strong></p>
    		<ul>
    			{(dataResponse[docType].most_recently_modified) ? dataResponse[docType].most_recently_modified.map((document, i) => 
    				<li key={document['ecm:uuid']}><a href={'/explore' + document['ecm:path']}>{document['dc:title']}</a> 
    	    			<br />{document['dc:modified']} by {document['dc:lastContributor']}
    	    		</li>
    	    	)	
    			: ''}
    		</ul>
    		<p><strong>My Most Recently Modified:</strong></p>
    		<ul>
				{(dataResponse[docType].user_most_recently_modified) ? dataResponse[docType].user_most_recently_modified.map((document, i) => 
					<li key={document['ecm:uuid']}><a href={'/explore' + document['ecm:path']}>{document['dc:title']}</a> 
		    			<br />{document['dc:modified']} by {document['dc:lastContributor']}<commit_msg>Added visual guide to dashboard<commit_after>import React, {Component, PropTypes} from 'react';
import classNames from 'classnames';

import Doughnut from 'react-chartjs/lib/doughnut';
import CircularProgress from 'material-ui/lib/circular-progress';

export default class StatsPanel extends Component {

  constructor(props, context) {
    super(props, context);
  }

  _generateLifecycleStateDoughnutData(data, docType) {
    let doughnutData = [];
    doughnutData.push({ value: data[docType].new, color: "#949FB1", highlight: "#A8B3C5", label: "New" });      
    doughnutData.push({ value: data[docType].enabled, color: "#FDB45C", highlight: "#FFC870", label: "Enabled" });   
    doughnutData.push({ value: data[docType].published, color: "#46BFBD", highlight: "#5AD3D1", label: "Published" }),
    doughnutData.push({ value: data[docType].disabled, color:"#F7464A", highlight: "#FF5A5E", label: "Disabled" })   
    return doughnutData;
  }  

  _generateTwoSliceDoughnutData(total, subset, labels) {
	    let doughnutData = [];
	    let totalMinusSubset = total - subset;
	    doughnutData.push({ value: totalMinusSubset, color: "#46BFBD", highlight: "#5AD3D1", label: labels[0] }),
	    doughnutData.push({ value: subset, color:"#F7464A", highlight: "#FF5A5E", label: labels[1] })   
	    return doughnutData;
  }   
  
  render() {
    
	if (!this.props.data.success) {
		return ( 
			<div className={classNames('col-xs-12', 'col-md-6')}>
				<CircularProgress mode="indeterminate" size={3} />
			</div>
		);
	}
	
    let dataResponse = this.props.data.response;
    let docType = this.props.docType;	
	let lifecycleStateDoughnutData = this._generateLifecycleStateDoughnutData(dataResponse, docType);

    return (
		<div className={classNames('col-xs-12', 'col-md-6')}>
    		<h3>{this.props.headerText}: {dataResponse[docType].total}</h3>
    		{/*
    		<p><strong>Total:</strong> {dataResponse[docType].total}</p>
    		<p><strong>New:</strong> {dataResponse[docType].new}</p>
    		<p><strong>Enabled:</strong> {dataResponse[docType].enabled}</p>
    		<p><strong>Published:</strong> {dataResponse[docType].published}</p> 
    		<p><strong>Disabled:</strong> {dataResponse[docType].disabled}</p> 
    		*/}
    		<Doughnut data={lifecycleStateDoughnutData} />
    		
        	{lifecycleStateDoughnutData.map((slice, i) =>
  		  		<div key={slice.label}><span className={'glyphicon glyphicon-stop'} style={{color: slice.color}} /> {slice.label}: {slice.value}</div>
	    	)}	                                  	
    		
    		<p><strong>Created Today:</strong> {dataResponse[docType].created_today}</p>                         
    		<p><strong>Modified Today:</strong> {dataResponse[docType].modified_today}</p> 
    		<p><strong>Created Within Last 7 Days:</strong> {dataResponse[docType].created_within_7_days}</p>                         

    		<p><strong>Available In Childrens Archive:</strong> {dataResponse[docType].available_in_childrens_archive}</p>     		
    		
    		<p><strong>Most Recently Modified:</strong></p>
    		<ul>
    			{(dataResponse[docType].most_recently_modified) ? dataResponse[docType].most_recently_modified.map((document, i) => 
    				<li key={document['ecm:uuid']}><a href={'/explore' + document['ecm:path']}>{document['dc:title']}</a> 
    	    			<br />{document['dc:modified']} by {document['dc:lastContributor']}
    	    		</li>
    	    	)	
    			: ''}
    		</ul>
    		<p><strong>My Most Recently Modified:</strong></p>
    		<ul>
				{(dataResponse[docType].user_most_recently_modified) ? dataResponse[docType].user_most_recently_modified.map((document, i) => 
					<li key={document['ecm:uuid']}><a href={'/explore' + document['ecm:path']}>{document['dc:title']}</a> 
		    			<br />{document['dc:modified']} by {document['dc:lastContributor']}
{'fraction_non_alphanumeric': 0.1725414895076121, 'fraction_numerical': 0.012892607324098204, 'mean_word_length': 3.867823765020027, 'pattern_counts': {'":': 0, '<': 132, '<?xml version=': 0, '>': 137, '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': '139710', 'n_tokens_mistral': 2601, 'n_tokens_neox': 2464, 'n_words': 384}