Add fetch metadata buttons on peers page
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
"@heroicons/react": "^2.0.12",
|
"@heroicons/react": "^2.0.12",
|
||||||
"@hookform/resolvers": "^2.9.8",
|
"@hookform/resolvers": "^2.9.8",
|
||||||
"@meshtastic/eslint-config": "^1.0.8",
|
"@meshtastic/eslint-config": "^1.0.8",
|
||||||
"@meshtastic/meshtasticjs": "^0.6.104",
|
"@meshtastic/meshtasticjs": "^0.6.105",
|
||||||
"@tailwindcss/line-clamp": "^0.4.2",
|
"@tailwindcss/line-clamp": "^0.4.2",
|
||||||
"@tailwindcss/typography": "^0.5.7",
|
"@tailwindcss/typography": "^0.5.7",
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
|
|||||||
Generated
+4
-4
@@ -6,7 +6,7 @@ specifiers:
|
|||||||
'@heroicons/react': ^2.0.12
|
'@heroicons/react': ^2.0.12
|
||||||
'@hookform/resolvers': ^2.9.8
|
'@hookform/resolvers': ^2.9.8
|
||||||
'@meshtastic/eslint-config': ^1.0.8
|
'@meshtastic/eslint-config': ^1.0.8
|
||||||
'@meshtastic/meshtasticjs': ^0.6.104
|
'@meshtastic/meshtasticjs': ^0.6.105
|
||||||
'@tailwindcss/forms': ^0.5.3
|
'@tailwindcss/forms': ^0.5.3
|
||||||
'@tailwindcss/line-clamp': ^0.4.2
|
'@tailwindcss/line-clamp': ^0.4.2
|
||||||
'@tailwindcss/typography': ^0.5.7
|
'@tailwindcss/typography': ^0.5.7
|
||||||
@@ -56,7 +56,7 @@ dependencies:
|
|||||||
'@heroicons/react': 2.0.12_react@18.2.0
|
'@heroicons/react': 2.0.12_react@18.2.0
|
||||||
'@hookform/resolvers': 2.9.8_react-hook-form@7.37.0
|
'@hookform/resolvers': 2.9.8_react-hook-form@7.37.0
|
||||||
'@meshtastic/eslint-config': 1.0.8
|
'@meshtastic/eslint-config': 1.0.8
|
||||||
'@meshtastic/meshtasticjs': 0.6.104
|
'@meshtastic/meshtasticjs': 0.6.105
|
||||||
'@tailwindcss/line-clamp': 0.4.2_tailwindcss@3.1.8
|
'@tailwindcss/line-clamp': 0.4.2_tailwindcss@3.1.8
|
||||||
'@tailwindcss/typography': 0.5.7_tailwindcss@3.1.8
|
'@tailwindcss/typography': 0.5.7_tailwindcss@3.1.8
|
||||||
base64-js: 1.5.1
|
base64-js: 1.5.1
|
||||||
@@ -619,8 +619,8 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@meshtastic/meshtasticjs/0.6.104:
|
/@meshtastic/meshtasticjs/0.6.105:
|
||||||
resolution: {integrity: sha512-LFDbxbaKJeKXMeh1KdX1ALrd73CV9WSoZljL8W7egidT3iFu3nrDHfv4WwTJ93YOhZllPIojuL+MzlXwi0IiXA==}
|
resolution: {integrity: sha512-A9e3aNGA5XiKmOt3QhnKINT5s1sUcUta9C7VhfYdXThHbpaEZheQLFaITDDWU+NUcGRzE0J9eZBw6mZdbcw82Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@protobuf-ts/runtime': 2.8.1
|
'@protobuf-ts/runtime': 2.8.1
|
||||||
'@serialport/stream': 10.3.0
|
'@serialport/stream': 10.3.0
|
||||||
|
|||||||
+39
-2
@@ -1,16 +1,20 @@
|
|||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
|
||||||
|
import toast from "react-hot-toast";
|
||||||
import { base16 } from "rfc4648";
|
import { base16 } from "rfc4648";
|
||||||
|
|
||||||
import { IconButton } from "@app/components/IconButton.js";
|
import { IconButton } from "@app/components/IconButton.js";
|
||||||
import { Mono } from "@app/components/Mono.js";
|
import { Mono } from "@app/components/Mono.js";
|
||||||
import { useDevice } from "@core/providers/useDevice.js";
|
import { useDevice } from "@core/providers/useDevice.js";
|
||||||
import { Hashicon } from "@emeraldpay/hashicon-react";
|
import { Hashicon } from "@emeraldpay/hashicon-react";
|
||||||
import { EllipsisHorizontalIcon } from "@heroicons/react/24/outline";
|
import {
|
||||||
|
ArrowPathRoundedSquareIcon,
|
||||||
|
EllipsisHorizontalIcon,
|
||||||
|
} from "@heroicons/react/24/outline";
|
||||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||||
|
|
||||||
export const PeersPage = (): JSX.Element => {
|
export const PeersPage = (): JSX.Element => {
|
||||||
const { hardware, nodes } = useDevice();
|
const { connection, nodes } = useDevice();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-y-auto">
|
<div className="w-full overflow-y-auto">
|
||||||
@@ -36,6 +40,12 @@ export const PeersPage = (): JSX.Element => {
|
|||||||
>
|
>
|
||||||
MAC Address
|
MAC Address
|
||||||
</th>
|
</th>
|
||||||
|
<th
|
||||||
|
scope="col"
|
||||||
|
className="py-3.5 text-left text-sm font-semibold text-gray-900"
|
||||||
|
>
|
||||||
|
Versions
|
||||||
|
</th>
|
||||||
<th
|
<th
|
||||||
scope="col"
|
scope="col"
|
||||||
className="py-3.5 text-left text-sm font-semibold text-gray-900"
|
className="py-3.5 text-left text-sm font-semibold text-gray-900"
|
||||||
@@ -78,6 +88,33 @@ export const PeersPage = (): JSX.Element => {
|
|||||||
?.join(":") ?? ""}
|
?.join(":") ?? ""}
|
||||||
</Mono>
|
</Mono>
|
||||||
</td>
|
</td>
|
||||||
|
<td className="whitespace-nowrap py-2 text-sm text-gray-500">
|
||||||
|
{node.metadata ? (
|
||||||
|
<>
|
||||||
|
<Mono>{node.metadata.firmwareVersion}</Mono>
|
||||||
|
<span className="text-black">/</span>
|
||||||
|
<Mono>{node.metadata.deviceStateVersion}</Mono>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
size="sm"
|
||||||
|
variant="secondary"
|
||||||
|
onClick={() => {
|
||||||
|
if (connection) {
|
||||||
|
void toast.promise(
|
||||||
|
connection.getMetadata(node.data.num),
|
||||||
|
{
|
||||||
|
loading: "Requesting Metadata...",
|
||||||
|
success: "Recieved Metadata",
|
||||||
|
error: "No response received",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
icon={<ArrowPathRoundedSquareIcon className="h-4" />}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
<td className="whitespace-nowrap py-2 text-sm text-gray-500">
|
<td className="whitespace-nowrap py-2 text-sm text-gray-500">
|
||||||
{new Date(node.data.lastHeard).toLocaleTimeString()}
|
{new Date(node.data.lastHeard).toLocaleTimeString()}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user