Deleted target dir.

This commit is contained in:
2023-01-12 13:14:49 +01:00
parent d39380d032
commit 7ed15e4274
49 changed files with 0 additions and 1172 deletions

View File

@@ -1,7 +0,0 @@
#environment:
server.port = 8097
spring.application.name = klaus
spring.mvc.view.suffix=.html
logging.level.root=INFO
logging.level.org.springframework.web=INFO
logging.level.com.release11=INFO

View File

@@ -1,2 +0,0 @@
redis.host = localhost
redis.port = 6379

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<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>localhost</host>
<port>6379</port>
<key>logstash</key>
<layout class="ch.qos.logback.classic.PatternLayout">
<!--https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html-->
<Pattern>
{"dateTimeStamp" : "%d{yyyy-MM-dd}T%d{HH:mm:ss}", "eventId":"%X{eventId}", "interfaceName":"%X{interfaceName}", "clientUUID":"%X{clientUUID}", "messageId":"%X{messageId}", "thread":"%t","level":"%-5level", "message":"%msg"}%n
</Pattern>
</layout>
</appender>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="LOGSTASH" />
</appender>
<root level="DEBUG">
<appender-ref ref="ASYNC" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</configuration>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2021 by original authors @ fontello.com</metadata>
<defs>
<font id="fontello" horiz-adv-x="1000" >
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="plus" unicode="&#xe801;" d="M786 439v-107q0-22-16-38t-38-15h-232v-233q0-22-16-37t-38-16h-107q-22 0-38 16t-15 37v233h-232q-23 0-38 15t-16 38v107q0 23 16 38t38 16h232v232q0 22 15 38t38 16h107q23 0 38-16t16-38v-232h232q23 0 38-16t16-38z" horiz-adv-x="785.7" />
<glyph glyph-name="cancel" unicode="&#xe802;" d="M724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,59 +0,0 @@
@font-face {
font-family: 'fontello';
src: url('font/fontello.eot?49304387');
src: url('font/fontello.eot?49304387#iefix') format('embedded-opentype'),
url('font/fontello.woff2?49304387') format('woff2'),
url('font/fontello.woff?49304387') format('woff'),
url('font/fontello.ttf?49304387') format('truetype'),
url('font/fontello.svg?49304387#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?49304387#fontello') format('svg');
}
}
*/
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "fontello";
font-style: normal;
font-weight: normal;
speak: never;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.icon-plus:before { content: '\e801'; } /* '' */
.icon-cancel:before { content: '\e802'; } /* '' */

View File

@@ -1,4 +0,0 @@
.overflowedTableContent {
max-height: 750px;
overflow: scroll;
}

View File

@@ -1,249 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<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>
<body>
<div class="container">
<div class="tool extended">
<div class="tool-context">
<div>
<h1>MockedServices <span class="version-span">v1.0.0</span></h1>
</div>
<div>
<!-- h2 -->
<div id="basicItemData" class="hiddable active"><h2>Your Message</h2></div>
<div id="advancedItemData" class="hiddable"><h2>Messaged id: <span id="mockedMessageId">1</span></h2></div>
<!-- save -->
<div>
<!-- <button class="action-button active large-button small-vertical-margin">Save</button> -->
</div>
<!-- link -->
<div>
<label for="messageLink" class="block-display">Link</label>
<div id="messageLink" class="bordered-field max-width with-padding disabled-background"><a class="hyperlink" href="www.google.com" target="_blank">www.google.com</a></div>
<!-- <input id="messageLink" disabled class="bordered-field max-width with-padding" value="http://yourlink.com/r/api/mock/blablabla"> -->
</div>
<div class="display-space-between max-width">
<!-- status and type -->
<div class="medium-input block-display small-vertical-margin">
<!-- status -->
<div class="max-width small-vertical-margin">
<label for="httpStatus">Http Status</label>
<input id="httpStatus" class="bordered-field max-width data-field" type="text" value="200" list="httpStatusSuggestion">
<datalist id="httpStatusSuggestion">
<option value="200">
<option value="300">
<option value="400">
<option value="403">
<option value="404">
<option value="500">
</datalist>
</div>
<!-- content type -->
<div class="max-width small-vertical-margin">
<label for="typeSelector">Content Type</label>
<input id="typeSelector" class="bordered-field max-width data-field" type="text" value="application/xml" list="contentTypes">
<datalist id="contentTypes">
<option value="application/xml">
<option value="application/json">
<option value="text/xml">
</datalist>
</div>
</div>
<button id="btn-save" class="small-margins half-width with-padding action-button">Save</button>
</div>
<!-- body -->
<div class="small-vertical-margin">
<label for="bodyEditor">Body</label>
<textarea id="bodyEditor" class="data-field bordered-field max-width with-padding height-300 vertically-resizeable"></textarea>
</div>
<!-- show/hide -->
<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 -->
<div class="tabmenu medium-vertical-margin">
<button id="headersTab" class="tabitem active clickable-text big-font">Headers</button>
<button id="historyTab" class="tabitem clickable-text big-font">History</button>
</div>
<!-- container -->
<div class="medium-vertical-margin">
<!-- headers -->
<div id="headers" class="medium-vertical-margin tabcontent active">
<table class="table-map">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th></th>
</tr>
</thead>
<tbody id="headerMapTable">
<tr>
<td><input class="key" value="basic value"></td>
<td><input value="basic value"></td>
<td><button class="modification-button btn-hashmap"><i class="icon-cancel"></i></button></td>
</tr>
</tbody>
<tr>
<td><input id="headerKeyInput" placeholder="name"></td>
<td><input id="headerValueInput" placeholder="value"></td>
<td><button id="btn-newRow" class="modification-button btn-add"><i class="icon-plus"></i></button></td>
</tr>
</table>
</div>
<!-- history -->
<div id="history" class="medium-vertical-margin tabcontent">
<div class="block-display max-width">
<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>
<input id="historyFrom" type="date" class="bordered-field max-width with-padding">
<input id="historyTimeFrom" type="time" class="small-vertical-margin bordered-field max-width with-padding">
</div>
<div class="block-display half-width with-padding">
<label for="historyTo" class="block-label">To</label>
<input id="historyTo" type="date" class="bordered-field max-width with-padding">
<input id="historyTimeTo" type="time" class="small-vertical-margin bordered-field max-width with-padding">
</div>
</div>
<button id="btn-searchHistory" class="quater-width action-button active small-margins">Search</button>
</div>
<div class="max-width centered-content large-vertical-margin overflowedTableContent">
<table id="historyTable" class="table-default">
<thead>
<tr class="bottom-border">
<th>Timestamp</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<!-- <tr class="even">
<td>2021-01-01T10:57:26</td>
<td>Client request</td>
</tr>
<tr>
<td>2021-01-01T10:57:26</td>
<td>Client request</td>
</tr> -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="selectMenuContent" class="tool-extention">
<!-- header -->
<div>
<h2>Message List</h2>
</div>
<!-- tile list -->
<div id="listItems">
<!-- <div class="tile">
<div class="content">
<div class="display-space-between">
<div class="centered-vertically">
<p>Id: 2</p>
<p>Status: 200</p>
</div>
<div>
<button id="test1" class="modification-button btn-tile"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div> -->
</div>
<div class="max-width centered-content small-vertical-margin">
<button id="btn-newtile" class="modification-button btn-addtile"><i class="icon-plus"></i></button>
</div>
</div>
</div>
<div class="tooltip-window lite">
<div>
<h2>What's this?</h2>
<p>MockedServices is a tool that allows developer to create, in easy and simple way, http server mocked endpoints for integration tests.</p>
<h2>Help</h2>
<p>When cursor hovers over an item. It's description is displayed below.</p>
<div class="large-vertical-margin">
<div id="messageLinkTip" class="tip">
<h3>Link</h3>
<p>Link is an url representing an endpoint at which you can receive your mocked response by simply sending get request.</p>
</div>
</div>
<div class="large-vertical-margin">
<div id="httpStatusTip" class="tip">
<h3>Http Status</h3>
<p>Value of the field is corresponding to status value that server will return.</p>
</div>
</div>
<div class="large-vertical-margin">
<div id="typeSelectorTip" class="tip">
<h3>Content Type</h3>
<p>Value of the field describes content of body payload contained in the response. For example if content is in xml format the value should be "application/xml" or "text/xml"</p>
</div>
</div>
<div class="large-vertical-margin">
<div id="bodyEditorTip" class="tip">
<h3>Body</h3>
<p>Value of the field describes content of response body. It's basicly the message we want server to return. If it's simple response like 200 OK or 404 not found then field might be left empty.</p>
</div>
</div>
<div class="large-vertical-margin">
<div id="headersTabTip" class="tip">
<h3>Headers</h3>
<p>Content of this tab allows to set and modify headers that will be included in the response.</p>
</div>
</div>
<div class="large-vertical-margin">
<div id="historyTabTip" class="tip">
<h3>History</h3>
<p>Content of this tab displays the history of requests or responses received/sent to the endpoint</p>
</div>
</div>
<div class="large-vertical-margin">
<div id="newHeaderTip" class="tip">
<h3>New header</h3>
<p>Insert value in the field and press the plus icon to add a new header to the message.</p>
</div>
</div>
</div>
</div>
</div>
<div id="overlay"></div>
<div id="modal-confirm" class="modal">
<div class="header">
<div>Message saved<i class="r-exclamation"></i></div>
<button>&times;</button>
</div>
<div class="body">Your message has been successfuly saved.<br>You might view it under the link.</div>
</div>
<div id="modal-query" class="modal">
<div class="header">
<div>Unsaved data<i class="r-exclamation"></i></div>
<button>&times;</button>
</div>
<div class="body">You haven't saved your message! Any changes will be lost.<br>Do you want to continue?</div>
<div class="function">
<button>Yes</button>
<button>No</button>
</div>
</div>
<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>
<script type="text/javascript" src="/js/fiddle.js"></script>
</body>
</html>

View File

@@ -1,421 +0,0 @@
var clientUUID = '';
var advancedDisplayed = false;
var json = {};
var jsonIndex = 0;
var lastId = 1;
var htable_row = 0;
var host = getDomain();
var dataModified = false;
const addMessageName = 'addMessage';
const loadMessageName = 'changeMessage';
const removeMessageName = 'removeMessage';
const C_UUID = 'mock-uuid';
const C_ID = 'last-displayed-id';
const C_ADV = 'advanced-mode';
const setModified = function(){
setDataModified();
}
const setOrigin = function(){
setDataOrigin();
}
const getUpdate = function(){
updateData();
}
const dataRefresh = function(){
getData();
}
$('#btn-newtile').click(function(){callAddMessage()});
// $('#btn-addRow').click(function(){addRow()});
// $('#btn-save').click(getUpdate);
function getData(){
$.getJSON(host + '/api/mock/'+clientUUID, function(data) {
json = data;
checkUuid();
console.log(JSON.stringify(json));
console.log("Json received");
refreshData();
});
}
function checkUuid(){
if(clientUUID == null || clientUUID == undefined || clientUUID == ''){
clientUUID = json[0].clientUUID;
setCookie();
}
}
function getDomain(){
var url = window.location.href;
var arr = url.split("/");
var result = arr[0] + "//" + arr[2];
return result;
}
function setDataModified(){
if(dataModified) return;
dataModified = true;
$('#btn-save').addClass('active');
$('#btn-save').click(getUpdate);
}
//Adding change listener to fields
$('.data-field').change(setModified);
function setDataOrigin(){
dataModified = false;
$('#btn-save').removeClass('active');
$('#btn-save').off();
}
const idToDisplay = function(){
let defaultId = json[0].mockedResponseId;
if(lastId == undefined || lastId == null) return defaultId;
for(let i=0; i<json.length; i++){
if(json[i].mockedResponseId == lastId){
return lastId;
}
}
if(jsonIndex <= json.length && jsonIndex > 0){
jsonIndex -= 1;
return json[jsonIndex].mockedResponseId;
}
return defaultId;
}
function refreshData(){
fillMessageList();
console.log("List initiated");
let id = idToDisplay();
console.log('Loading message of id: ' + id);
loadMessage(id);
console.log("Message loaded");
}
function setCookie(){
document.cookie = C_UUID + '=' +clientUUID;
document.cookie = C_ID + '=' + lastId;
document.cookie = C_ADV + '=' + advancedVisibility;
}
function loadCookies(){
clientUUID = getCookie(C_UUID);
lastId = getCookie(C_ID);
advancedDisplayed = getCookie(C_ADV) == 'true';
}
function getCookie(cname) {
var name = cname + '=';
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return '';
}
function callMethodByName(methodObject){
let name = methodObject.name;
let id = methodObject.id;
switch(name){
case addMessageName:
addMessage();
break;
case loadMessageName:
loadMessage(id);
break;
case removeMessageName:
removeMessage(id);
break;
}
}
function updateData(){
var updatedJson = generateJson();
const dataSaved = function () {
setDataOrigin();
refreshData();
savedModalDisplay();
}
$.ajax({
url: host + '/api/mock',
type: 'PUT',
data: JSON.stringify(updatedJson, null, 2),
contentType: "application/json",
}).done(dataSaved);
}
function callAddMessage(){
if(dataModified){
setMethodToCall(addMessageName, null);
dataLossModalDisplay();
}
else {
addMessage();
}
}
function addMessage(){
$.ajax({
url: host + '/api/mock/'+clientUUID,
type: 'POST',
}).done(dataRefresh);
}
function callRemoveMessage(id){
if(dataModified){
setMethodToCall(removeMessageName, id);
dataLossModalDisplay();
}
else {
removeMessage(id);
}
}
function removeMessage(id){
var jsonObject = findJsonById(id);
$.ajax({
url: host + '/api/mock/'+clientUUID + '/' + id,
type: 'DELETE',
}).done(dataRefresh);
}
function clearMock(){
fillStaticFields('','','','');
htable_row = 0;
$('#httpStatusValues').html('');
}
function initializeMock(index){
clearMock();
fillStaticFields(json[index].clientUUID
, json[index].mockedResponseId
, json[index].mediaType
, json[index].messageBody
, json[index].httpStatus);
fillHeaderTable(json[index].httpHeaders);
}
function fillStaticFields(uuid, id, mediaType, body, httpStatus){
let link = createLink(uuid,id);
let linkHtml = '<a class="hyperlink" target="_blank" href="'+link+'">'+link+'</a>';
$('#messageLink').html(linkHtml);
$('#httpStatus').val(httpStatus);
$('#typeSelector').val(mediaType);
$('#bodyEditor').val(body);
$('#mockedMessageId').html(id);
}
function createLink(uuid, id){
var link = host + '/api/mock/r/'+uuid+'/'+id;
return link;
}
function fillHeaderTable(headers){
var innerHTML = buildHeaderMapHtml(headers);
refreshHeaderTable(innerHTML);
}
function refreshHeaderTable(html){
$('#headerMapTable').html(html);
$('.table-map').change(function(){setDataModified()});
$('.btn-hashmap').click(function(){
$(this).closest('tr').remove();
setDataModified();
})
}
function buildHeaderMapHtml(headers){
var innerHTML = '';
for(var key in headers){
innerHTML += buildRowHtml(key, headers[key]);
}
return innerHTML;
}
function addRow(key, value){
var headerMap = $('#headerMapTable');
var headersMapHtml = headerMap.html();
headersMapHtml += buildRowHtml(key, value);
refreshHeaderTable(headersMapHtml);
}
const newRowInput = function(){
const hName = $('#headerKeyInput');
const hValue = $('#headerValueInput');
if(checkIfInputValid(hName.val()) && checkIfInputValid(hValue.val())){
addRow(hName.val(), hValue.val());
hName.val(null);
hValue.val(null);
setDataModified();
}
}
$('#btn-newRow').click(newRowInput);
function checkIfInputValid(input){
return !(input == '' || input == null || input == undefined);
}
function buildRowHtml(key, value){
return '' +
'<tr>' +
'<td><input class="key data-field" value="' + key + '"></td>' +
'<td><input class="data-field" value="' + value + '"></td>' +
'<td><button class="modification-button btn-hashmap"><i class="icon-cancel"></i></button></td>' +
'</tr>';
}
function fillMessageList(){
$("#listItems").html('');
var innerHTML = '';
for(let i=0; i<json.length; i++){
innerHTML += generateMessageTileHtml(json[i].mockedResponseId, json[i].httpStatus, json[i].mediaType);
}
$("#listItems").append(innerHTML);
$('.tile').click(function(e) {
var element = $(this);
var button = element.find('.btn-tile').children().get(0);
console.log(button == e.target);
if(!(button == e.target)){
console.log("Button is not a target. Loading message.")
callLoadMessage(parseInt($(this).attr('tileid')));
}
});
$('.btn-tile').click(function(){
// console.log(this);
callRemoveMessage($(this).closest('.tile').attr('tileId'));
})
}
function findJsonById(id){
return json[findJsonIndexById(id)];
}
function findJsonIndexById(id){
for(let i=0; i<json.length; i++)
if(id == json[i].mockedResponseId) return i;
}
function callLoadMessage(id){
if(dataModified) {
setMethodToCall(loadMessageName, id);
dataLossModalDisplay();
}
else {
loadMessage(id);
}
}
function loadMessage(id){
if(id == null || id == undefined){
console.log('id is null');
return;
}
lastId = id;
setCookie();
setDataOrigin();
for(let i=0; i<json.length; i++){
console.log('id == ' + id + ' mockedId == ' + json[i].mockedResponseId);
if(id == json[i].mockedResponseId){
jsonIndex = i;
console.log("Message found");
initializeMock(jsonIndex);
console.log("Fields initialized");
selectMessage(id);
console.log("Selection complete");
return;
}
}
console.log("Message not found");
}
function selectMessage(id){
const tiles = $('.tile');
console.log("Selecting message...");
tiles.removeClass("active");
console.log("Selected message deselected");
$('.tile[tileid="'+id+'"]').addClass("active");
console.log("Selected message selected");
}
function generateMessageTileHtml(id, httpStatus, mediaType){
var innerHTML = '' +
'<div tileid="' + id + '" class="tile">' +
'<div class="content">' +
'<div class="display-space-between">' +
'<div class="centered-vertically">' +
'<p>Id: ' + id + '</p>' +
'<p>Status: ' + httpStatus + '</p>' +
'</div>' +
'<div>' +
'<button class="modification-button btn-tile"><i class="icon-cancel"></i></button>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
return innerHTML;
}
const onbuild = function(){
loadCookies();
getData();
if(advancedDisplayed) {
changeAdvancedVisibility();
}
}
$(document).ready(onbuild);
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function generateJson(){
var newJson =
{
clientUUID: json[jsonIndex].clientUUID,
mockedResponseId: json[jsonIndex].mockedResponseId,
mediaType: $('#typeSelector').val(),
messageBody: $('#bodyEditor').val(),
httpStatus: $('#httpStatus').val(),
httpHeaders: {},
};
newJson['httpHeaders'] = convertTableToJson();
console.log(JSON.stringify(newJson, null, 2));
json[jsonIndex] = newJson;
return newJson;
}
function convertTableToJson(){
const rows = $('#headerMapTable').children();
console.log("Rows: "+rows.length);
var obj = {};
var key;
for(let i=0; i<rows.length; i++){
key = rows.eq(i).children().eq(0).children().eq(0).val();
obj[key] = rows.eq(i).children().eq(1).children().eq(0).val();
}
return obj;
}

View File

@@ -1,5 +0,0 @@
const deleteParent = function(){
$(this).closest('div.tile').remove();
}
$('#test1').click(deleteParent);

View File

@@ -1,77 +0,0 @@
var historyJson = {};
const maxIterations = 200;
function filterHistory(){
var dateFrom = new Date($('#historyFrom').val() + 'T' + $('#historyTimeFrom').val());
console.log(dateFrom);
var dateTo = new Date($('#historyTo').val() + 'T' + $('#historyTimeTo').val());
console.log(dateTo);
// var dateFrom = new Date();
// var dateTo = new Date();
// var timeFrom = new Date();
// var timeTo = new Date();
// dateFrom = Date.parse($('#historyFrom').val());
// console.log(dateFrom);
// dateTo = Date.parse($('#historyTo').val());
// console.log(dateTo);
// timeFrom = Date.parse($('#historyTimeFrom').val());
// console.log(timeFrom);
// timeTo = Date.parse($('#historyToFrom').val());
// console.log(timeTo);
// dateFrom.setTime(timeFrom);
// console.log(dateFrom);
// dateTo.setTime(timeTo);
// console.log(dateTo);
loadHistory(dateFrom, dateTo);
}
const startSearch = function(){
filterHistory();
}
$('#btn-searchHistory').click(startSearch);
function loadHistory(dateFrom, dateTo){
console.log('Request send for history data')
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){
historyJson = data;
displayHistory();
});
}
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;
for(let i=0; i<iterations; i++){
let style = i%2==0 ? ' class="even"' : '';
innerHTML += '<tr' + style + '>' +
'<td>' + historyJson[i].dateTimeStamp + '</td>' +
'<td>' + historyJson[i].interfaceName + '</td>' +
'</tr>';
}
return innerHTML;
}
function displayHistory(){
$('#historyTable tbody').html(historyToHtml());
}

View File

@@ -1,54 +0,0 @@
var modalDisplayed = false;
var methodToCall = {
name: null,
id: null
};
const overlay = $('#overlay');
const savedModal = $('#modal-confirm');
const dataLossModal = $('#modal-query');
const dataLossModalYes = dataLossModal.children().eq(2).children().eq(0);
const dataLossModalNo = dataLossModal.children().eq(2).children().eq(1);
const allModals = $('.modal');
const btnModalClose = $('.modal button');
const closeModals = function() {
hideModal(allModals);
}
const savedModalDisplay = function() {
console.log('SavedModal displayed');
showModal(savedModal);
setTimeout(closeModals, 2000);
}
const dataLossModalDisplay = function(){
showModal(dataLossModal);
}
function setMethodToCall(name, id){
methodToCall.name = name;
methodToCall.id = id;
}
const dropChangesAndClose = function(){
callMethodByName(methodToCall)
hideModal(dataLossModal);
}
function showModal(jmodal){
if(modalDisplayed) return;
overlay.addClass('active');
jmodal.addClass('active');
modalDisplayed = true;
}
function hideModal(jmodal){
if(!modalDisplayed) return;
overlay.removeClass('active');
jmodal.removeClass('active');
modalDisplayed = false;
}
btnModalClose.click(closeModals);
overlay.click(closeModals);
dataLossModalNo.click(closeModals);
dataLossModalYes.click(dropChangesAndClose);

View File

@@ -1,116 +0,0 @@
var advancedVisibility = false;
var selectMenu = $("#selectMenuContent");
var advancedTab = $("#advanced");
var basicID = $("#basicItemData")
var advancedID = $("#advancedItemData");
var focusedField = false;
function changeAdvancedVisibility(){
if(advancedVisibility){
selectMenu.removeClass('active');
advancedTab.removeClass('active');
advancedID.removeClass('active');
basicID.addClass('active');
advancedVisibility = false;
}
else {
selectMenu.addClass('active');
advancedTab.addClass('active');
advancedID.addClass('active');
basicID.removeClass('active');
advancedVisibility = true;
}
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(){
$('#headersTab').click(showHeaders);
tabitem.removeClass('active');
$('.tabcontent').removeClass('active');
$('#history').addClass('active');
$('#historyTab').addClass('active');
$('#historyTab').off('click');
initializeHistory();
}
function initializeHistory(){
historyFilter.removeClass('active');
getLast24hHistoryData();
}
function showHeaders(){
$('#historyTab').click(showHistory);
tabitem.removeClass('active');
$('.tabcontent').removeClass('active');
$('#headers').addClass('active');
$('#headersTab').addClass('active');
$('#headersTab').off('click');
}
function focusInTip(element){
showTip(element);
focusedField = true;
}
function focusOutTip(element){
focusedField = false;
hidTip(element);
}
function hidTip(element){
if(focusedField) return;
$('#'+element).removeClass('active');
}
function showTip(element){
if(focusedField) return;
$('.tip').removeClass('active');
$('#'+element).addClass('active');
}
$('#messageLink').mouseover(function(){showTip('messageLinkTip')});
$('#messageLink').mouseleave(function(){hidTip('messageLinkTip')});
$('#httpStatus').mouseover(function(){showTip('httpStatusTip')});
$('#httpStatus').focusin(function(){focusInTip('httpStatusTip')});
$('#httpStatus').mouseleave(function(){hidTip('httpStatusTip')});
$('#httpStatus').focusout(function(){focusOutTip('httpStatusTip')});
$('#typeSelector').mouseover(function(){showTip('typeSelectorTip')});
$('#typeSelector').focusin(function(){focusInTip('typeSelectorTip')});
$('#typeSelector').mouseleave(function(){hidTip('typeSelectorTip')});
$('#typeSelector').focusout(function(){focusOutTip('typeSelectorTip')});
$('#bodyEditor').mouseover(function(){showTip('bodyEditorTip')});
$('#bodyEditor').focusin(function(){focusInTip('bodyEditorTip')});
$('#bodyEditor').mouseleave(function(){hidTip('bodyEditorTip')});
$('#bodyEditor').focusout(function(){focusOutTip('bodyEditorTip')});
$('#headersTab').mouseover(function(){showTip('headersTabTip')});
$('#headersTab').mouseleave(function(){hidTip('headersTabTip')});
$('#historyTab').mouseover(function(){showTip('historyTabTip')});
$('#historyTab').mouseleave(function(){hidTip('historyTabTip')});
$('#headerKeyInput').mouseover(function(){showTip('newHeaderTip')});
$('#headerKeyInput').focusin(function(){focusInTip('newHeaderTip')});
$('#headerKeyInput').mouseleave(function(){hidTip('newHeaderTip')});
$('#headerKeyInput').focusout(function(){focusOutTip('newHeaderTip')});
$('#headerValueInput').mouseover(function(){showTip('newHeaderTip')});
$('#headerValueInput').focusin(function(){focusInTip('newHeaderTip')});
$('#headerValueInput').mouseleave(function(){hidTip('newHeaderTip')});
$('#headerValueInput').focusout(function(){focusOutTip('newHeaderTip')});

View File

@@ -1,12 +0,0 @@
{
"clientUUID": "9bfddcc1-ef89-4c53-84e8-c88f13ecc7ec",
"mockedResponseId": 1,
"mediaType": "application/xml",
"messageBody": "\n\n Tove\n Jani\n Reminder\n Don't forget me this weekend!\n",
"httpStatus": "200",
"httpHeaders": {
"Keep-Alive": "timeout=60",
"Connection": "keep-alive",
"Date": "2021-02-02T12:15:22.164035"
}
}

View File

@@ -1,12 +0,0 @@
{
"clientUUID": "acc39106-f351-46bb-b81b-31b860af3e56",
"mockedResponseId": 1,
"mediaType": "text/xml",
"messageBody": "Hello world",
"httpHeaders": {
"Keep-Alive": "timeout=60",
"Connection": "keep-alive",
"Date": "2021-01-27T15:45:05.892356"
},
"httpStatus": 200
}

View File

@@ -1,62 +0,0 @@
package com.release11.klaus.mappers;
import com.release11.klaus.model.MockedMessage;
import com.release11.klaus.model.MockedMessageDto;
import com.release11.klaus.model.MockedMessageDto.MockedMessageDtoBuilder;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2021-04-27T12:11:44+0200",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 14.0.1 (Oracle Corporation)"
)
@Component
public class MockedMessageMapperImpl implements MockedMessageMapper {
@Override
public MockedMessage mockedMessageDtoToMockedMessage(MockedMessageDto mockedMessageDto) {
if ( mockedMessageDto == null ) {
return null;
}
MockedMessage mockedMessage = new MockedMessage();
mockedMessage.setClientUUID( mockedMessageDto.getClientUUID() );
mockedMessage.setMockedResponseId( mockedMessageDto.getMockedResponseId() );
mockedMessage.setMediaType( mockedMessageDto.getMediaType() );
mockedMessage.setMessageBody( mockedMessageDto.getMessageBody() );
Map<String, String> map = mockedMessageDto.getHttpHeaders();
if ( map != null ) {
mockedMessage.setHttpHeaders( new HashMap<String, String>( map ) );
}
mockedMessage.setHttpStatus( mockedMessageDto.getHttpStatus() );
mockedMessage.setCompositePrimaryKey( mockedMessageDto.getClientUUID() + "_" + mockedMessageDto.getMockedResponseId() );
return mockedMessage;
}
@Override
public MockedMessageDto mockedMessageToMockedMessageDto(MockedMessage mockedMessage) {
if ( mockedMessage == null ) {
return null;
}
MockedMessageDtoBuilder mockedMessageDto = MockedMessageDto.builder();
mockedMessageDto.clientUUID( mockedMessage.getClientUUID() );
mockedMessageDto.mockedResponseId( mockedMessage.getMockedResponseId() );
mockedMessageDto.mediaType( mockedMessage.getMediaType() );
mockedMessageDto.messageBody( mockedMessage.getMessageBody() );
Map<String, String> map = mockedMessage.getHttpHeaders();
if ( map != null ) {
mockedMessageDto.httpHeaders( new HashMap<String, String>( map ) );
}
mockedMessageDto.httpStatus( mockedMessage.getHttpStatus() );
return mockedMessageDto.build();
}
}

View File

@@ -1,28 +0,0 @@
com\release11\klaus\mappers\MockedMessageMapperImpl.class
com\release11\klaus\model\Event$EventBuilder.class
com\release11\klaus\model\Event.class
com\release11\klaus\service\KlausServiceImpl.class
com\release11\klaus\KlausApplication.class
com\release11\klaus\repository\MockedResponseRepository.class
com\release11\klaus\repository\EventRepositoryImpl.class
com\release11\klaus\mappers\MockedMessageMapper.class
com\release11\klaus\controller\MockController.class
com\release11\klaus\service\KlausService.class
com\release11\klaus\service\EtrackService.class
com\release11\klaus\model\MockedMessageDto.class
com\release11\klaus\model\constraints\HttpCodeValidation.class
com\release11\klaus\utilis\RedisAppender.class
com\release11\klaus\model\MockedMessageDto$MockedMessageDtoBuilder.class
com\release11\klaus\config\RedisConfig.class
com\release11\klaus\model\MockedMessage.class
com\release11\klaus\controller\MvcExceptionHandler.class
com\release11\klaus\config\SpringFoxConfig.class
com\release11\klaus\model\EventRequestDto$EventRequestDtoBuilder.class
com\release11\klaus\model\EventRequestDto.class
com\release11\klaus\utilis\BusinessKey.class
com\release11\klaus\controller\EventController.class
com\release11\klaus\utilis\TrackingClient.class
com\release11\klaus\service\EtrackServiceImpl.class
com\release11\klaus\controller\MainController.class
com\release11\klaus\repository\EventRepository.class
com\release11\klaus\model\constraints\HttpCode.class

View File

@@ -1,24 +0,0 @@
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\config\RedisConfig.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\service\KlausService.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\utilis\TrackingClient.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\model\Event.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\controller\MainController.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\repository\MockedResponseRepository.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\service\EtrackServiceImpl.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\repository\EventRepository.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\mappers\MockedMessageMapper.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\config\SpringFoxConfig.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\model\MockedMessageDto.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\service\EtrackService.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\service\KlausServiceImpl.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\controller\MockController.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\controller\MvcExceptionHandler.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\utilis\RedisAppender.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\controller\EventController.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\model\constraints\HttpCode.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\utilis\BusinessKey.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\KlausApplication.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\model\MockedMessage.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\repository\EventRepositoryImpl.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\model\EventRequestDto.java
C:\Users\Gabriel Modzelewski\.phabricator\mockedservices\src\main\java\com\release11\klaus\model\constraints\HttpCodeValidation.java