mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-18 00:24:21 +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",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@liamcottle/meshcore.js": "^1.0.5",
|
"@liamcottle/meshcore.js": "^1.0.6",
|
||||||
"@tailwindcss/forms": "^0.5.10",
|
"@tailwindcss/forms": "^0.5.10",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
"../meshcore.js": {
|
"../meshcore.js": {
|
||||||
"name": "@liamcottle/meshcore.js",
|
"name": "@liamcottle/meshcore.js",
|
||||||
"version": "1.0.4",
|
"version": "1.0.6",
|
||||||
"extraneous": true,
|
"extraneous": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
@@ -1122,9 +1122,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@liamcottle/meshcore.js": {
|
"node_modules/@liamcottle/meshcore.js": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.6.tgz",
|
||||||
"integrity": "sha512-XXQP57T9FM625KrXvLTv+kP9vyWpsxVe5miNA+CTAfdn6gQTe7yGIlfIgN9fr2jznRVHiVE3CQRt3urw7ZRbEA=="
|
"integrity": "sha512-xdebsV1qWG+gXVVB2GBwoJi17dZgBcXmfWPzAGpmUMBEQAvbIs0DAc66zue+X3cHv7+29zKATa9JWMNOC/VEjg=="
|
||||||
},
|
},
|
||||||
"node_modules/@mongodb-js/saslprep": {
|
"node_modules/@mongodb-js/saslprep": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"author": "Liam Cottle <liam@liamcottle.com>",
|
"author": "Liam Cottle <liam@liamcottle.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@liamcottle/meshcore.js": "^1.0.5",
|
"@liamcottle/meshcore.js": "^1.0.6",
|
||||||
"@tailwindcss/forms": "^0.5.10",
|
"@tailwindcss/forms": "^0.5.10",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<!-- setting groups -->
|
<!-- setting groups -->
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
|
|
||||||
|
<!-- public info -->
|
||||||
<div class="bg-white divide-y">
|
<div class="bg-white divide-y">
|
||||||
|
|
||||||
<div class="bg-white p-2 font-semibold">Public Info</div>
|
<div class="bg-white p-2 font-semibold">Public Info</div>
|
||||||
@@ -52,6 +53,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- radio settings -->
|
||||||
<div class="bg-white divide-y">
|
<div class="bg-white divide-y">
|
||||||
|
|
||||||
<div class="bg-white p-2 font-semibold">Radio Settings</div>
|
<div class="bg-white p-2 font-semibold">Radio Settings</div>
|
||||||
@@ -106,6 +108,34 @@
|
|||||||
|
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -237,11 +267,6 @@ export default {
|
|||||||
// show success alert
|
// show success alert
|
||||||
alert("Settings saved.");
|
alert("Settings saved.");
|
||||||
|
|
||||||
// go back to main page
|
|
||||||
this.$router.push({
|
|
||||||
name: "main",
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
alert("Failed to save settings!");
|
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) {
|
bytesToHex(uint8Array) {
|
||||||
return Utils.bytesToHex(uint8Array);
|
return Utils.bytesToHex(uint8Array);
|
||||||
|
|||||||
@@ -266,6 +266,10 @@ class Connection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async reboot() {
|
||||||
|
await GlobalState.connection.reboot();
|
||||||
|
}
|
||||||
|
|
||||||
static async onContactMessageReceived(message) {
|
static async onContactMessageReceived(message) {
|
||||||
|
|
||||||
console.log("onContactMessageReceived", message);
|
console.log("onContactMessageReceived", message);
|
||||||
|
|||||||
Reference in New Issue
Block a user