T157 json created based on the data

This commit is contained in:
2021-02-01 18:38:28 +01:00
parent 4e5479de80
commit c4b41737c5
3 changed files with 45 additions and 11 deletions

17
.idea/workspace.xml generated
View File

@@ -22,6 +22,7 @@
<list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment=""> <list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/templates/mock.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/mock.html" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -75,7 +76,7 @@
<property name="aspect.path.notification.shown" value="true" /> <property name="aspect.path.notification.shown" value="true" />
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit5" /> <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit5" />
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit5" value="" /> <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit5" value="" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/resources/static" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="restartRequiresConfirmation" value="false" /> <property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> <property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
</component> </component>
@@ -190,7 +191,7 @@
<configuration name="allTests" type="JUnit" factoryName="JUnit"> <configuration name="allTests" type="JUnit" factoryName="JUnit">
<useClassPathOnly /> <useClassPathOnly />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="$PROJECT_DIR$/../../../../Program Files/Java/jdk-14.0.1" /> <option name="ALTERNATIVE_JRE_PATH" value="P:/../../Program Files/Java/jdk-14.0.1" />
<option name="PACKAGE_NAME" value="" /> <option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" /> <option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
@@ -204,7 +205,7 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="JetRunConfigurationType"> <configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<module name="eureka" /> <module name="eureka" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" /> <option name="PROGRAM_PARAMETERS" />
@@ -217,7 +218,7 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType"> <configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
<module name="eureka" /> <module name="eureka" />
<option name="filePath" /> <option name="filePath" />
<option name="vmParameters" /> <option name="vmParameters" />
@@ -306,6 +307,7 @@
<workItem from="1611757446709" duration="6743000" /> <workItem from="1611757446709" duration="6743000" />
<workItem from="1611826821050" duration="10679000" /> <workItem from="1611826821050" duration="10679000" />
<workItem from="1611915874625" duration="15194000" /> <workItem from="1611915874625" duration="15194000" />
<workItem from="1612178634549" duration="12858000" />
</task> </task>
<task id="LOCAL-00077" summary="testing jenkins docker"> <task id="LOCAL-00077" summary="testing jenkins docker">
<created>1601453886631</created> <created>1601453886631</created>
@@ -654,7 +656,7 @@
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" /> <option name="version" value="1" />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
<option featureType="com.intellij.fileTypeFactory" implementationName="*.js" /> <option featureType="com.intellij.fileTypeFactory" implementationName="*.js" />
@@ -664,12 +666,13 @@
<map> <map>
<entry key="MAIN"> <entry key="MAIN">
<value> <value>
<State /> <State>
<option name="COLUMN_ORDER" />
</State>
</value> </value>
</entry> </entry>
</map> </map>
</option> </option>
<option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />

View File

@@ -1,12 +1,14 @@
var json; var json;
var jsonIndex = 0;
function getData(uuid){ function getData(uuid){
$.getJSON('http://localhost:8097/mock/json', function(data) { $.getJSON('http://localhost:8097/mock/json', function(data) {
json = data; json = data;
console.log("Json received"); console.log("Json received");
fillMessageList(); fillMessageList();
console.log("List initiated"); console.log("List initiated");
loadMessage(json[0].mockedResponseId); loadMessage(json[jsonIndex].mockedResponseId);
console.log("Message loaded"); console.log("Message loaded");
// initializeMock(json, 0) // initializeMock(json, 0)
}); });
} }
@@ -83,8 +85,9 @@ function fillMessageList(){
function loadMessage(id){ function loadMessage(id){
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){
jsonIndex = i;
console.log("Message found"); console.log("Message found");
initializeMock(i); initializeMock(jsonIndex);
console.log("Fields initialized"); console.log("Fields initialized");
selectMessage(id); selectMessage(id);
console.log("Selection complete"); console.log("Selection complete");
@@ -115,4 +118,32 @@ function generateMessageTileHtml(id, httpStatus, mediaType){
return innerHTML; return innerHTML;
} }
$(document).ready(getData()); function onbuild(){
getData();
sleep(1000);
// $('#btn-save').bind('click', generateJson);
}
$(document).ready(onbuild());
function sleep(ms) {
return new Promise(resolve => 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));
}

View File

@@ -74,7 +74,7 @@
<div id="history" style="display:none;"></div> <div id="history" style="display:none;"></div>
</div> </div>
<div id="functionBar"> <div id="functionBar">
<button type="submit" class="functionBarButton">Save</button> <button id="btn-save" type="submit" class="functionBarButton" onclick="saveChanges()">Save</button>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
</div> </div>