- fix collisions between js script from main page and the application,

- fix problem with special characters for etrack,
This commit is contained in:
Szakalakamaka
2020-11-03 15:23:21 +01:00
parent ea56911a58
commit dff31ab907
43 changed files with 988 additions and 567 deletions

View File

@@ -1,10 +0,0 @@
#environment:
server.port = 8097
spring.application.name = klaus
eureka.client.service-url.defaultZone=http://netflix:eureka@eureka:8761/eureka/
#logging:
spring.output.ansi.enabled = always
logging.level.root=DEBUG
logging.level.org.springframework.web=DEBUG
logging.level.com.release11=DEBUG

View File

@@ -1,10 +0,0 @@
#environment:
server.port = 8097
spring.application.name = klaus
eureka.client.service-url.defaultZone=http://netflix:eureka@eureka:8761/eureka/
#logging:
spring.output.ansi.enabled = always
logging.level.root=INFO
logging.level.org.springframework.web=INFO
logging.level.com.release11=INFO

View File

@@ -1,10 +1,6 @@
#environment:
eureka.client.service-url.defaultZone=http://netflix:eureka@localhost:8761/eureka/
server.port = 8097
spring.application.name = klaus
spring.cloud.discovery.enabled=true
spring.cloud.config.discovery.service-id = klaus-config-service
#spring.cloud.config.fail-fast=true
endpoints.env.enabled = false
#spring.cloud.config.username = SpringConfigUsername
#spring.cloud.config.password = SpringConfigPassword
#logging:
@@ -12,3 +8,8 @@ spring.output.ansi.enabled = always
logging.level.root=INFO
logging.level.org.springframework.web=INFO
logging.level.com.release11=INFO
#operations
release11.mocked-service.controller.delete = false
release11.mocked-service.controller.getAll = false
release11.mocked-service.controller.get = true
release11.mocked-service.controller.set = true

View File

@@ -1,18 +1,13 @@
#environment:
spring.cloud.discovery.enabled=true
spring.cloud.config.discovery.enabled = true
spring.cloud.config.discovery.service-id = klaus-config-service
spring.cloud.config.fail-fast=true
spring.cloud.config.retry.initial-interval = 1500
spring.cloud.config.retry.multiplier = 1.5
spring.cloud.config.retry.max-attempts = 10000
spring.cloud.config.retry.max-intervals = 1000
#spring.cloud.config.retry.initial-interval = 1500
release11.mocked-service.controller.delete = true
#spring.cloud.config.retry.multiplier = 1.5
#spring.cloud.config.retry.max-attempts = 10000
#spring.cloud.config.retry.max-intervals = 1000
#spring.cloud.config.username = SpringConfigUsername
#spring.cloud.config.password = SpringConfigPassword
eureka.instance.preferIpAddress = true
eureka.instance.hostname = klaus
eureka.client.registerWithEureka = true
eureka.client.fetchRegistry = true

View File

@@ -3,7 +3,7 @@
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<!--https://github.com/kmtong/logback-redis-appender-->
<appender name="LOGSTASH" class="com.release11.klaus.utilis.RedisAppender">
<host>redis</host>
<host>localhost</host>
<port>6379</port>
<key>logstash</key>
<layout class="ch.qos.logback.classic.PatternLayout">

View File

@@ -1,3 +1,11 @@
html {
height: 100%;
}
body {
min-height: 100%;
}
.page-section{
padding: 2rem 0;
@@ -105,7 +113,82 @@ button[name="removeHeader"] {
cursor: pointer;
}
.active {
.activeButton {
background-color: rgb(153, 194, 255);
}
#child-body{
margin-left: 220px;
}
#container1{
}
#foot {
clear: both;
position: relative;
right: 0;
bottom: 0;
left: 0;
}
/* The side navigation menu */
.sidebar {
margin-top: 100px;
padding-top: 200px;
padding: 0;
width: 200px;
background-color: #f1f1f1;
position: absolute;
height: 100%;
overflow: auto;
}
/* Sidebar links */
.sidebar a {
display: block;
color: black;
padding: 16px;
text-decoration: none;
}
/* Active/current link */
.sidebar a.active {
background-color: #4CAF50;
color: white;
}
/* Links on mouse-over */
.sidebar a:hover:not(.active) {
background-color: #555;
color: white;
}
/* On screens that are less than 700px wide, make the sidebar into a topbar */
@media screen and (max-width: 700px) {
.sidebar {
width: 100%;
height: auto;
position: fixed;
}
.sidebar a {float: left;}
div.content {margin-left: 0;}
}
/* On screens that are less than 400px, display the bar vertically, instead of horizontally */
@media screen and (max-width: 400px) {
.sidebar a {
text-align: center;
float: none;
}
}
table { border-collapse: collapse; }
tr { border: none; }
td {
border: none;
}

View File

@@ -27,9 +27,9 @@ for (let i = 3; i >= 0; i--) {
function addButtonListeners(i) {
var buttons = document.querySelectorAll('.btn-sort');
for (var j = buttons.length - 1; j >= 0; j--) {
buttons[j].classList.remove('active');
buttons[j].classList.remove('activeButton');
}
document.querySelector('#btn-sort-' + i).classList.add('active');
document.querySelector('#btn-sort-' + i).classList.add('activeButton');
buildTable();
}
@@ -132,7 +132,7 @@ function showTable() {
function sortTable() {
var sortBy = document.querySelector('.active').textContent
var sortBy = document.querySelector('.activeButton').textContent
switch (sortBy) {
case "MessageId":
if (previousSort === "MessageId") {

View File

@@ -14,8 +14,7 @@ var state = {
}
var myList, data, previousSort;
console.log("raz dwa trzy")
state.querySet = listForPagination;
buildTable();
@@ -28,15 +27,13 @@ for (let i = 3; i >= 0; i--) {
function addButtonListeners(i) {
var buttons = document.querySelectorAll('.btn-sort');
for (var j = buttons.length - 1; j >= 0; j--) {
buttons[j].classList.remove('active');
buttons[j].classList.remove('activeButton');
}
document.querySelector('#btn-sort-' + i).classList.add('active');
document.querySelector('#btn-sort-' + i).classList.add('activeButton');
buildTable();
}
function pagination(querySet, page, rows) {
var trimStart = (page - 1) * rows
var trimEnd = trimStart + rows
var trimmedData = querySet.slice(trimStart, trimEnd)
@@ -48,10 +45,8 @@ function pagination(querySet, page, rows) {
}
}
function pageButtons(pages) {
var wrapper = document.getElementById('pagination-wrapper');
wrapper.innerHTML = ``;
var maxLeft = (state.page - Math.floor(state.window / 2))
var maxRight = (state.page + Math.ceil(state.window / 2))
@@ -136,7 +131,6 @@ function showTable() {
</td>
`
}
table.append(row)
}
for (var i = myList.length + 1; i <= state.rows; i++) {
@@ -158,12 +152,13 @@ function showTable() {
}
table.append(row)
}
pageButtons(data.pages)
}
function sortTable() {
var sortBy = document.querySelector('.active').textContent
console.log("sortTable");
var sortBy = document.querySelector('.activeButton').textContent;
console.log(sortBy);
switch (sortBy) {
case "MessageId":
if (previousSort === "MessageId") {
@@ -191,6 +186,7 @@ function sortTable() {
previousSort = ""
} else previousSort = sortBy;
myList = state.querySet;
console.log(myList);
}
function prepareTable() {
@@ -199,6 +195,7 @@ function prepareTable() {
}
function buildTable() {
console.log("buildTable");
sortTable();
prepareTable();
showTable();

View File

@@ -11,58 +11,82 @@
</head>
<body>
<hr>
<section class="page-section" id="main-section">
<div class="row">
<div class="column">
<br>To see your activity history use the form below
<form action="#" th:action="@{/etrack/__${clientUUID}__}" th:object="${eventRequestDto}" method="post">
<input type="text" th:name="clientUUID" th:value="${clientUUID}" hidden />
<br><label>Mocked response id:</label><br>
<input type="text" th:name="mockedResponseId" th:id="mockedResponseId" th:placeholder="all" />
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">mockedResponseId
error
</td>
<br><label>Date from:</label><br>
<input type="datetime-local" th:field="*{localDateTimeFrom}"/>
<td th:if="${#fields.hasErrors('localDateTimeFrom')}" th:errors="*{localDateTimeFrom}">localDateTimeFrom
Error
</td>
<br><label>Date to:</label><br>
<input type="datetime-local" th:field="*{localDateTimeTo}"/>
<td th:if="${#fields.hasErrors('localDateTimeTo')}" th:errors="*{localDateTimeTo}">localDateTimeTo
Error
</td>
<div th:if="${#fields.hasAnyErrors()}">
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">...</p>
<div id="container">
<div id="header"></div>
<div id="container1">
<div id="sidebar"></div>
<div id="child-body">
<section class="page-section" id="main-section">
<div class="row">
<div class="column">
<br>To see your activity history use the form below
<form action="#" th:action="@{/etrack/__${clientUUID}__}" th:object="${eventRequestDto}" method="post">
<input type="text" th:name="clientUUID" th:value="${clientUUID}" hidden />
<br><label>Mocked response id:</label><br>
<input type="text" th:name="mockedResponseId" th:id="mockedResponseId" th:placeholder="all" />
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">mockedResponseId
error
</td>
<br><label>Date from:</label><br>
<input type="datetime-local" th:field="*{localDateTimeFrom}"/>
<td th:if="${#fields.hasErrors('localDateTimeFrom')}" th:errors="*{localDateTimeFrom}">localDateTimeFrom
Error
</td>
<br><label>Date to:</label><br>
<input type="datetime-local" th:field="*{localDateTimeTo}"/>
<td th:if="${#fields.hasErrors('localDateTimeTo')}" th:errors="*{localDateTimeTo}">localDateTimeTo
Error
</td>
<div th:if="${#fields.hasAnyErrors()}">
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">...</p>
</div>
<input type="submit" value="See my history"/>
</form>
</div>
<div class="column">
<br>
<table>
<thead>
<tr>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-0">#</p></th>
<th class="tr-pageable"><p class="btn-sort activeButton" id="btn-sort-1">MessageId</p></th>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-2">TimeStamp</p></th>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-3">Action</p></th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>
<div class="container ">
<div id="pagination-wrapper"></div>
</div>
</div>
</div>
<input type="submit" value="See my history"/>
</form>
</div>
<div class="column">
<br>
<table>
<thead>
<tr>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-0">#</p></th>
<th class="tr-pageable"><p class="btn-sort active" id="btn-sort-1">MessageId</p></th>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-2">TimeStamp</p></th>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-3">Action</p></th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>
<div class="container ">
<div id="pagination-wrapper"></div>
</div>
</section>
</div>
</div>
</section>
</div>
<div id="foot"></div>
</div>
<hr>
<script>
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/navbar.html", function(data){
$("#header").html(data);
});
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/sidebar.html", function(data){
$("#sidebar").html(data);
});
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/footer.html", function(data){
$("#foot").html(data);
});
</script>
<script type="text/javascript" th:inline="javascript">
var listForPagination = /*[[${eventList}]]*/;
</script>
<script src="/js/etrackPaggination.js"></script>
</body>
</html>

View File

@@ -10,155 +10,178 @@
</head>
<body>
<hr>
<section class="page-section" id="main-section">
<div class="container">
<div class="row">
<div class="column">
<br>In order to set mockup response please fill the form below:
<table>
<form action="#" th:action="@{/home/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}" method="post">
<input type="text" th:field="*{clientUUID}" hidden/>
<tr>
<td>Mocked response id:</td>
<td><input type="text" th:field="*{mockedResponseId}" placeholder="1"/></td>
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">Id
Error
</td>
</tr>
<tr>
<td>Mocked response body:</td>
<td><textarea rows="4" cols="30" th:field="*{messageBody}"
placeholder="Your message body"></textarea></td>
<td th:if="${#fields.hasErrors('messageBody')}" th:errors="*{messageBody}">Body Error</td>
</tr>
<tr>
<td>Mocked response http code status:</td>
<td><input type="text" th:field="*{httpStatus}" placeholder="200"></td>
<td th:if="${#fields.hasErrors('httpStatus')}" th:errors="*{httpStatus}">HttpStatus Error
</td>
</tr>
<div id="container">
<div id="header"></div>
<div id="container1">
<div id="sidebar"></div>
<div id="child-body">
<div class="container">
<section class="page-section" id="main-section">
<div class="container">
<p>With this tool you can create mockups for http requests and use them for integration tests of your system.</p>
<div class="row">
<div class="column">
<tr>
<td>Header name</td>
<td>Header value</td>
</tr>
<tr>
<td><input type="text" name="headerKey" id="headerKey" placeholder="myHeaderKey"/></td>
<td>
<input type="text" name="headerValue" id="headerValue" placeholder="myHeaderValue"/>
<input type="image" name="addHeader" src="/img/icons8-plus-48.png"
style="width: 20px;"/>
</td>
</tr>
<tr th:each="entry, stats : *{httpHeaders}" bgcolor="#b3ffff">
<td><input type="text" name="value" th:value="${entry.key}" disabled="disabled"/></td>
<td>
<input type="text" name="value" th:field="*{httpHeaders[__${entry.key}__]}"/>
<button type="submit" name="removeHeader" th:value="${entry.key}">
<img src="/img/icons8-cancel-64.png" style="width: 20px;"/>
</button>
</td>
</tr>
<tr>
<td>Media type:</td>
<td><select th:field="*{mediaType}">
<option value="application/xml">application/xml</option>
<option value="application/json">application/json</option>
<option value="text/xml">text/xml</option>
</select></td>
</tr>
<tr>
<td><input type="submit" value="Save my message"/></td>
<td>
<button type="submit" name="newMessage" th:value="*{clientUUID}">
<img src="/img/update-button.png" style="width: 20px;"/>
</button>
</td>
</tr>
</form>
</table>
<table>
<tr>
<td>
<form action="#" th:action="@{/etrack/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}"
method="get">
<p><input type="submit" value="History"/></p>
</form>
</td>
<td>
<form action="#" th:action="@{/home/getMockedResponse}" th:object="${mockedMessageDto}"
method="get">
<input type="text" th:field="*{clientUUID}" hidden/>
<input type="text" th:field="*{mockedResponseId}" hidden/>
<p th:if="${canTest}"><input type="submit" value="Test your mock"/></p>
</form>
</td>
</tr>
</table>
<p th:if="${mockSaved}">Mock has been saved</p>
<br>
<p>In order to set mockup response please fill the form below:</p>
<table>
<form action="#" th:action="@{/home/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}" method="post">
<input type="text" th:field="*{clientUUID}" hidden/>
<tr>
<td>Mocked response id:</td>
<td><input type="text" th:field="*{mockedResponseId}" th:value="*{mockedResponseId}"/></td>
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">Id
Error
</td>
</tr>
<tr>
<td>Mocked response body:</td>
<td><textarea rows="4" cols="30" th:field="*{messageBody}"
placeholder="Your message body"></textarea></td>
<td th:if="${#fields.hasErrors('messageBody')}" th:errors="*{messageBody}">Body Error</td>
</tr>
<tr>
<td>Mocked response http code status:</td>
<td><input type="text" th:field="*{httpStatus}" placeholder="200"></td>
<td th:if="${#fields.hasErrors('httpStatus')}" th:errors="*{httpStatus}">HttpStatus Error
</td>
</tr>
<tr>
<td>Header name</td>
<td>Header value</td>
</tr>
<tr>
<td><input type="text" name="headerKey" id="headerKey" placeholder="myHeaderKey"/></td>
<td>
<input type="text" name="headerValue" id="headerValue" placeholder="myHeaderValue"/>
<input type="image" name="addHeader" src="/img/icons8-plus-48.png"
style="width: 20px;"/>
</td>
</tr>
<tr th:each="entry, stats : *{httpHeaders}" bgcolor="#b3ffff">
<td><input type="text" name="value" th:value="${entry.key}" disabled="disabled"/></td>
<td>
&#9;
<input type="text" name="value" th:field="*{httpHeaders[__${entry.key}__]}"/>
<button type="submit" name="removeHeader" th:value="${entry.key}">
<img src="/img/icons8-cancel-64.png" style="width: 20px;"/>
</button>
</td>
</tr>
<tr>
<td>Media type:</td>
<td><select th:field="*{mediaType}">
<option value="application/xml">application/xml</option>
<option value="application/json">application/json</option>
<option value="text/xml">text/xml</option>
</select></td>
</tr>
<tr>
<td><input type="submit" value="Save my message"/></td>
<td>
<button type="submit" name="newMessage" th:value="*{clientUUID}">
<img src="/img/update-button.png" style="width: 20px;"/>
</button>
</td>
</tr>
</form>
</table>
<table>
<tr>
<td>
<form action="#" th:action="@{/etrack/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}"
method="get">
<p><input type="submit" value="History"/></p>
</form>
</td>
<td>
<form action="#" th:action="@{/home/getMockedResponse}" th:object="${mockedMessageDto}"
method="get">
<input type="text" th:field="*{clientUUID}" hidden/>
<input type="text" th:field="*{mockedResponseId}" hidden/>
<p th:if="${canTest}"><input type="submit" value="Test your mock"/></p>
</form>
</td>
</tr>
</table>
<p th:if="${mockSaved}">Mock has been saved</p>
</div>
<div class="column">
<br>
<form action="#" th:action="@{/home/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}" method="post">
<table>
<thead>
<tr>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-0">#</p>
</th>
<th class="tr-pageable">
<p class="btn-sort activeButton" id="btn-sort-1">MessageId</p>
</th>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-2">Media Type</p>
</th>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-3">Http Status</p>
</th>
</tr>
</thead>
<input type="text" th:field="*{clientUUID}" hidden/>
<tbody id="table-body">
</tbody>
</table>
</form>
<div class="container ">
<div id="pagination-wrapper"></div>
</div>
</div>
</div>
</div>
</section>
<hr>
</div>
<div class="column">
<hr>
<div>
<br>If you are keen to use the mocking service with bigger amount of messages or automate the process by inserting
high amount of random messages please consider using the tools below:
<br><a href="http://[[${localhost}]]:8097/swagger-ui.html">http://[[${localhost}]]:8097/swagger-ui.html</a>
<br>
<form action="#" th:action="@{/home/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}" method="post">
<table>
<thead>
<tr>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-0">#</p>
</th>
<th class="tr-pageable">
<p class="btn-sort active" id="btn-sort-1">MessageId</p>
</th>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-2">Media Type</p>
</th>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-3">Http Status</p>
</th>
</tr>
</thead>
<input type="text" th:field="*{clientUUID}" hidden/>
<tbody id="table-body">
</tbody>
</table>
</form>
<div class="container ">
<div id="pagination-wrapper"></div>
</div>
<br>http://[[${localhost}]]:8097/klaus/v1/delete/[[${mockedMessageDto.clientUUID}]]/{mockedResponseId}
<br>http://[[${localhost}]]:8097/klaus/v1/set/[[${mockedMessageDto.clientUUID}]]/{mockedResponseId}?httpStatus={httpStatus}
<br>http://[[${localhost}]]:8097/klaus/v1/get/[[${mockedMessageDto.clientUUID}]]/{mockedResponseId}
<br>http://[[${localhost}]]:8097/klaus/v1/getAll/[[${mockedMessageDto.clientUUID}]]
</div>
<hr>
</div>
</div>
</div>
</section>
<hr>
<div id="foot"></div>
</div>
<hr>
<div>
<br>If you are keen to use the mocking service with bigger amount of messages or automate the process by inserting high amount of random messages please consider using the tools below:
<br><a href="http://[[${localhost}]]:8097/swagger-ui.html">http://[[${localhost}]]:8097/swagger-ui.html</a>
<br>
<br>http://[[${localhost}]]:8097/klaus/v1/delete/[[${mockedMessageDto.clientUUID}]]/{mockedResponseId}
<br>http://[[${localhost}]]:8097/klaus/v1/set/[[${mockedMessageDto.clientUUID}]]/{mockedResponseId}?httpStatus={httpStatus}
<br>http://[[${localhost}]]:8097/klaus/v1/get/[[${mockedMessageDto.clientUUID}]]/{mockedResponseId}
<br>http://[[${localhost}]]:8097/klaus/v1/getAll/[[${mockedMessageDto.clientUUID}]]
</div>
<hr>
<hr>
</div>
</div>
<script type="text/javascript" th:inline="javascript">
var listForPagination = /*[[${mockedMessageDtoList}]]*/;
</script>
<script src="/js/paggination.js"></script>
<script>
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/navbar.html", function(data){
$("#header").html(data);
});
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/sidebar.html", function(data){
$("#sidebar").html(data);
});
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/footer.html", function(data){
$("#foot").html(data);
});
</script>
</body>
</html>