// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { useState } from 'react'; import { I18n, Logger } from '@aws-amplify/core'; import { API } from '@aws-amplify/api' import { ISimulation } from '../Shared/Interfaces'; import DeleteConfirm from '../Shared/DeleteConfirmation'; import { API_NAME } from '../../util/Utils'; import { Link } from 'react-router-dom'; import Button from 'react-bootstrap/Button'; import Form from 'react-bootstrap/Form'; import Modal from 'react-bootstrap/Modal'; import Table from 'react-bootstrap/Table'; interface IProps { simulations: ISimulation[], handleCheckboxSelect: Function, setSimulations: Function } export default function TableData(props: IProps): JSX.Element { const logger = new Logger("Simulation Table Data"); const [showDevices, setShowDevices] = useState(-1); const [showDeleteModal, setShowDeleteModal] = useState(false); /** * deletes the given simulation from ddb and reloads the page * @param simId */ const handleDelete = async (simId: string, index: number) => { try { await API.del(API_NAME, `/simulation/${simId}`, {}); props.simulations.splice(index, 1); props.setSimulations([...props.simulations]); } catch (err) { logger.error(I18n.get("simulation.delete.error"), err); throw err; } } return ( { props.simulations.map((sim, i) => ( { props.handleCheckboxSelect(event, i) }} > {sim.name} {sim.stage}   { setShowDevices(-1) }}> {sim.name} {sim.devices.map((device, j) => ( ))}
{I18n.get("device.types")} {I18n.get("amount")}
{device.name} {device.amount}
{sim.runs} {sim.lastRun ? sim.lastRun : ""} )) } ) }