Skip to content

Commit

Permalink
Add "mark as resolved" button to history page
Browse files Browse the repository at this point in the history
  • Loading branch information
wcgunter committed Jul 5, 2023
1 parent 976d361 commit 2c8f6f6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 12 deletions.
15 changes: 15 additions & 0 deletions cws-service/src/main/java/jpl/cws/controller/RestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,21 @@ public GsonUTCDateAdapter() {
log.debug("*** REST CALL *** returning " + numRowsUpdated);
return ResponseEntity.ok("{ \"status\" : \"success\", \"message\" : \"Updated " + numRowsUpdated + " rows.\"}");
}

@RequestMapping(value = "/process/markResolved/{procInstId}", method = POST)
public @ResponseBody ResponseEntity<String> markIndividualResolved(
final HttpSession session,
@PathVariable String procInstId) {
log.info("*** REST CALL *** /process/MarkResolved ... 1");

try {
schedulerDbService.makeResolved(procInstId);
} catch (Exception e) {
log.error("Problem while marking procInstId as resolved in DB", e);
}
log.debug("*** REST CALL *** returning");
return ResponseEntity.ok("{ \"status\" : \"success\", \"message\" : \"Updated " + procInstId + ".\"}");
}


/**
Expand Down
49 changes: 37 additions & 12 deletions install/cws-ui/history.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<script src="/${base}/js/DataTables/datatables.js"></script>
<!-- Custom styles for this template -->
<link href="/${base}/css/dashboard.css" rel="stylesheet">
<style>
.dataTables_wrapper .filter .dataTables_filter{float:right; padding-top: 15px; display: inline;}
.dataTables_wrapper .download-button {padding-top: 15px;}
</style>
<script>
//STATE PERSISTANCE VARS
Expand Down Expand Up @@ -266,6 +270,11 @@
break;
}
$('#procStatus').html(status);
if ($("#procStatus").text() !== "Failed" && $("#procStatus").text() !== "Failed to start" && $("#procStatus").text() !== "Failed to schedule") {
$("#resolveButtonDiv").hide();
} else {
$("#resolveButtonDiv").show();
}
},
error: function(e) {
$("procStatus").html("Error fetching status - please try again later.");
Expand Down Expand Up @@ -454,14 +463,39 @@
$("#procInstId").text() + '.json'
);
}
function markAsResolved(procInstId) {
$.ajax({
type: "POST",
url: "/${base}/rest/process/markResolved/" + procInstId,
})
.done(function(msg) {
$("#action_msg").html(msg.message);
location.reload();
})
.fail(function(xhr, err) {
$("#action_msg").html(xhr.responseTextmsg.message);
});
}
$( document ).ready(function() {
$("#logData").DataTable({
order: [[0, 'desc']],
paging: false
paging: false,
dom: "<'row'<'col-sm-2 download-button'><'col-sm-10 filter'f>>" + "tip",
});
$('<div class="dropdown" style="display:inline;">'
+ '<button id="downloadButton" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">&nbsp;Download &nbsp;'
+ '<span class="caret"></span>'
+ '</button>'
+ '<ul id="action-list" class="dropdown-menu" role="menu" aria-labelledby="menu3">'
+ '<li id="action_download_json" class="enabled" role="presentation"><a id="json-bttn" role="menuitem" href="#">Download as JSON</a></li>'
+ '<li id="action_download_csv" class="enabled" role="presentation"><a id="csv-bttn" role="menuitem" href="#">Download as CSV</a></li>'
+ '</ul>'
+ '</div>').appendTo(".download-button");
// Get query string values
params = getQueryString();
Expand Down Expand Up @@ -563,17 +597,8 @@
</tr>
</table>
</div>

<div class="col-md-12">
<div class="dropdown" style="display:inline;">
<button id="downloadButton" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">&nbsp;Download &nbsp;
<span class="caret"></span>
</button>
<ul id="action-list" class="dropdown-menu" role="menu" aria-labelledby="menu3">
<li id="action_download_json" class="enabled" role="presentation"><a id="json-bttn" role="menuitem" href="#">Download as JSON</a></li>
<li id="action_download_csv" class="enabled" role="presentation"><a id="csv-bttn" role="menuitem" href="#">Download as CSV</a></li>
</ul>
</div>
<div id="resolveButtonDiv" class="row" style="text-align: center; display: none;">
<button id="resolveButton" class="btn btn-primary" type="button" onclick="markAsResolved($('#procInstId').text())">Mark as Resolved</button>
</div>
<!--
<div class="col-sm-12 main">
Expand Down

0 comments on commit 2c8f6f6

Please sign in to comment.