diff --git a/src/main/java/com/gw/GeoweaverApplication.java b/src/main/java/com/gw/GeoweaverApplication.java index dfe976cf8..dbfe7e353 100644 --- a/src/main/java/com/gw/GeoweaverApplication.java +++ b/src/main/java/com/gw/GeoweaverApplication.java @@ -40,7 +40,6 @@ public class GeoweaverApplication { private static String workspace; public static void main(String[] args) { - // if we have a command line argument, we assume it is a command if (args.length > 0) { @@ -74,6 +73,7 @@ public static void main(String[] args) { addLocalhost(); + System.out.println("GeoWeaver is started and ready for use.."); System.out.println("URL: http://localhost:"+BaseTool.get_current_port()+"/Geoweaver"); } diff --git a/src/main/java/com/gw/database/HistoryRepository.java b/src/main/java/com/gw/database/HistoryRepository.java index c35d59fc1..3479adc28 100644 --- a/src/main/java/com/gw/database/HistoryRepository.java +++ b/src/main/java/com/gw/database/HistoryRepository.java @@ -6,6 +6,7 @@ import java.util.Collection; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import javax.transaction.Transactional; @@ -163,4 +164,8 @@ public interface HistoryRepository extends JpaRepository { @Query(value = "SELECT * FROM history, gwprocess WHERE history.history_id = ?1 AND history.history_process = gwprocess.id", nativeQuery = true) List findOneHistoryofProcess(String history_id); + + @Modifying + @Query(value = "DELETE FROM history WHERE history_process = ?1 AND indicator = ?2", nativeQuery = true) + void deleteByProcessAndIndicator(String historyProcess, String indicator); } diff --git a/src/main/java/com/gw/tools/HistoryTool.java b/src/main/java/com/gw/tools/HistoryTool.java index 5c4bf0e73..dec442fc9 100644 --- a/src/main/java/com/gw/tools/HistoryTool.java +++ b/src/main/java/com/gw/tools/HistoryTool.java @@ -466,6 +466,11 @@ public void stop(String history_id) { } } + + public void deleteFailedHistory(String processId) { + historyrepository.deleteByProcessAndIndicator(processId, ExecutionStatus.FAILED); + } + public void saveSkippedHisotry(String historyid, String workflow_process_id, String hostid) { try { diff --git a/src/main/java/com/gw/web/GeoweaverController.java b/src/main/java/com/gw/web/GeoweaverController.java index 7067780dd..07b0c0c51 100644 --- a/src/main/java/com/gw/web/GeoweaverController.java +++ b/src/main/java/com/gw/web/GeoweaverController.java @@ -26,12 +26,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import javax.annotation.PreDestroy; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -64,6 +59,7 @@ import org.springframework.core.io.Resource; import org.springframework.data.repository.query.Param; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -1638,4 +1634,16 @@ public ResponseEntity authenticateUser(ModelMap model, WebRequest reques return resp; } + + @DeleteMapping("/delete-failed") + public ResponseEntity> deleteFailedProcesses(@RequestParam(required = false) String processId) { + Map response = new HashMap<>(); + if (processId == null || processId.trim().isEmpty()) { + response.put("failed", false); + return new ResponseEntity<>(response, HttpStatus.FORBIDDEN); + } + hist.deleteFailedHistory(processId); + response.put("success", true); + return new ResponseEntity<>(response, HttpStatus.OK); + } } diff --git a/src/main/resources/assets/h2_old.jar b/src/main/resources/assets/h2_old.jar new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/static/css/common.css b/src/main/resources/static/css/common.css index 5c87c4a79..b2df3fa75 100644 --- a/src/main/resources/static/css/common.css +++ b/src/main/resources/static/css/common.css @@ -24,3 +24,17 @@ display: inline-block; margin: 10px; } + +.history-remove-failed { + background: indianred; + border: 0; + margin-right: 15px; + padding: 4px 10px; + border-radius: 8px; + transition: transform 0.3s ease, background 0.3s ease; +} + +.history-remove-failed:hover { + cursor: pointer; + transform: scale(1.05); +} diff --git a/src/main/resources/static/js/gw.history.js b/src/main/resources/static/js/gw.history.js index a145617bd..1f593d388 100644 --- a/src/main/resources/static/js/gw.history.js +++ b/src/main/resources/static/js/gw.history.js @@ -195,7 +195,16 @@ GW.history = { }, - + removeFailedHistory: function(processId) { + const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({"processId": processId}) + } + fetch("delete-failed", options) + }, /** * Generates an HTML table with process execution history data. * @@ -216,6 +225,8 @@ GW.history = {
+ +