<commit_before>import React from 'react'

import TableFilterMixin from '../general_components/table/sortable_table/table_filter_mixin'
import TableSortingMixin from '../general_components/table/sortable_table/table_sorting_mixin'
import Pagination from '../lesson_planner/create_unit/activity_search/pagination/pagination'
import ExportCsv from './export_csv'
import LoadingIndicator from '../shared/loading_indicator'
import SortableTable from '../general_components/table/sortable_table/sortable_table.jsx'
import FaqLink from './faq_link.jsx'
import ProgressReportFilters from './progress_report_filters.jsx'
import $ from 'jquery'

export default  React.createClass({
  mixins: [
    TableFilterMixin, TableSortingMixin
  ],

  propTypes: {
    columnDefinitions: React.PropTypes.func.isRequired,
    filterTypes: React.PropTypes.array.isRequired,
    pagination: React.PropTypes.bool.isRequired,
    sourceUrl: React.PropTypes.string.isRequired,
    sortDefinitions: React.PropTypes.func.isRequired,
    jsonResultsKey: React.PropTypes.string.isRequired,
    onFetchSuccess: React.PropTypes.func, // Optional
    exportCsv: React.PropTypes.string,
    premiumStatus: React.PropTypes.string.isRequired,
    colorByScoreKeys: React.PropTypes.array
  },

  getDefaultProps: function() {
    return {maxPageNumber: 4};
  },

  getInitialState: function() {
    return {
      currentPage: 1,
      numPages: 1,
      disabled: this.disabled(),
      loading: false,
      results: [],
      classroomFilters: [],
      studentFilters: [],
      unitFilters: [],
      teacher: {},

      selectedClassroom: {
        name: 'All Classrooms',
        value: ''
      },
      selectedStudent: {
        name: 'All Students',
        value: ''
      },
      selectedUnit: {
        name: 'All Units',
        value: ''
      }
    };
  },

  disabled: function(){
    return this.props.premiumStatus === ('none' || 'locked');
  },

  disableLinks: function() {
    if (!$('.progress-reports-standards-classrooms').length)
      $(".premium-status-none a").click(function(e) {
        e.preventDefault();
    });
  },

  componentDidMount: function() {
    var sortDefinitions = this.props.sortDefinitions();
    this.defineSorting(sortDefinitions.config, sortDefinitions.default);
    this.fetchData();
    var that = this;
    if (this.state.disabled) {
      setTimeout(function() {
        that.disableLinks();
      }, 750);
    }
  },

  // Get results with all filters, sorting
  getFilteredResults: function() {
    var allResults = this.state.results;
    return this.applySorting(allResults);
  },

  // Get results after pagination has been applied.
  getVisibleResults: function(filteredResults) {
    return filteredResults;
  },

  goToPage: function(page) {
    var newState = {
      currentPage: page
    };
    this.setState(newState, this.fetchData);
  },

  resetPagination: function(next) {
    this.setState({<commit_msg>blurred links on concepts page for non-premium users are now clickable<commit_after>import React from 'react'

import TableFilterMixin from '../general_components/table/sortable_table/table_filter_mixin'
import TableSortingMixin from '../general_components/table/sortable_table/table_sorting_mixin'
import Pagination from '../lesson_planner/create_unit/activity_search/pagination/pagination'
import ExportCsv from './export_csv'
import LoadingIndicator from '../shared/loading_indicator'
import SortableTable from '../general_components/table/sortable_table/sortable_table.jsx'
import FaqLink from './faq_link.jsx'
import ProgressReportFilters from './progress_report_filters.jsx'
import $ from 'jquery'

export default  React.createClass({
  mixins: [
    TableFilterMixin, TableSortingMixin
  ],

  propTypes: {
    columnDefinitions: React.PropTypes.func.isRequired,
    filterTypes: React.PropTypes.array.isRequired,
    pagination: React.PropTypes.bool.isRequired,
    sourceUrl: React.PropTypes.string.isRequired,
    sortDefinitions: React.PropTypes.func.isRequired,
    jsonResultsKey: React.PropTypes.string.isRequired,
    onFetchSuccess: React.PropTypes.func, // Optional
    exportCsv: React.PropTypes.string,
    premiumStatus: React.PropTypes.string.isRequired,
    colorByScoreKeys: React.PropTypes.array
  },

  getDefaultProps: function() {
    return {maxPageNumber: 4};
  },

  getInitialState: function() {
    return {
      currentPage: 1,
      numPages: 1,
      disabled: this.disabled(),
      loading: false,
      results: [],
      classroomFilters: [],
      studentFilters: [],
      unitFilters: [],
      teacher: {},

      selectedClassroom: {
        name: 'All Classrooms',
        value: ''
      },
      selectedStudent: {
        name: 'All Students',
        value: ''
      },
      selectedUnit: {
        name: 'All Units',
        value: ''
      }
    };
  },

  disabled: function(){
    return this.props.premiumStatus === ('none' || 'locked');
  },

  componentDidMount: function() {
    var sortDefinitions = this.props.sortDefinitions();
    this.defineSorting(sortDefinitions.config, sortDefinitions.default);
    this.fetchData();
  },

  // Get results with all filters, sorting
  getFilteredResults: function() {
    var allResults = this.state.results;
    return this.applySorting(allResults);
  },

  // Get results after pagination has been applied.
  getVisibleResults: function(filteredResults) {
    return filteredResults;
  },

  goToPage: function(page) {
    var newState = {
      currentPage: page
    };
    this.setState(newState, this.fetchData);
  },

  resetPagination: function(next) {
    this.setState({
{'fraction_non_alphanumeric': 0.11670521259562355, 'fraction_numerical': 0.0016011385874399574, 'mean_word_length': 3.41287284144427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5109771', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1644, 'n_words': 328}