ManageIQ/manageiq-ui-classic

View on GitHub
app/javascript/components/data-tables/button-group-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 ButtonGroupList = (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-group-list"
    />
  );
};

export default ButtonGroupList;