From ef6318e2918257c6d49ccdfae5598f641dd83b24 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Sat, 8 Oct 2022 18:47:29 +1030 Subject: [PATCH] Add reset nodeDB command to palette --- pnpm-lock.yaml | 125 ++++++++++++------------ src/components/CommandPalette/Index.tsx | 11 +++ 2 files changed, 71 insertions(+), 65 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c7a2f37..324649fd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -107,7 +107,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/gen-mapping': 0.1.1 - '@jridgewell/trace-mapping': 0.3.15 + '@jridgewell/trace-mapping': 0.3.16 dev: true /@babel/code-frame/7.12.11: @@ -426,8 +426,8 @@ packages: - supports-color dev: true - /@eslint/eslintrc/1.3.2: - resolution: {integrity: sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==} + /@eslint/eslintrc/1.3.3: + resolution: {integrity: sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -499,10 +499,6 @@ packages: - supports-color dev: true - /@humanwhocodes/gitignore-to-minimatch/1.0.2: - resolution: {integrity: sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==} - dev: false - /@humanwhocodes/module-importer/1.0.1: resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} @@ -525,7 +521,7 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.14 - '@jridgewell/trace-mapping': 0.3.15 + '@jridgewell/trace-mapping': 0.3.16 dev: true /@jridgewell/resolve-uri/3.1.0: @@ -542,8 +538,8 @@ packages: resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} dev: true - /@jridgewell/trace-mapping/0.3.15: - resolution: {integrity: sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==} + /@jridgewell/trace-mapping/0.3.16: + resolution: {integrity: sha512-LCQ+NeThyJ4k1W2d+vIKdxuSt9R3pQSZ4P92m7EakaYuXcVWbHuT5bjNcqLd4Rdgi6xYWYDvBJZJLZSLanjDcA==} dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 @@ -604,15 +600,15 @@ packages: /@meshtastic/eslint-config/1.0.8: resolution: {integrity: sha512-Jzwaf3TyYFGeFuxLRQA5Yj5Rmz097VleFQUkswXH9nvLO81JjJbHgJWbHQ6RpxC31q/2hWV03QdaH98swpYcQA==} dependencies: - '@typescript-eslint/eslint-plugin': 5.39.0_xyciw6oqjoiiono4dhv3uhn5my - '@typescript-eslint/parser': 5.39.0_ypn2ylkkyfa5i233caldtndbqa - eslint: 8.24.0 - eslint-config-prettier: 8.5.0_eslint@8.24.0 - eslint-import-resolver-typescript: 2.7.1_dg2pe6kqkrddxbf2funb723kue - eslint-plugin-eslint-comments: 3.2.0_eslint@8.24.0 - eslint-plugin-import: 2.26.0_gcianqk2r5w7qn6wdun4jzyvom - eslint-plugin-react: 7.31.8_eslint@8.24.0 - eslint-plugin-react-hooks: 4.6.0_eslint@8.24.0 + '@typescript-eslint/eslint-plugin': 5.39.0_cfd7h3iktziq6hcwahu2qxhjhy + '@typescript-eslint/parser': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q + eslint: 8.25.0 + eslint-config-prettier: 8.5.0_eslint@8.25.0 + eslint-import-resolver-typescript: 2.7.1_fyln4uq2tv75svthy6prqvt6lm + eslint-plugin-eslint-comments: 3.2.0_eslint@8.25.0 + eslint-plugin-import: 2.26.0_o6xilsqumo6pzva4ttrd3yb4lm + eslint-plugin-react: 7.31.8_eslint@8.25.0 + eslint-plugin-react-hooks: 4.6.0_eslint@8.25.0 prettier: 2.7.1 prettier-plugin-tailwindcss: 0.1.13_prettier@2.7.1 typescript: 4.8.4 @@ -902,7 +898,7 @@ packages: resolution: {integrity: sha512-w7hEHXnPMEZ+4nGKl/KDRVpxkwYxYExuHOYXyzIzCDzEZ9ZCGMAewulr9IqJu2LR4N37fcnb1XVeuZ09qgOxhA==} dev: true - /@typescript-eslint/eslint-plugin/5.39.0_xyciw6oqjoiiono4dhv3uhn5my: + /@typescript-eslint/eslint-plugin/5.39.0_cfd7h3iktziq6hcwahu2qxhjhy: resolution: {integrity: sha512-xVfKOkBm5iWMNGKQ2fwX5GVgBuHmZBO1tCRwXmY5oAIsPscfwm2UADDuNB8ZVYCtpQvJK4xpjrK7jEhcJ0zY9A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -913,12 +909,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.39.0_ypn2ylkkyfa5i233caldtndbqa + '@typescript-eslint/parser': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q '@typescript-eslint/scope-manager': 5.39.0 - '@typescript-eslint/type-utils': 5.39.0_ypn2ylkkyfa5i233caldtndbqa - '@typescript-eslint/utils': 5.39.0_ypn2ylkkyfa5i233caldtndbqa + '@typescript-eslint/type-utils': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q + '@typescript-eslint/utils': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q debug: 4.3.4 - eslint: 8.24.0 + eslint: 8.25.0 ignore: 5.2.0 regexpp: 3.2.0 semver: 7.3.8 @@ -948,7 +944,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.39.0_ypn2ylkkyfa5i233caldtndbqa: + /@typescript-eslint/parser/5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q: resolution: {integrity: sha512-PhxLjrZnHShe431sBAGHaNe6BDdxAASDySgsBCGxcBecVCi8NQWxQZMcizNA4g0pN51bBAn/FUfkWG3SDVcGlA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -962,7 +958,7 @@ packages: '@typescript-eslint/types': 5.39.0 '@typescript-eslint/typescript-estree': 5.39.0_typescript@4.8.4 debug: 4.3.4 - eslint: 8.24.0 + eslint: 8.25.0 typescript: 4.8.4 transitivePeerDependencies: - supports-color @@ -975,7 +971,7 @@ packages: '@typescript-eslint/types': 5.39.0 '@typescript-eslint/visitor-keys': 5.39.0 - /@typescript-eslint/type-utils/5.39.0_ypn2ylkkyfa5i233caldtndbqa: + /@typescript-eslint/type-utils/5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q: resolution: {integrity: sha512-KJHJkOothljQWzR3t/GunL0TPKY+fGJtnpl+pX+sJ0YiKTz3q2Zr87SGTmFqsCMFrLt5E0+o+S6eQY0FAXj9uA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -986,9 +982,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.39.0_typescript@4.8.4 - '@typescript-eslint/utils': 5.39.0_ypn2ylkkyfa5i233caldtndbqa + '@typescript-eslint/utils': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q debug: 4.3.4 - eslint: 8.24.0 + eslint: 8.25.0 tsutils: 3.21.0_typescript@4.8.4 typescript: 4.8.4 transitivePeerDependencies: @@ -1019,7 +1015,7 @@ packages: transitivePeerDependencies: - supports-color - /@typescript-eslint/utils/5.39.0_ypn2ylkkyfa5i233caldtndbqa: + /@typescript-eslint/utils/5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q: resolution: {integrity: sha512-+DnY5jkpOpgj+EBtYPyHRjXampJfC0yUZZzfzLuUWVZvCuKqSdJVC8UhdWipIw7VKNTfwfAPiOWzYkAwuIhiAg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1029,9 +1025,9 @@ packages: '@typescript-eslint/scope-manager': 5.39.0 '@typescript-eslint/types': 5.39.0 '@typescript-eslint/typescript-estree': 5.39.0_typescript@4.8.4 - eslint: 8.24.0 + eslint: 8.25.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.24.0 + eslint-utils: 3.0.0_eslint@8.25.0 transitivePeerDependencies: - supports-color - typescript @@ -1207,7 +1203,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.21.4 - caniuse-lite: 1.0.30001416 + caniuse-lite: 1.0.30001418 fraction.js: 4.2.0 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -1255,8 +1251,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001416 - electron-to-chromium: 1.4.275 + caniuse-lite: 1.0.30001418 + electron-to-chromium: 1.4.276 node-releases: 2.0.6 update-browserslist-db: 1.0.10_browserslist@4.21.4 dev: true @@ -1286,8 +1282,8 @@ packages: resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} engines: {node: '>= 6'} - /caniuse-lite/1.0.30001416: - resolution: {integrity: sha512-06wzzdAkCPZO+Qm4e/eNghZBDfVNDsCgw33T27OwBH9unE9S478OYw//Q2L7Npf/zBzs7rjZOszIFQkwQKAEqA==} + /caniuse-lite/1.0.30001418: + resolution: {integrity: sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg==} dev: true /chalk/2.4.2: @@ -1556,8 +1552,8 @@ packages: resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==} dev: false - /electron-to-chromium/1.4.275: - resolution: {integrity: sha512-aJeQQ+Hl9Jyyzv4chBqYJwmVRY46N5i2BEX5Cuyk/5gFCUZ5F3i7Hnba6snZftWla7Gglwc5pIgcd+E7cW+rPg==} + /electron-to-chromium/1.4.276: + resolution: {integrity: sha512-EpuHPqu8YhonqLBXHoU6hDJCD98FCe6KDoet3/gY1qsQ6usjJoHqBH2YIVs8FXaAtHwVL8Uqa/fsYao/vq9VWQ==} dev: true /emoji-regex/8.0.0: @@ -1866,13 +1862,13 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - /eslint-config-prettier/8.5.0_eslint@8.24.0: + /eslint-config-prettier/8.5.0_eslint@8.25.0: resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.24.0 + eslint: 8.25.0 dev: false /eslint-import-resolver-node/0.3.6: @@ -1884,7 +1880,7 @@ packages: - supports-color dev: false - /eslint-import-resolver-typescript/2.7.1_dg2pe6kqkrddxbf2funb723kue: + /eslint-import-resolver-typescript/2.7.1_fyln4uq2tv75svthy6prqvt6lm: resolution: {integrity: sha512-00UbgGwV8bSgUv34igBDbTOtKhqoRMy9bFjNehT40bXg6585PNIct8HhXZ0SybqB9rWtXj9crcku8ndDn/gIqQ==} engines: {node: '>=4'} peerDependencies: @@ -1892,8 +1888,8 @@ packages: eslint-plugin-import: '*' dependencies: debug: 4.3.4 - eslint: 8.24.0 - eslint-plugin-import: 2.26.0_gcianqk2r5w7qn6wdun4jzyvom + eslint: 8.25.0 + eslint-plugin-import: 2.26.0_o6xilsqumo6pzva4ttrd3yb4lm glob: 7.2.3 is-glob: 4.0.3 resolve: 1.22.1 @@ -1902,7 +1898,7 @@ packages: - supports-color dev: false - /eslint-module-utils/2.7.4_u3o3cbxhjcofsya2eebinaptmi: + /eslint-module-utils/2.7.4_vyqn3eg3iq3tj3qtqgamu25emu: resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==} engines: {node: '>=4'} peerDependencies: @@ -1923,27 +1919,27 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.39.0_ypn2ylkkyfa5i233caldtndbqa + '@typescript-eslint/parser': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q debug: 3.2.7 - eslint: 8.24.0 + eslint: 8.25.0 eslint-import-resolver-node: 0.3.6 - eslint-import-resolver-typescript: 2.7.1_dg2pe6kqkrddxbf2funb723kue + eslint-import-resolver-typescript: 2.7.1_fyln4uq2tv75svthy6prqvt6lm transitivePeerDependencies: - supports-color dev: false - /eslint-plugin-eslint-comments/3.2.0_eslint@8.24.0: + /eslint-plugin-eslint-comments/3.2.0_eslint@8.25.0: resolution: {integrity: sha512-0jkOl0hfojIHHmEHgmNdqv4fmh7300NdpA9FFpF7zaoLvB/QeXOGNLIo86oAveJFrfB1p05kC8hpEMHM8DwWVQ==} engines: {node: '>=6.5.0'} peerDependencies: eslint: '>=4.19.1' dependencies: escape-string-regexp: 1.0.5 - eslint: 8.24.0 + eslint: 8.25.0 ignore: 5.2.0 dev: false - /eslint-plugin-import/2.26.0_gcianqk2r5w7qn6wdun4jzyvom: + /eslint-plugin-import/2.26.0_o6xilsqumo6pzva4ttrd3yb4lm: resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} engines: {node: '>=4'} peerDependencies: @@ -1953,14 +1949,14 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.39.0_ypn2ylkkyfa5i233caldtndbqa + '@typescript-eslint/parser': 5.39.0_z4bbprzjrhnsfa24uvmcbu7f5q array-includes: 3.1.5 array.prototype.flat: 1.3.0 debug: 2.6.9 doctrine: 2.1.0 - eslint: 8.24.0 + eslint: 8.25.0 eslint-import-resolver-node: 0.3.6 - eslint-module-utils: 2.7.4_u3o3cbxhjcofsya2eebinaptmi + eslint-module-utils: 2.7.4_vyqn3eg3iq3tj3qtqgamu25emu has: 1.0.3 is-core-module: 2.10.0 is-glob: 4.0.3 @@ -1974,16 +1970,16 @@ packages: - supports-color dev: false - /eslint-plugin-react-hooks/4.6.0_eslint@8.24.0: + /eslint-plugin-react-hooks/4.6.0_eslint@8.25.0: resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: - eslint: 8.24.0 + eslint: 8.25.0 dev: false - /eslint-plugin-react/7.31.8_eslint@8.24.0: + /eslint-plugin-react/7.31.8_eslint@8.25.0: resolution: {integrity: sha512-5lBTZmgQmARLLSYiwI71tiGVTLUuqXantZM6vlSY39OaDSV0M7+32K5DnLkmFrwTe+Ksz0ffuLUC91RUviVZfw==} engines: {node: '>=4'} peerDependencies: @@ -1992,7 +1988,7 @@ packages: array-includes: 3.1.5 array.prototype.flatmap: 1.3.0 doctrine: 2.1.0 - eslint: 8.24.0 + eslint: 8.25.0 estraverse: 5.3.0 jsx-ast-utils: 3.3.3 minimatch: 3.1.2 @@ -2028,13 +2024,13 @@ packages: eslint-visitor-keys: 1.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.24.0: + /eslint-utils/3.0.0_eslint@8.25.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.24.0 + eslint: 8.25.0 eslint-visitor-keys: 2.1.0 dev: false @@ -2100,14 +2096,13 @@ packages: - supports-color dev: true - /eslint/8.24.0: - resolution: {integrity: sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==} + /eslint/8.25.0: + resolution: {integrity: sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.3.2 + '@eslint/eslintrc': 1.3.3 '@humanwhocodes/config-array': 0.10.7 - '@humanwhocodes/gitignore-to-minimatch': 1.0.2 '@humanwhocodes/module-importer': 1.0.1 ajv: 6.12.6 chalk: 4.1.2 @@ -2116,7 +2111,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.24.0 + eslint-utils: 3.0.0_eslint@8.25.0 eslint-visitor-keys: 3.3.0 espree: 9.4.0 esquery: 1.4.0 diff --git a/src/components/CommandPalette/Index.tsx b/src/components/CommandPalette/Index.tsx index d93ade5b..0e003ec4 100644 --- a/src/components/CommandPalette/Index.tsx +++ b/src/components/CommandPalette/Index.tsx @@ -14,6 +14,8 @@ import type React from "react"; import { Fragment, useState } from "react"; +import { toast } from "react-hot-toast"; + import { useDevice } from "@app/core/providers/useDevice.js"; import { useAppStore } from "@app/core/stores/appStore.js"; import { Combobox, Dialog, Transition } from "@headlessui/react"; @@ -151,6 +153,15 @@ export const CommandPalette = (): JSX.Element => { { name: "Reset Peers", icon: TrashIcon, + action() { + if (connection) { + void toast.promise(connection.resetPeers(), { + loading: "Resetting...", + success: "Succesfully reset peers", + error: "No response received", + }); + } + }, }, { name: "Disconnect",