diff --git a/src/components/pages/settings/NodeSettingsList.vue b/src/components/pages/settings/NodeSettingsList.vue index 082f249..67d7271 100644 --- a/src/components/pages/settings/NodeSettingsList.vue +++ b/src/components/pages/settings/NodeSettingsList.vue @@ -97,6 +97,27 @@ +
+ + +
+ + + +
+ + +
Reset Node DB
+ + +
+ + + +
+ +
+
@@ -167,6 +188,21 @@ export default { } }, + async resetNodeDb(nodeId) { + + // confirm user wants to reset node db + if(!confirm("Are you sure you want to reset this nodes Node DB?")){ + return; + } + + try { + await NodeAPI.remoteAdminResetNodeDb(nodeId); + alert("Node has been asked to reset its Node DB. It will reboot afterwards."); + } catch(e) { + DialogUtils.showErrorAlert(e); + } + + }, }, computed: { GlobalState() { diff --git a/src/js/NodeAPI.js b/src/js/NodeAPI.js index e084e30..2b3f40b 100644 --- a/src/js/NodeAPI.js +++ b/src/js/NodeAPI.js @@ -501,6 +501,23 @@ class NodeAPI { } + /** + * Sends an admin request to reset the node db for the provided node id + * @param nodeId + * @returns {Promise<*>} + */ + static async remoteAdminResetNodeDb(nodeId) { + + // create admin message packet + const adminMessageRequest = Protobuf.Admin.AdminMessage.fromJson({ + nodedbReset: 1, // this is what is sent by the android client, even though firmware doesn't use it + }); + + // send packet and wait for response + await this.sendAdminPacketAndWaitForResponse(nodeId, adminMessageRequest, false); + + } + } export default NodeAPI;