diff --git a/test/client/index.html b/test/client/index.html
index 7fbb7c2..8e962c1 100644
--- a/test/client/index.html
+++ b/test/client/index.html
@@ -2,7 +2,7 @@
-
+
Klippy Web API Test
@@ -41,7 +41,7 @@
-
+
hidden
diff --git a/test/client/js/main.js b/test/client/js/main.js
index 8a34319..6c488ec 100644
--- a/test/client/js/main.js
+++ b/test/client/js/main.js
@@ -86,6 +86,9 @@ var api = {
delete: "server.files.delete_directory"
}
},
+ delete_file: {
+ method: "server.files.delete_file"
+ },
upload: {
url: "/server/files/upload"
},
@@ -480,6 +483,19 @@ function get_metadata(file_name) {
});
}
+function delete_file(file_path) {
+ json_rpc.call_method_with_kwargs(
+ api.delete_file.method, {'path': file_path})
+ .then((result) => {
+ // result is an "ok" acknowledgement that the
+ // print has started
+ console.log(result);
+ })
+ .catch((error) => {
+ update_error(api.delete_file.method, error);
+ });
+}
+
function get_gcode_help() {
json_rpc.call_method(api.gcode_help.method)
.then((result) => {
@@ -1046,7 +1062,8 @@ window.onload = () => {
settings.headers = {"X-Api-Key": apikey};
$.ajax(settings);
} else {
- console.log("File Delete not supported over websocket")
+ let fname = file_list_type + "/" + filename;
+ delete_file(fname);
}
}
});