Path: blob/main/web/ui/src/features/component/ComponentList.tsx
5304 views
import React from 'react';1import { NavLink } from 'react-router-dom';23import { HealthLabel } from '../component/HealthLabel';4import { ComponentInfo } from '../component/types';56import Table from './Table';78import styles from './ComponentList.module.css';910interface ComponentListProps {11components: ComponentInfo[];12parent?: string;13}1415const TABLEHEADERS = ['Health', 'ID'];1617const ComponentList = ({ components }: ComponentListProps) => {18const tableStyles = { width: '100px' };1920/**21* Custom renderer for table data22*/23const renderTableData = () => {24return components.map(({ health, id }) => (25<tr key={id} style={{ lineHeight: '2' }}>26<td>27<HealthLabel health={health.state} />28</td>29<td>30<span>{id}</span>31<NavLink to={'/component/' + id} className={styles.viewButton}>32View33</NavLink>34</td>35</tr>36));37};3839return (40<div className={styles.list}>41<Table tableHeaders={TABLEHEADERS} renderTableData={renderTableData} style={tableStyles} />42</div>43);44};4546export default ComponentList;474849