diff --git a/src/components/pages/settings/NodeSettingsList.vue b/src/components/pages/settings/NodeSettingsList.vue
index fa2411f..e98ad83 100644
--- a/src/components/pages/settings/NodeSettingsList.vue
+++ b/src/components/pages/settings/NodeSettingsList.vue
@@ -159,6 +159,15 @@
{{ fileInfo.sizeBytes }} bytes
+
+
+
@@ -173,9 +182,11 @@ import GlobalState from "../../../js/GlobalState.js";
import NodeUtils from "../../../js/NodeUtils.js";
import NodeAPI from "../../../js/NodeAPI.js";
import DialogUtils from "../../../js/DialogUtils.js";
+import IconButton from "../../IconButton.vue";
export default {
name: 'SettingsList',
+ components: {IconButton},
props: {
nodeId: String | Number,
},
@@ -224,6 +235,28 @@ export default {
}
},
+ async deleteFile(nodeId, filename) {
+
+ // confirm user wants to delete file from node
+ if(!confirm(`Are you sure you want to delete '${filename}' from this node?`)){
+ return;
+ }
+
+ try {
+
+ // delete file from node
+ await NodeAPI.remoteAdminDeleteFile(nodeId, filename);
+
+ // update local state
+ GlobalState.myNodeFiles = GlobalState.myNodeFiles.filter((fileInfo) => {
+ return fileInfo.fileName !== filename;
+ });
+
+ } catch(e) {
+ DialogUtils.showErrorAlert(e);
+ }
+
+ },
},
computed: {
GlobalState() {
diff --git a/src/js/NodeAPI.js b/src/js/NodeAPI.js
index d95cfdd..84ec167 100644
--- a/src/js/NodeAPI.js
+++ b/src/js/NodeAPI.js
@@ -573,6 +573,24 @@ class NodeAPI {
}
+ /**
+ * Sends an admin request to delete a file from the provided node id
+ * @param nodeId
+ * @param filename the file to delete from the node
+ * @returns {Promise<*>}
+ */
+ static async remoteAdminDeleteFile(nodeId, filename) {
+
+ // create admin message packet
+ const adminMessageRequest = Protobuf.Admin.AdminMessage.fromJson({
+ deleteFileRequest: filename,
+ });
+
+ // send packet and wait for response
+ await this.sendAdminPacketAndWaitForResponse(nodeId, adminMessageRequest, false);
+
+ }
+
}
export default NodeAPI;