/* * QQQ - Low-code Application Framework for Engineers. * Copyright (C) 2021-2022. Kingsrook, LLC * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States * contact@kingsrook.com * https://github.com/Kingsrook/ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ import {QRecord} from "@kingsrook/qqq-frontend-core/lib/model/QRecord"; import Box from "@mui/material/Box"; import Table from "@mui/material/Table"; import TableBody from "@mui/material/TableBody"; import TableContainer from "@mui/material/TableContainer"; import TableRow from "@mui/material/TableRow"; import React from "react"; import DataTableBodyCell from "qqq/components/widgets/tables/cells/DataTableBodyCell"; import DataTableHeadCell from "qqq/components/widgets/tables/cells/DataTableHeadCell"; import ValueUtils from "qqq/utils/qqq/ValueUtils"; interface Props { logs: QRecord[]; } ScriptLogsView.defaultProps = { logs: null, }; function ScriptLogsView({logs}: Props): JSX.Element { return ( Timestamp Run Time (ms) Had Error? Input Output Logs { logs?.map((logRecord: QRecord) => { let logs = ""; if (logRecord.values.get("scriptLogLine")) { for (let i = 0; i < logRecord.values.get("scriptLogLine").length; i++) { console.log(" += " + i); logs += (logRecord.values.get("scriptLogLine")[i].values.text + "\n"); } } return ( {ValueUtils.formatDateTime(logRecord.values.get("startTimestamp"))} {logRecord.values.get("runTimeMillis")?.toLocaleString()}
{ValueUtils.formatBoolean(logRecord.values.get("hadError"))}
{logRecord.values.get("input")} {logRecord.values.get("output")} {logRecord.values.get("error")} {logs}
); }) }
); } export default ScriptLogsView;