<commit_before>// @flow

import React from 'react'
import {SourceModel} from '../model/source'
import {AdminModel} from '../model/admin'
import {Link} from 'react-router'
import {sortBy} from 'lodash'

export class Sources extends React.Component {

  static load() {
    return {sources: SourceModel.findAll(), version: AdminModel.version()}
  }

  constructor(props) {
    super(props)
  }

  render() {
    var sources = this.props.sources || []

    var sorted = sortBy(sources, s => s.sourceDisabled)

    function renderRow(source) {
      var lastScan = source.lastScan || {}
      return <tr key={source.id}>
        <td style={{padding: 3, textAlign: 'center'}}><img src={source.imageUrl} style={{height: 35}}/></td>
        <td><Link to="source" params={{id: source.id}}>{source.name}</Link></td>
        <td><a href={source.url}>{source.url}</a></td>
        <td>{!source.disabled ? 'Active' : 'Disabled'}</td>
        <td>{lastScan.total}</td>
      </tr>
    }

    return <div>
      <h3>Sources</h3>
      <a className="button" href="#/admin/sources/new">Add Source</a>
      <table>
        <tr>
          <th>Image</th>
          <th>Name</th>
          <th>URL</th>
          <th>Active</th>
          <th>Chapters</th>
        </tr>
        {sorted.map(renderRow)}
      </table>

      <div>
        <pre style={{fontSize: 'smaller'}}>
          <li>Version: {this.props.version}</li>
          <li><a href="#/admin/import-log/500">Import Log</a></li>
        </pre>
      </div>
    </div>
  }
}
<commit_msg>easier to see current version<commit_after>// @flow

import React from 'react'
import {SourceModel} from '../model/source'
import {AdminModel} from '../model/admin'
import {Link} from 'react-router'
import {sortBy} from 'lodash'

export class Sources extends React.Component {

  static load() {
    return {sources: SourceModel.findAll(), version: AdminModel.version()}
  }

  constructor(props) {
    super(props)
  }

  render() {
    var sources = this.props.sources || []

    var sorted = sortBy(sources, s => s.sourceDisabled)

    function renderRow(source) {
      var lastScan = source.lastScan || {}
      return <tr key={source.id}>
        <td style={{padding: 3, textAlign: 'center'}}><img src={source.imageUrl} style={{height: 35}}/></td>
        <td><Link to="source" params={{id: source.id}}>{source.name}</Link></td>
        <td><a href={source.url}>{source.url}</a></td>
        <td>{!source.disabled ? 'Active' : 'Disabled'}</td>
        <td>{lastScan.total}</td>
      </tr>
    }

    return <div>
      <h3>Sources</h3>
      <a className="button" href="#/admin/sources/new">Add Source</a>
      <table>
        <tr>
          <th>Image</th>
          <th>Name</th>
          <th>URL</th>
          <th>Active</th>
          <th>Chapters</th>
        </tr>
        {sorted.map(renderRow)}
      </table>

      <div>
        <ul>
          <li><a href="#/admin/import-log/500">Import Log</a></li>
          <li>Version: <code style={{fontSize: 'smaller'}}>{this.props.version}</code></li>
        </ul>
      </div>
    </div>
  }
}

{'fraction_non_alphanumeric': 0.19351701782820097, 'fraction_numerical': 0.005186385737439222, 'mean_word_length': 2.4988662131519273, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 101, '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': '5076695', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1029, 'n_words': 206}