<commit_before>import React, {PropTypes} from 'react'
import classnames from 'classnames'
import _ from 'lodash'

import {fetchTimeSeriesAsync} from 'shared/actions/timeSeries'
import resultsToCSV from 'src/shared/parsing/resultsToCSV.js'
import download from 'src/external/download.js'

const getCSV = (query, errorThrown) => async () => {
  try {
    const {results} = await fetchTimeSeriesAsync({source: query.host, query})
    const {name, CSVString} = resultsToCSV(results)
    download(CSVString, `${name}.csv`, 'text/plain')
  } catch (error) {
    errorThrown(error)
    console.error(error)
  }
}

const VisHeader = ({views, view, onToggleView, name, query, errorThrown}) =>
  <div className="graph-heading">
    {views.length
      ? <div>
          <ul className="nav nav-tablist nav-tablist-sm"><commit_msg>Provide a more descriptive error text<commit_after>import React, {PropTypes} from 'react'
import classnames from 'classnames'
import _ from 'lodash'

import {fetchTimeSeriesAsync} from 'shared/actions/timeSeries'
import resultsToCSV from 'src/shared/parsing/resultsToCSV.js'
import download from 'src/external/download.js'

const getCSV = (query, errorThrown) => async () => {
  try {
    const {results} = await fetchTimeSeriesAsync({source: query.host, query})
    const {name, CSVString} = resultsToCSV(results)
    download(CSVString, `${name}.csv`, 'text/plain')
  } catch (error) {
    errorThrown(error, 'Unable to download .csv file')
    console.error(error)
  }
}

const VisHeader = ({views, view, onToggleView, name, query, errorThrown}) =>
  <div className="graph-heading">
    {views.length
      ? <div>
          <ul className="nav nav-tablist nav-tablist-sm">
{'fraction_non_alphanumeric': 0.1345926800472255, 'fraction_numerical': 0.0, 'mean_word_length': 4.53921568627451, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1205862', 'n_tokens_mistral': 542, 'n_tokens_neox': 541, 'n_words': 135}