diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index bc14ec3..a8a2beb 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -22,6 +22,7 @@
+
@@ -75,7 +76,7 @@
-
+
@@ -190,7 +191,7 @@
-
+
@@ -204,7 +205,7 @@
-
+
@@ -217,7 +218,7 @@
-
+
@@ -306,6 +307,7 @@
+
1601453886631
@@ -654,7 +656,7 @@
-
+
@@ -664,12 +666,13 @@
-
diff --git a/src/main/resources/static/js/datatransfer.js b/src/main/resources/static/js/datatransfer.js
index efea6ff..c2f18bf 100644
--- a/src/main/resources/static/js/datatransfer.js
+++ b/src/main/resources/static/js/datatransfer.js
@@ -1,12 +1,14 @@
var json;
+var jsonIndex = 0;
function getData(uuid){
$.getJSON('http://localhost:8097/mock/json', function(data) {
json = data;
console.log("Json received");
fillMessageList();
console.log("List initiated");
- loadMessage(json[0].mockedResponseId);
+ loadMessage(json[jsonIndex].mockedResponseId);
console.log("Message loaded");
+
// initializeMock(json, 0)
});
}
@@ -83,8 +85,9 @@ function fillMessageList(){
function loadMessage(id){
for(let i=0; i setTimeout(resolve, ms));
+}
+
+function saveChanges(){
+ generateJson();
+}
+
+function generateJson(){
+ console.log("Save button click");
+ var newJson =
+ {
+ clientUUID: json[jsonIndex].clientUUID,
+ mockedResponseId: json[jsonIndex].mockedResponseId,
+ mediaType: $('#typeSelector').val(),
+ messageBody: $('#bodyEditor').val(),
+ httpStatus: $('#httpStatus').val(),
+ httpHeaders: {},
+ };
+ document.write(JSON.stringify(newJson, null, 2));
+}
diff --git a/src/main/resources/templates/mock.html b/src/main/resources/templates/mock.html
index ad4f52d..7dee7ee 100644
--- a/src/main/resources/templates/mock.html
+++ b/src/main/resources/templates/mock.html
@@ -74,7 +74,7 @@