T139 Server returns history to client request

This commit is contained in:
2021-03-17 18:44:58 +01:00
parent 4ad48419df
commit 3e53d174f4
6 changed files with 57 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ import java.util.UUID;
public class EventController {
private final EtrackService service;
@GetMapping
@PostMapping
public ResponseEntity getHistory(@RequestBody EventRequestDto event){
return new ResponseEntity(service.getEventsByDateTimeAndBusinessKeys(event), HttpStatus.OK);
}

View File

@@ -101,7 +101,7 @@
<label for="historyTo">To</label>
<input type="datetime" name="dateTo" id="historyTo"/>
</div>
<button>Search</button>
<button id="btn-searchHistory">Search</button>
</div>
<div>
<table id="historyTable" class="simpleTable">
@@ -208,6 +208,6 @@
<script type="text/javascript" src="/js/modal.js"></script>
<script type="text/javascript" src="/js/uianimation.js"></script>
<script type="text/javascript" src="/js/datatransfer.js"></script>
<script type="text/javascript" src="/js/historyloader.js"></script>
</body>
</html>

View File

@@ -0,0 +1,26 @@
var historyJson = {};
function searchHistory(){
var dateFrom = $('#historyFrom').val();
var dateTo = $('#historyTo').val();
var eventRequest = {
clientUUID : json[jsonIndex].clientUUID,
localDateTimeFrom : dateFrom,
localDateTimeTo : dateTo,
mockedResponseId : json[jsonIndex].mockedResponseId
};
$.ajax({
url: host + '/api/event',
type: 'POST',
data: JSON.stringify(eventRequest, null, 2),
contentType: "application/json"
}).done(function(data){
console.log(data);
historyJson = data;
});
}
const startSearch = function(){
searchHistory();
}
$('#btn-searchHistory').click(startSearch);

View File

@@ -101,7 +101,7 @@
<label for="historyTo">To</label>
<input type="datetime" name="dateTo" id="historyTo"/>
</div>
<button>Search</button>
<button id="btn-searchHistory">Search</button>
</div>
<div>
<table id="historyTable" class="simpleTable">
@@ -208,6 +208,6 @@
<script type="text/javascript" src="/js/modal.js"></script>
<script type="text/javascript" src="/js/uianimation.js"></script>
<script type="text/javascript" src="/js/datatransfer.js"></script>
<script type="text/javascript" src="/js/historyloader.js"></script>
</body>
</html>

View File

@@ -0,0 +1,26 @@
var historyJson = {};
function searchHistory(){
var dateFrom = $('#historyFrom').val();
var dateTo = $('#historyTo').val();
var eventRequest = {
clientUUID : json[jsonIndex].clientUUID,
localDateTimeFrom : dateFrom,
localDateTimeTo : dateTo,
mockedResponseId : json[jsonIndex].mockedResponseId
};
$.ajax({
url: host + '/api/event',
type: 'POST',
data: JSON.stringify(eventRequest, null, 2),
contentType: "application/json"
}).done(function(data){
console.log(data);
historyJson = data;
});
}
const startSearch = function(){
searchHistory();
}
$('#btn-searchHistory').click(startSearch);