T217 issue fixed
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
var clientUUID = '';
|
var clientUUID = '';
|
||||||
var json = {};
|
var json = {};
|
||||||
var jsonIndex = 0;
|
var jsonIndex = 0;
|
||||||
|
var lastId = 1;
|
||||||
var htable_row = 0;
|
var htable_row = 0;
|
||||||
var host = getDomain();
|
var host = getDomain();
|
||||||
var dataModified = false;
|
var dataModified = false;
|
||||||
@@ -25,6 +26,9 @@ const setOrigin = function(){
|
|||||||
const getUpdate = function(){
|
const getUpdate = function(){
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
const dataRefresh = function(){
|
||||||
|
getData();
|
||||||
|
}
|
||||||
$('#iconPlus').click(function(){callAddMessage()});
|
$('#iconPlus').click(function(){callAddMessage()});
|
||||||
$('#btn-addRow').click(function(){addRow()});
|
$('#btn-addRow').click(function(){addRow()});
|
||||||
//TODO remove later save onclick init
|
//TODO remove later save onclick init
|
||||||
@@ -34,7 +38,7 @@ function getData(){
|
|||||||
loadCookies();
|
loadCookies();
|
||||||
$.getJSON(host + '/mock/json/'+clientUUID, function(data) {
|
$.getJSON(host + '/mock/json/'+clientUUID, function(data) {
|
||||||
json = data;
|
json = data;
|
||||||
clientUUID = json[jsonIndex].clientUUID;
|
clientUUID = json[0].clientUUID;
|
||||||
setCookies();
|
setCookies();
|
||||||
console.log(JSON.stringify(json));
|
console.log(JSON.stringify(json));
|
||||||
console.log("Json received");
|
console.log("Json received");
|
||||||
@@ -67,17 +71,33 @@ function setDataOrigin(){
|
|||||||
$('#btn-save').off();
|
$('#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(){
|
function refreshData(){
|
||||||
fillMessageList();
|
fillMessageList();
|
||||||
console.log("List initiated");
|
console.log("List initiated");
|
||||||
loadMessage(json[jsonIndex].mockedResponseId);
|
let id = idToDisplay();
|
||||||
|
console.log('Loading message of id: ' + id);
|
||||||
|
loadMessage(id);
|
||||||
console.log("Message loaded");
|
console.log("Message loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCookies(){
|
function setCookies(){
|
||||||
document.cookie = C_UUID + '=' +clientUUID+';';
|
document.cookie =
|
||||||
|
C_UUID + '=' +clientUUID+';'
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadCookies(){
|
function loadCookies(){
|
||||||
@@ -120,16 +140,15 @@ function updateData(){
|
|||||||
var updatedJson = generateJson();
|
var updatedJson = generateJson();
|
||||||
const dataSaved = function () {
|
const dataSaved = function () {
|
||||||
setDataOrigin();
|
setDataOrigin();
|
||||||
getData();
|
refreshData();
|
||||||
savedModalDisplay();
|
savedModalDisplay();
|
||||||
}
|
}
|
||||||
var request = $.ajax({
|
$.ajax({
|
||||||
url: host + '/mock/json',
|
url: host + '/mock/json',
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: JSON.stringify(updatedJson, null, 2),
|
data: JSON.stringify(updatedJson, null, 2),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
});
|
}).done(dataSaved);
|
||||||
request.done(dataSaved);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function callAddMessage(){
|
function callAddMessage(){
|
||||||
@@ -143,13 +162,10 @@ function callAddMessage(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addMessage(){
|
function addMessage(){
|
||||||
var request = $.ajax({
|
$.ajax({
|
||||||
url: host + '/mock/json/'+clientUUID,
|
url: host + '/mock/json/'+clientUUID,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
});
|
}).done(dataRefresh);
|
||||||
request.done(function () {
|
|
||||||
getData();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function callRemoveMessage(id){
|
function callRemoveMessage(id){
|
||||||
@@ -164,13 +180,10 @@ function callRemoveMessage(id){
|
|||||||
|
|
||||||
function removeMessage(id){
|
function removeMessage(id){
|
||||||
var jsonObject = findJsonById(id);
|
var jsonObject = findJsonById(id);
|
||||||
var request = $.ajax({
|
$.ajax({
|
||||||
url: host + '/mock/json/'+clientUUID + '/' + id,
|
url: host + '/mock/json/'+clientUUID + '/' + id,
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
});
|
}).done(dataRefresh);
|
||||||
request.done(function () {
|
|
||||||
getData();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -300,6 +313,7 @@ function callLoadMessage(id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadMessage(id){
|
function loadMessage(id){
|
||||||
|
lastId = id;
|
||||||
setDataOrigin();
|
setDataOrigin();
|
||||||
for(let i=0; i<json.length; i++){
|
for(let i=0; i<json.length; i++){
|
||||||
if(id == json[i].mockedResponseId){
|
if(id == json[i].mockedResponseId){
|
||||||
@@ -339,12 +353,12 @@ function generateMessageTileHtml(id, httpStatus, mediaType){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onbuild(){
|
const onbuild = function(){
|
||||||
getData();
|
getData();
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(onbuild());
|
$(document).ready(onbuild);
|
||||||
|
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
var clientUUID = '';
|
var clientUUID = '';
|
||||||
var json = {};
|
var json = {};
|
||||||
var jsonIndex = 0;
|
var jsonIndex = 0;
|
||||||
|
var lastId = 1;
|
||||||
var htable_row = 0;
|
var htable_row = 0;
|
||||||
var host = getDomain();
|
var host = getDomain();
|
||||||
var dataModified = false;
|
var dataModified = false;
|
||||||
@@ -25,6 +26,9 @@ const setOrigin = function(){
|
|||||||
const getUpdate = function(){
|
const getUpdate = function(){
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
const dataRefresh = function(){
|
||||||
|
getData();
|
||||||
|
}
|
||||||
$('#iconPlus').click(function(){callAddMessage()});
|
$('#iconPlus').click(function(){callAddMessage()});
|
||||||
$('#btn-addRow').click(function(){addRow()});
|
$('#btn-addRow').click(function(){addRow()});
|
||||||
//TODO remove later save onclick init
|
//TODO remove later save onclick init
|
||||||
@@ -34,7 +38,7 @@ function getData(){
|
|||||||
loadCookies();
|
loadCookies();
|
||||||
$.getJSON(host + '/mock/json/'+clientUUID, function(data) {
|
$.getJSON(host + '/mock/json/'+clientUUID, function(data) {
|
||||||
json = data;
|
json = data;
|
||||||
clientUUID = json[jsonIndex].clientUUID;
|
clientUUID = json[0].clientUUID;
|
||||||
setCookies();
|
setCookies();
|
||||||
console.log(JSON.stringify(json));
|
console.log(JSON.stringify(json));
|
||||||
console.log("Json received");
|
console.log("Json received");
|
||||||
@@ -67,17 +71,33 @@ function setDataOrigin(){
|
|||||||
$('#btn-save').off();
|
$('#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(){
|
function refreshData(){
|
||||||
fillMessageList();
|
fillMessageList();
|
||||||
console.log("List initiated");
|
console.log("List initiated");
|
||||||
loadMessage(json[jsonIndex].mockedResponseId);
|
let id = idToDisplay();
|
||||||
|
console.log('Loading message of id: ' + id);
|
||||||
|
loadMessage(id);
|
||||||
console.log("Message loaded");
|
console.log("Message loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCookies(){
|
function setCookies(){
|
||||||
document.cookie = C_UUID + '=' +clientUUID+';';
|
document.cookie =
|
||||||
|
C_UUID + '=' +clientUUID+';'
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadCookies(){
|
function loadCookies(){
|
||||||
@@ -120,16 +140,15 @@ function updateData(){
|
|||||||
var updatedJson = generateJson();
|
var updatedJson = generateJson();
|
||||||
const dataSaved = function () {
|
const dataSaved = function () {
|
||||||
setDataOrigin();
|
setDataOrigin();
|
||||||
getData();
|
refreshData();
|
||||||
savedModalDisplay();
|
savedModalDisplay();
|
||||||
}
|
}
|
||||||
var request = $.ajax({
|
$.ajax({
|
||||||
url: host + '/mock/json',
|
url: host + '/mock/json',
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: JSON.stringify(updatedJson, null, 2),
|
data: JSON.stringify(updatedJson, null, 2),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
});
|
}).done(dataSaved);
|
||||||
request.done(dataSaved);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function callAddMessage(){
|
function callAddMessage(){
|
||||||
@@ -143,13 +162,10 @@ function callAddMessage(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addMessage(){
|
function addMessage(){
|
||||||
var request = $.ajax({
|
$.ajax({
|
||||||
url: host + '/mock/json/'+clientUUID,
|
url: host + '/mock/json/'+clientUUID,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
});
|
}).done(dataRefresh);
|
||||||
request.done(function () {
|
|
||||||
getData();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function callRemoveMessage(id){
|
function callRemoveMessage(id){
|
||||||
@@ -164,13 +180,10 @@ function callRemoveMessage(id){
|
|||||||
|
|
||||||
function removeMessage(id){
|
function removeMessage(id){
|
||||||
var jsonObject = findJsonById(id);
|
var jsonObject = findJsonById(id);
|
||||||
var request = $.ajax({
|
$.ajax({
|
||||||
url: host + '/mock/json/'+clientUUID + '/' + id,
|
url: host + '/mock/json/'+clientUUID + '/' + id,
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
});
|
}).done(dataRefresh);
|
||||||
request.done(function () {
|
|
||||||
getData();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -300,6 +313,7 @@ function callLoadMessage(id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadMessage(id){
|
function loadMessage(id){
|
||||||
|
lastId = id;
|
||||||
setDataOrigin();
|
setDataOrigin();
|
||||||
for(let i=0; i<json.length; i++){
|
for(let i=0; i<json.length; i++){
|
||||||
if(id == json[i].mockedResponseId){
|
if(id == json[i].mockedResponseId){
|
||||||
@@ -339,12 +353,12 @@ function generateMessageTileHtml(id, httpStatus, mediaType){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onbuild(){
|
const onbuild = function(){
|
||||||
getData();
|
getData();
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(onbuild());
|
$(document).ready(onbuild);
|
||||||
|
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2021-03-02T13:29:47+0100",
|
date = "2021-03-04T12:41:49+0100",
|
||||||
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 14.0.1 (Oracle Corporation)"
|
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 14.0.1 (Oracle Corporation)"
|
||||||
)
|
)
|
||||||
@Component
|
@Component
|
||||||
|
|||||||
Reference in New Issue
Block a user