diff --git a/src/main/java/cn/langpy/kotime/controller/KoTimeController.java b/src/main/java/cn/langpy/kotime/controller/KoTimeController.java index 68805a1..605a09d 100644 --- a/src/main/java/cn/langpy/kotime/controller/KoTimeController.java +++ b/src/main/java/cn/langpy/kotime/controller/KoTimeController.java @@ -334,4 +334,13 @@ public class KoTimeController { PhysicalMemoryInfo physicalMemoryInfo = usageService.getPhysicalMemoryInfo(); return physicalMemoryInfo; } + + @PostMapping("/clearData") + @ResponseBody + @Auth + public boolean clearData() { + GraphService graphService = GraphService.getInstance(); + graphService.clearAll(); + return true; + } } diff --git a/src/main/resources/kotime-en.html b/src/main/resources/kotime-en.html index 59d9348..854258b 100644 --- a/src/main/resources/kotime-en.html +++ b/src/main/resources/kotime-en.html @@ -386,6 +386,11 @@ $.ajax({type:'POST',url:'contextPath/koTime/updateConfig?token='+globalToken,data:JSON.stringify({threshold:document.getElementById('timeThreshold').value}),dataType:'json', headers: {'Content-Type': 'application/json' }}); UIkit.notification("OK",{}); }; + + document.getElementById("clearDataYes").onclick = function(){ + $.ajax({type:'POST',url:'contextPath/koTime/clearData?token='+globalToken,dataType:'json', headers: {'Content-Type': 'application/json' }}); + UIkit.notification("OK",{}); + }; } function loadStatistic() { @@ -660,7 +665,10 @@
- + +
+ +


diff --git a/src/main/resources/kotime.html b/src/main/resources/kotime.html index 0d58503..30a2071 100644 --- a/src/main/resources/kotime.html +++ b/src/main/resources/kotime.html @@ -150,6 +150,10 @@ $.ajax({type:'POST',url:'contextPath/koTime/updateConfig?token='+globalToken,data:JSON.stringify({threshold:document.getElementById('timeThreshold').value}),dataType:'json', headers: {'Content-Type': 'application/json' }}); UIkit.notification("设置成功",{}); }; + document.getElementById("clearDataYes").onclick = function(){ + $.ajax({type:'POST',url:'contextPath/koTime/clearData?token='+globalToken,dataType:'json', headers: {'Content-Type': 'application/json' }}); + UIkit.notification("清除成功",{}); + }; } function loadConfig() { @@ -653,7 +657,9 @@
- + +
+