<commit_before>import { useEffect, useMemo } from "react";
import { DefeatableLink } from "lib/components/defeatable_link";
import { policy } from "policy";
import { Form, Pagination } from "lib/components/searchComponents";
import Item from "./item";
import { scope } from "ajax_helper";

export default ({
  active,
  volumes,
  fetchVolumes,
  listenToVolumes,
  loadVolumesOnce,
  reloadVolume,
  deleteVolume,
  forceDeleteVolume,
  detachVolume
}) => {
  // Body
  useEffect(() => listenToVolumes(), []);
  useEffect(() => {
    if (active) loadVolumesOnce();
  }, [active]);

  const canCreate = useMemo(
    () =>
      policy.isAllowed("block_storage:volume_create", {
        target: { scoped_domain_name: scope.domain }
      }),
    [scope.domain]
  );

  const handlePaginateClick = page => {
    if (page === "all") {
      fetchVolumes({
        searchType: volumes.searchType,
        searchTerm: volumes.searchTerm,
        limit: 9999
      });
    } else {
      fetchVolumes({
        searchType: volumes.searchType,
        searchTerm: volumes.searchTerm,
        page
      });
    }
  };

  return (
    <React.Fragment>
      {(volumes.items.length > 5 || canCreate) && (
        <div className="toolbar toolbar-controlcenter">
          <Form
            isLoading={volumes.isFetching}
            searchFor={["name", "id", "status"]}
            onSubmit={(searchType, searchTerm) =>
              fetchVolumes({ searchType, searchTerm })
            }
            helpText="Search by name, ID or status will find exact or partial matches. ID and status have to be exact matches to be found."
          />
          {canCreate && (
            <div className="main-buttons">
              <DefeatableLink to="/volumes/new" className="btn btn-primary">
                Create New
              </DefeatableLink>
            </div>
          )}
        </div>
      )}

      <table className="table volumes">
        <thead>
          <tr>
            <th>Volume Name</th>
            <th>Availability Zone</th>
            <th>Description</th>
            <th>Size(GB)</th>
            <th>Attached to</th>
            <th>Status</th>
            <th className="snug"></th>
          </tr>
        </thead>

        <tbody>
          {volumes.items && volumes.items.length > 0 ? (
            volumes.items.map((volume, index) => (
              <Item<commit_msg>revert deleted td tag<commit_after>import { useEffect, useMemo } from "react";
import { DefeatableLink } from "lib/components/defeatable_link";
import { policy } from "policy";
import { Form, Pagination } from "lib/components/searchComponents";
import Item from "./item";
import { scope } from "ajax_helper";

export default ({
  active,
  volumes,
  fetchVolumes,
  listenToVolumes,
  loadVolumesOnce,
  reloadVolume,
  deleteVolume,
  forceDeleteVolume,
  detachVolume
}) => {
  // Body
  useEffect(() => listenToVolumes(), []);
  useEffect(() => {
    if (active) loadVolumesOnce();
  }, [active]);

  const canCreate = useMemo(
    () =>
      policy.isAllowed("block_storage:volume_create", {
        target: { scoped_domain_name: scope.domain }
      }),
    [scope.domain]
  );

  const handlePaginateClick = page => {
    if (page === "all") {
      fetchVolumes({
        searchType: volumes.searchType,
        searchTerm: volumes.searchTerm,
        limit: 9999
      });
    } else {
      fetchVolumes({
        searchType: volumes.searchType,
        searchTerm: volumes.searchTerm,
        page
      });
    }
  };

  return (
    <React.Fragment>
      {(volumes.items.length > 5 || canCreate) && (
        <div className="toolbar toolbar-controlcenter">
          <Form
            isLoading={volumes.isFetching}
            searchFor={["name", "id", "status"]}
            onSubmit={(searchType, searchTerm) =>
              fetchVolumes({ searchType, searchTerm })
            }
            helpText="Search by name, ID or status will find exact or partial matches. ID and status have to be exact matches to be found."
          />
          {canCreate && (
            <div className="main-buttons">
              <DefeatableLink to="/volumes/new" className="btn btn-primary">
                Create New
              </DefeatableLink>
            </div>
          )}
        </div>
      )}

      <table className="table volumes">
        <thead>
          <tr>
            <th></th>
            <th>Volume Name</th>
            <th>Availability Zone</th>
            <th>Description</th>
            <th>Size(GB)</th>
            <th>Attached to</th>
            <th>Status</th>
            <th className="snug"></th>
          </tr>
        </thead>

        <tbody>
          {volumes.items && volumes.items.length > 0 ? (
            volumes.items.map((volume, index) => (
              <Item
{'fraction_non_alphanumeric': 0.134567387687188, 'fraction_numerical': 0.0024958402662229617, 'mean_word_length': 1.9943960149439601, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 79, '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': '5629577', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1385, 'n_words': 305}