From 3e53d174f49e957a66d2d5555d4d56e8e9f632a4 Mon Sep 17 00:00:00 2001 From: modzeleg Date: Wed, 17 Mar 2021 18:44:58 +0100 Subject: [PATCH] T139 Server returns history to client request --- .../klaus/controller/EventController.java | 2 +- src/main/resources/static/html/mock.html | 4 +-- src/main/resources/static/js/historyloader.js | 26 ++++++++++++++++++ .../klaus/controller/EventController.class | Bin 1681 -> 1682 bytes target/classes/static/html/mock.html | 4 +-- target/classes/static/js/historyloader.js | 26 ++++++++++++++++++ 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/release11/klaus/controller/EventController.java b/src/main/java/com/release11/klaus/controller/EventController.java index ff89857..ecfcd36 100644 --- a/src/main/java/com/release11/klaus/controller/EventController.java +++ b/src/main/java/com/release11/klaus/controller/EventController.java @@ -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); } diff --git a/src/main/resources/static/html/mock.html b/src/main/resources/static/html/mock.html index caafe0a..b29d62b 100644 --- a/src/main/resources/static/html/mock.html +++ b/src/main/resources/static/html/mock.html @@ -101,7 +101,7 @@ - +
@@ -208,6 +208,6 @@ - + \ No newline at end of file diff --git a/src/main/resources/static/js/historyloader.js b/src/main/resources/static/js/historyloader.js index e69de29..7e20f19 100644 --- a/src/main/resources/static/js/historyloader.js +++ b/src/main/resources/static/js/historyloader.js @@ -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); \ No newline at end of file diff --git a/target/classes/com/release11/klaus/controller/EventController.class b/target/classes/com/release11/klaus/controller/EventController.class index f188430728df3c08ddf653dc2361867bdfe242ca..47acb1ca4c68e4e172ebb6521cfe5cb17a150cbb 100644 GIT binary patch delta 20 bcmbQpJBfG0HRj1iELzL~`Nf-=So)a&N8AQE delta 25 hcmbQlJCS$8HD)FgpNRq@lix6lFuA90W@hPU0sv~n2aNy# diff --git a/target/classes/static/html/mock.html b/target/classes/static/html/mock.html index caafe0a..b29d62b 100644 --- a/target/classes/static/html/mock.html +++ b/target/classes/static/html/mock.html @@ -101,7 +101,7 @@ - +
@@ -208,6 +208,6 @@ - + \ No newline at end of file diff --git a/target/classes/static/js/historyloader.js b/target/classes/static/js/historyloader.js index e69de29..7e20f19 100644 --- a/target/classes/static/js/historyloader.js +++ b/target/classes/static/js/historyloader.js @@ -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); \ No newline at end of file