From f92c040f637d2c4b062ae35d262d49c7fa018d85 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 13:48:03 +0100 Subject: [PATCH] Fix itny bugs --- app/Console/Commands/SpeedtestCommand.php | 7 ++--- public/js/app.js | 28 ++++++++++++++------ resources/js/components/Graphics/TableRow.js | 23 +++++++++++----- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/app/Console/Commands/SpeedtestCommand.php b/app/Console/Commands/SpeedtestCommand.php index 11f06553..547165e3 100644 --- a/app/Console/Commands/SpeedtestCommand.php +++ b/app/Console/Commands/SpeedtestCommand.php @@ -2,6 +2,7 @@ namespace App\Console\Commands; +use App\Exceptions\SpeedtestFailureException; use App\Helpers\SpeedtestHelper; use App\Interfaces\SpeedtestProvider; use Illuminate\Console\Command; @@ -45,9 +46,9 @@ class SpeedtestCommand extends Command { $this->info('Running speedtest, this might take a while...'); - $results = $this->speedtestProvider->run(false, false); - - if (!is_object($results)) { + try { + $results = $this->speedtestProvider->run(false, false); + } catch (SpeedtestFailureException $e) { $this->error('Something went wrong running the speedtest.'); exit(); } diff --git a/public/js/app.js b/public/js/app.js index 00986d83..24d6b2cc 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -146804,18 +146804,30 @@ var TableRow = /*#__PURE__*/function (_Component) { } }, "Delete")))) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null)); } else { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("tr", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, e.id), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, new Date(e.created_at).toLocaleString()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { - className: "ti-close text-danger" - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { - className: "ti-close text-danger" - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { - className: "ti-close text-danger" - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_bootstrap__WEBPACK_IMPORTED_MODULE_2__["Button"], { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("tr", null, fields.visible.map(function (e, i) { + console.log(e); + + if (e.name === 'created_at') { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", { + key: i + }, new Date(e.value).toLocaleString()); + } else if (e.name === 'id') { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", { + key: i + }, e.value); + } + + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", { + key: i + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { + className: "ti-close text-danger" + })); + }), window.config.auth && window.authenticated || !window.config.auth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_bootstrap__WEBPACK_IMPORTED_MODULE_2__["Button"], { variant: "danger", onClick: function onClick() { _this2["delete"](e.id); } - }, "Delete"))); + }, "Delete")) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("td", null)); } } }]); diff --git a/resources/js/components/Graphics/TableRow.js b/resources/js/components/Graphics/TableRow.js index 4e1f9d44..1deee089 100644 --- a/resources/js/components/Graphics/TableRow.js +++ b/resources/js/components/Graphics/TableRow.js @@ -134,12 +134,23 @@ export default class TableRow extends Component { } else { return ( - {e.id} - {new Date(e.created_at).toLocaleString()} - - - - + {fields.visible.map((e, i) => { + console.log(e); + if(e.name === 'created_at') { + return {new Date(e.value).toLocaleString()} + } else if (e.name === 'id') { + return {e.value} + } + + return ( + + ); + })} + {(window.config.auth && window.authenticated) || !window.config.auth ? + + : + + } ); }