Merge branch 'modzeleg' into developer
This commit is contained in:
		| @@ -8,6 +8,9 @@ import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.UUID; | ||||
|  | ||||
| /** | ||||
|  * It's the REST api for {@link com.release11.klaus.model.Event} | ||||
|  * @author Gabriel Modzelewski | ||||
| @@ -27,8 +30,24 @@ public class EventController { | ||||
|      * @return list of Event's | ||||
|      */ | ||||
|     @PostMapping | ||||
|     public ResponseEntity getHistory(@RequestBody EventRequestDto event){ | ||||
|     public ResponseEntity filterHistory(@RequestBody EventRequestDto event){ | ||||
|         return new ResponseEntity(service.getEventsByDateTimeAndBusinessKeys(event), HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|     @GetMapping(path = "/{uuid}/{messageId}") | ||||
|     public ResponseEntity getLastDay(@PathVariable UUID uuid, | ||||
|                                      @PathVariable Integer messageId){ | ||||
|         LocalDateTime requestTime = LocalDateTime.now(); | ||||
|         LocalDateTime dayBeforeRequest = requestTime.minusDays(1L); | ||||
|         EventRequestDto eventRequestDto = EventRequestDto.builder() | ||||
|                 .clientUUID(uuid) | ||||
|                 .mockedResponseId(messageId) | ||||
|                 .localDateTimeFrom(dayBeforeRequest) | ||||
|                 .localDateTimeTo(requestTime) | ||||
|                 .build(); | ||||
|         return new ResponseEntity(service.getEventsByDateTimeAndBusinessKeys(eventRequestDto), HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import java.time.LocalDateTime; | ||||
| @ToString | ||||
| @NoArgsConstructor | ||||
| @AllArgsConstructor | ||||
| public class Event { | ||||
| public class Event implements Comparable<Event>{ | ||||
|  | ||||
|     @DateTimeFormat(pattern = "yyyy-MM-ddTHH:mm:ss") | ||||
|     private LocalDateTime dateTimeStamp; | ||||
| @@ -29,4 +29,9 @@ public class Event { | ||||
|     private String level; | ||||
|     @Nullable | ||||
|     private String message; | ||||
|  | ||||
|     @Override | ||||
|     public int compareTo(Event o) { | ||||
|         return this.getDateTimeStamp().compareTo(o.getDateTimeStamp()) * -1; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -8,6 +8,7 @@ import lombok.AllArgsConstructor; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import java.util.Collections; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| @@ -37,7 +38,9 @@ public class EtrackServiceImpl implements EtrackService { | ||||
|         if (eventsDto.getMockedResponseId() != null){ | ||||
|             businessKeys.put(BusinessKey.MESSAGE_ID, String.valueOf(eventsDto.getMockedResponseId())); | ||||
|         } | ||||
|         return eventRepository.findEvents(eventsDto.getLocalDateTimeFrom(), eventsDto.getLocalDateTimeTo(), | ||||
|         List<Event> events = eventRepository.findEvents(eventsDto.getLocalDateTimeFrom(), eventsDto.getLocalDateTimeTo(), | ||||
|                 businessKeys); | ||||
|         Collections.sort(events); | ||||
|         return events; | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										4
									
								
								src/main/resources/static/css/main.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/main/resources/static/css/main.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| .overflowedTableContent { | ||||
|     max-height: 750px; | ||||
|     overflow: scroll; | ||||
| } | ||||
| @@ -4,6 +4,7 @@ | ||||
|     <title>R11 MockedServices</title> | ||||
|     <meta charset="utf-8"> | ||||
|     <link rel="stylesheet" href="css/fontello.css" type="text/css"> | ||||
|     <link rel="stylesheet" href="css/main.css" type="text/css"> | ||||
|     <link rel="stylesheet" href="http://gordon.zipper.release11.com:8085/common.css" type="text/css"> | ||||
|     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||||
| </head> | ||||
| @@ -63,9 +64,7 @@ | ||||
|                         <textarea id="bodyEditor" class="data-field bordered-field max-width with-padding height-300 vertically-resizeable"></textarea> | ||||
|                     </div> | ||||
|                     <!-- show/hide --> | ||||
|                     <div id="optional" class="clickable-text highlight"> | ||||
|                         <h3>> show/hide advanced settings</h3> | ||||
|                     </div> | ||||
|                     <button id="optional" class="clickable-text highlight switch"><span class="toggleIndicator"></span> show/hide advanced settings</button> | ||||
|                     <!-- advanced --> | ||||
|                     <div id="advanced" class="max-width with-padding hiddable"> | ||||
|                         <!-- tab menu --> | ||||
| @@ -102,7 +101,8 @@ | ||||
|                             <!-- history --> | ||||
|                             <div id="history" class="medium-vertical-margin tabcontent"> | ||||
|                                 <div class="block-display max-width"> | ||||
|                                     <div class="display-space-between max-width small-vertical-margin"> | ||||
|                                     <button id="btn-history-filter" class="clickable-text highlight switch"><span class="toggleIndicator"></span> filter</button> | ||||
|                                     <div id ="history-filter" class="display-space-between max-width small-vertical-margin hiddable"> | ||||
|                                         <div class="three-fourth-width display-space-evenly"> | ||||
|                                             <div class="block-display half-width with-padding"> | ||||
|                                                 <label for="historyFrom" class="block-label">From</label> | ||||
| @@ -118,7 +118,7 @@ | ||||
|                                         <button id="btn-searchHistory" class="quater-width action-button active small-margins">Search</button> | ||||
|                                     </div> | ||||
|                                  | ||||
|                                     <div class="max-width centered-content large-vertical-margin"> | ||||
|                                     <div class="max-width centered-content large-vertical-margin overflowedTableContent"> | ||||
|                                         <table id="historyTable" class="table-default"> | ||||
|                                             <thead> | ||||
|                                                 <tr class="bottom-border"> | ||||
|   | ||||
| @@ -40,6 +40,8 @@ function getData(){ | ||||
|     }); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| function checkUuid(){ | ||||
|     if(clientUUID == null || clientUUID == undefined || clientUUID == ''){ | ||||
|         clientUUID = json[0].clientUUID; | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| var historyJson = {}; | ||||
| const maxIterations = 30; | ||||
| const maxIterations = 200; | ||||
|  | ||||
| function filterHistory(){ | ||||
|     var dateFrom = new Date($('#historyFrom').val() + 'T' + $('#historyTimeFrom').val()); | ||||
| @@ -52,6 +52,13 @@ function loadHistory(dateFrom, dateTo){ | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function getLast24hHistoryData(){ | ||||
|     $.getJSON(host + '/api/event/' + clientUUID + '/' + lastId, function(data){ | ||||
|         historyJson = data; | ||||
|         displayHistory(); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function historyToHtml(){ | ||||
|     var innerHTML = ''; | ||||
|     var iterations = historyJson.length <= maxIterations ? historyJson.length : maxIterations; | ||||
|   | ||||
| @@ -22,8 +22,16 @@ function changeAdvancedVisibility(){ | ||||
|     setCookie(); | ||||
| } | ||||
|  | ||||
| const historyFilter = $('#history-filter'); | ||||
| const historyFilterSwitch = function(){ | ||||
|     historyFilter.toggleClass('active'); | ||||
| } | ||||
|  | ||||
| $("#optional").click(changeAdvancedVisibility); | ||||
| $('#historyTab').click(showHistory); | ||||
| $('#btn-history-filter').click(historyFilterSwitch); | ||||
|  | ||||
|  | ||||
|  | ||||
| const tabitem = $('.tabitem'); | ||||
| function showHistory(){ | ||||
| @@ -33,8 +41,16 @@ function showHistory(){ | ||||
|     $('#history').addClass('active'); | ||||
|     $('#historyTab').addClass('active'); | ||||
|     $('#historyTab').off('click'); | ||||
|     initializeHistory(); | ||||
| } | ||||
|  | ||||
| function initializeHistory(){ | ||||
|     historyFilter.removeClass('active'); | ||||
|     getLast24hHistoryData(); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| function showHeaders(){ | ||||
|     $('#historyTab').click(showHistory); | ||||
|     tabitem.removeClass('active'); | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										4
									
								
								target/classes/static/css/main.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								target/classes/static/css/main.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| .overflowedTableContent { | ||||
|     max-height: 750px; | ||||
|     overflow: scroll; | ||||
| } | ||||
| @@ -4,6 +4,7 @@ | ||||
|     <title>R11 MockedServices</title> | ||||
|     <meta charset="utf-8"> | ||||
|     <link rel="stylesheet" href="css/fontello.css" type="text/css"> | ||||
|     <link rel="stylesheet" href="css/main.css" type="text/css"> | ||||
|     <link rel="stylesheet" href="http://gordon.zipper.release11.com:8085/common.css" type="text/css"> | ||||
|     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||||
| </head> | ||||
| @@ -63,9 +64,7 @@ | ||||
|                         <textarea id="bodyEditor" class="data-field bordered-field max-width with-padding height-300 vertically-resizeable"></textarea> | ||||
|                     </div> | ||||
|                     <!-- show/hide --> | ||||
|                     <div id="optional" class="clickable-text highlight"> | ||||
|                         <h3>> show/hide advanced settings</h3> | ||||
|                     </div> | ||||
|                     <button id="optional" class="clickable-text highlight switch"><span class="toggleIndicator"></span> show/hide advanced settings</button> | ||||
|                     <!-- advanced --> | ||||
|                     <div id="advanced" class="max-width with-padding hiddable"> | ||||
|                         <!-- tab menu --> | ||||
| @@ -102,7 +101,8 @@ | ||||
|                             <!-- history --> | ||||
|                             <div id="history" class="medium-vertical-margin tabcontent"> | ||||
|                                 <div class="block-display max-width"> | ||||
|                                     <div class="display-space-between max-width small-vertical-margin"> | ||||
|                                     <button id="btn-history-filter" class="clickable-text highlight switch"><span class="toggleIndicator"></span> filter</button> | ||||
|                                     <div id ="history-filter" class="display-space-between max-width small-vertical-margin hiddable"> | ||||
|                                         <div class="three-fourth-width display-space-evenly"> | ||||
|                                             <div class="block-display half-width with-padding"> | ||||
|                                                 <label for="historyFrom" class="block-label">From</label> | ||||
| @@ -118,7 +118,7 @@ | ||||
|                                         <button id="btn-searchHistory" class="quater-width action-button active small-margins">Search</button> | ||||
|                                     </div> | ||||
|                                  | ||||
|                                     <div class="max-width centered-content large-vertical-margin"> | ||||
|                                     <div class="max-width centered-content large-vertical-margin overflowedTableContent"> | ||||
|                                         <table id="historyTable" class="table-default"> | ||||
|                                             <thead> | ||||
|                                                 <tr class="bottom-border"> | ||||
|   | ||||
| @@ -40,6 +40,8 @@ function getData(){ | ||||
|     }); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| function checkUuid(){ | ||||
|     if(clientUUID == null || clientUUID == undefined || clientUUID == ''){ | ||||
|         clientUUID = json[0].clientUUID; | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| var historyJson = {}; | ||||
| const maxIterations = 30; | ||||
| const maxIterations = 200; | ||||
|  | ||||
| function filterHistory(){ | ||||
|     var dateFrom = new Date($('#historyFrom').val() + 'T' + $('#historyTimeFrom').val()); | ||||
| @@ -52,6 +52,13 @@ function loadHistory(dateFrom, dateTo){ | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function getLast24hHistoryData(){ | ||||
|     $.getJSON(host + '/api/event/' + clientUUID + '/' + lastId, function(data){ | ||||
|         historyJson = data; | ||||
|         displayHistory(); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function historyToHtml(){ | ||||
|     var innerHTML = ''; | ||||
|     var iterations = historyJson.length <= maxIterations ? historyJson.length : maxIterations; | ||||
|   | ||||
| @@ -22,8 +22,16 @@ function changeAdvancedVisibility(){ | ||||
|     setCookie(); | ||||
| } | ||||
|  | ||||
| const historyFilter = $('#history-filter'); | ||||
| const historyFilterSwitch = function(){ | ||||
|     historyFilter.toggleClass('active'); | ||||
| } | ||||
|  | ||||
| $("#optional").click(changeAdvancedVisibility); | ||||
| $('#historyTab').click(showHistory); | ||||
| $('#btn-history-filter').click(historyFilterSwitch); | ||||
|  | ||||
|  | ||||
|  | ||||
| const tabitem = $('.tabitem'); | ||||
| function showHistory(){ | ||||
| @@ -33,8 +41,16 @@ function showHistory(){ | ||||
|     $('#history').addClass('active'); | ||||
|     $('#historyTab').addClass('active'); | ||||
|     $('#historyTab').off('click'); | ||||
|     initializeHistory(); | ||||
| } | ||||
|  | ||||
| function initializeHistory(){ | ||||
|     historyFilter.removeClass('active'); | ||||
|     getLast24hHistoryData(); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| function showHeaders(){ | ||||
|     $('#historyTab').click(showHistory); | ||||
|     tabitem.removeClass('active'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user