ManageIQ/manageiq-ui-classic

View on GitHub
app/javascript/components/data-tables/button-list/index.jsx

Summary

Maintainability
B
5 hrs
Test Coverage
import React from 'react';
import { tableData } from './helper';
import MiqDataTable from '../../miq-data-table';

const ButtonList = (props) => {
  const { headers, rows } = tableData(props);

  /** Function to execute the row's click event */
  const onSelect = (selectedRow) => {
    const selected = rows.find((row) => row.id === selectedRow.id);
    miqTreeActivateNode(selected.treeBox, selected.nodeKey);
  };

  return (
    <MiqDataTable
      headers={headers}
      rows={rows}
      onCellClick={(selectedRow) => onSelect(selectedRow)}
      mode="button-list"
    />
  );
};

export default ButtonList;