mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-17 16:24:18 +01:00
add button to reboot device
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -9,7 +9,7 @@
|
||||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@liamcottle/meshcore.js": "^1.0.5",
|
||||
"@liamcottle/meshcore.js": "^1.0.6",
|
||||
"@tailwindcss/forms": "^0.5.10",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"../meshcore.js": {
|
||||
"name": "@liamcottle/meshcore.js",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.6",
|
||||
"extraneous": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@@ -1122,9 +1122,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@liamcottle/meshcore.js": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.5.tgz",
|
||||
"integrity": "sha512-XXQP57T9FM625KrXvLTv+kP9vyWpsxVe5miNA+CTAfdn6gQTe7yGIlfIgN9fr2jznRVHiVE3CQRt3urw7ZRbEA=="
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.6.tgz",
|
||||
"integrity": "sha512-xdebsV1qWG+gXVVB2GBwoJi17dZgBcXmfWPzAGpmUMBEQAvbIs0DAc66zue+X3cHv7+29zKATa9JWMNOC/VEjg=="
|
||||
},
|
||||
"node_modules/@mongodb-js/saslprep": {
|
||||
"version": "1.2.0",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"author": "Liam Cottle <liam@liamcottle.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@liamcottle/meshcore.js": "^1.0.5",
|
||||
"@liamcottle/meshcore.js": "^1.0.6",
|
||||
"@tailwindcss/forms": "^0.5.10",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<!-- setting groups -->
|
||||
<div class="space-y-4">
|
||||
|
||||
<!-- public info -->
|
||||
<div class="bg-white divide-y">
|
||||
|
||||
<div class="bg-white p-2 font-semibold">Public Info</div>
|
||||
@@ -52,6 +53,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- radio settings -->
|
||||
<div class="bg-white divide-y">
|
||||
|
||||
<div class="bg-white p-2 font-semibold">Radio Settings</div>
|
||||
@@ -106,6 +108,34 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- commands -->
|
||||
<div class="flex flex-col divide-y bg-white">
|
||||
|
||||
<div class="bg-white p-2 font-semibold">Commands</div>
|
||||
|
||||
<div @click="reboot" class="flex cursor-pointer px-2 py-3 bg-white hover:bg-gray-50">
|
||||
|
||||
<!-- leading -->
|
||||
<div class="my-auto ml-2 mr-4 text-gray-500">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M5.636 5.636a9 9 0 1 0 12.728 0M12 3v9" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<!-- title -->
|
||||
<div class="my-auto mr-auto">Reboot</div>
|
||||
|
||||
<!-- trailing -->
|
||||
<div class="my-auto mr-2 text-gray-500">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -237,11 +267,6 @@ export default {
|
||||
// show success alert
|
||||
alert("Settings saved.");
|
||||
|
||||
// go back to main page
|
||||
this.$router.push({
|
||||
name: "main",
|
||||
});
|
||||
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
alert("Failed to save settings!");
|
||||
@@ -252,6 +277,31 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
async reboot() {
|
||||
|
||||
// ask user to confirm action
|
||||
if(!confirm("Are you sure you want to reboot this device?")){
|
||||
return;
|
||||
}
|
||||
|
||||
// tell radio to reboot
|
||||
try {
|
||||
await Connection.reboot();
|
||||
} catch(e) {
|
||||
alert("Failed to reboot device!");
|
||||
console.log(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// tell user device is rebooting
|
||||
alert("Device is rebooting. You will need to reconnect!");
|
||||
|
||||
// go back to main page
|
||||
this.$router.push({
|
||||
name: "main",
|
||||
});
|
||||
|
||||
},
|
||||
bytesToHex(uint8Array) {
|
||||
return Utils.bytesToHex(uint8Array);
|
||||
|
||||
@@ -266,6 +266,10 @@ class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
static async reboot() {
|
||||
await GlobalState.connection.reboot();
|
||||
}
|
||||
|
||||
static async onContactMessageReceived(message) {
|
||||
|
||||
console.log("onContactMessageReceived", message);
|
||||
|
||||
Reference in New Issue
Block a user