<commit_before>import React from "react";
import PropTypes from "prop-types";
import { AgGridReact } from "ag-grid-react";
import "ag-grid/dist/styles/ag-grid.css";
import "ag-grid/dist/styles/ag-theme-balham.css";

import LoadingOverlay from "../../../../modules/agGrid/LoadingOverlay";

const localeText = window.PAGE.i18n.agGrid;

class SampleCellRenderer {
  constructor(props) {
    this.props = props;
  }
}

const formatColumns = cols =>
  cols.map((f, i) => {
    const column = {
      field: f.label,
      headerName: f.label.toUpperCase()
    };

    // Special handling for the sample name
    if (i === 0) {
      column.pinned = "left";
      column.lockPosition = true;
      column.cellRenderer = params =>
        `<a href="${window.TL.BASE_URL}/samples/${Number(
          params.data.sampleId
        )}">${params.value}</a>`;
    }

    return column;
  });

const formatRows = rows => {
  if (rows !== null) {
    return rows.map(r => {
      const row = {};
      Object.keys(r).forEach(item => {<commit_msg>Sort by the sample name<commit_after>import React from "react";
import PropTypes from "prop-types";
import { AgGridReact } from "ag-grid-react";
import "ag-grid/dist/styles/ag-grid.css";
import "ag-grid/dist/styles/ag-theme-balham.css";

import LoadingOverlay from "../../../../modules/agGrid/LoadingOverlay";

const localeText = window.PAGE.i18n.agGrid;

class SampleCellRenderer {
  constructor(props) {
    this.props = props;
  }
}

const formatColumns = cols =>
  cols.map((f, i) => {
    const column = {
      field: f.label,
      headerName: f.label.toUpperCase()
    };

    // Special handling for the sample name
    if (i === 0) {
      column.sort = "asc";
      column.pinned = "left";
      column.lockPosition = true;
      column.cellRenderer = params =>
        `<a href="${window.TL.BASE_URL}/samples/${Number(
          params.data.sampleId
        )}">${params.value}</a>`;
    }

    return column;
  });

const formatRows = rows => {
  if (rows !== null) {
    return rows.map(r => {
      const row = {};
      Object.keys(r).forEach(item => {
{'fraction_non_alphanumeric': 0.16531681753215818, 'fraction_numerical': 0.0028585040495474035, 'mean_word_length': 2.7037037037037037, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '3438161', 'n_tokens_mistral': 688, 'n_tokens_neox': 683, 'n_words': 148}