All files / components/Jobs JobsTable.jsx

100% Statements 40/40
100% Branches 3/3
100% Functions 3/3
100% Lines 40/40

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 471x 1x 1x   1x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x   12x     12x 12x   12x   12x 12x  
import React from "react";
import OurTable from "main/components/OurTable";
import { formatTime } from "main/utils/dateUtils";
 
export default function JobsTable({ jobs }) {
  const columns = [
    {
      header: "id",
      accessorKey: "id",
    },
    {
      header: "Job Name",
      accessorKey: "jobName",
    },
    {
      header: "Created",
      accessorFn: (row) => formatTime(row.createdAt),
      id: "createdAt",
    },
    {
      header: "Updated",
      accessorFn: (row) => formatTime(row.updatedAt),
      id: "updatedAt",
    },
    {
      header: "Status",
      accessorKey: "status",
    },
    {
      header: "Log",
      accessorKey: "log",
      cell: ({ cell }) => (
        <div
          style={{ maxWidth: 450, maxHeight: 100, overflowY: "auto" }}
          data-testid={`JobsTable-cell-row-${cell.row.index}-col-${cell.column.id}-div`}
        >
          <pre style={{ whiteSpace: "pre-wrap" }}>{cell.getValue()}</pre>
        </div>
      ),
    },
  ];
 
  const testid = "JobsTable";
 
  return <OurTable data={jobs} columns={columns} testid={testid} />;
}