All files / src/pages/playbooks PlaybookExecutions.tsx

0% Statements 0/16
0% Branches 0/6
0% Functions 0/1
0% Lines 0/16

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                                                                                     
import Search from "../../components/common/Search";
import Heading from "../../components/Heading";
import PaginatedTable from "../../components/PaginatedTable";
import ExecutionsTable from "../../components/Playbooks/executions/ExecutionsTable";
import SuspenseLoader from "../../components/Skeleton/SuspenseLoader";
import TableSkeleton from "../../components/Skeleton/TableLoader";
import usePaginationComponent from "../../hooks/common/usePaginationComponent";
import useSearch from "../../hooks/common/useSearch";
 
const context = "PLAYBOOK_EXECUTION";
 
const PlaybookExecutions = () => {
  const { data, isFetching, refetch } = useSearch(context);
  usePaginationComponent(refetch);
 
  const playbooksList = data?.[context.toLowerCase()] ?? [];
  const total = data?.meta?.total_count;
 
  return (
    <div>
      <Heading heading={"Playbook Executions"} />
 
      <main className="flex flex-col gap-4 p-2 pt-4">
        <Search context={context} />
        <SuspenseLoader loading={isFetching} loader={<TableSkeleton />}>
          <PaginatedTable
            renderTable={ExecutionsTable}
            data={playbooksList ?? []}
            total={total}
            tableContainerStyles={
              playbooksList?.length
                ? {}
                : { maxHeight: "35vh", minHeight: "35vh" }
            }
          />
        </SuspenseLoader>
      </main>
    </div>
  );
};
 
export default PlaybookExecutions;