T157 json created based on the data
This commit is contained in:
		
							
								
								
									
										17
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -22,6 +22,7 @@ | ||||
|     <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$/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> | ||||
|     <option name="SHOW_DIALOG" value="false" /> | ||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||
| @@ -75,7 +76,7 @@ | ||||
|     <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.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="settings.editor.selected.configurable" value="preferences.pluginManager" /> | ||||
|   </component> | ||||
| @@ -190,7 +191,7 @@ | ||||
|     <configuration name="allTests" type="JUnit" factoryName="JUnit"> | ||||
|       <useClassPathOnly /> | ||||
|       <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="MAIN_CLASS_NAME" value="" /> | ||||
|       <option name="METHOD_NAME" value="" /> | ||||
| @@ -204,7 +205,7 @@ | ||||
|         <option name="Make" enabled="true" /> | ||||
|       </method> | ||||
|     </configuration> | ||||
|     <configuration default="true" type="JetRunConfigurationType"> | ||||
|     <configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin"> | ||||
|       <module name="eureka" /> | ||||
|       <option name="VM_PARAMETERS" /> | ||||
|       <option name="PROGRAM_PARAMETERS" /> | ||||
| @@ -217,7 +218,7 @@ | ||||
|         <option name="Make" enabled="true" /> | ||||
|       </method> | ||||
|     </configuration> | ||||
|     <configuration default="true" type="KotlinStandaloneScriptRunConfigurationType"> | ||||
|     <configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script"> | ||||
|       <module name="eureka" /> | ||||
|       <option name="filePath" /> | ||||
|       <option name="vmParameters" /> | ||||
| @@ -306,6 +307,7 @@ | ||||
|       <workItem from="1611757446709" duration="6743000" /> | ||||
|       <workItem from="1611826821050" duration="10679000" /> | ||||
|       <workItem from="1611915874625" duration="15194000" /> | ||||
|       <workItem from="1612178634549" duration="12858000" /> | ||||
|     </task> | ||||
|     <task id="LOCAL-00077" summary="testing jenkins docker"> | ||||
|       <created>1601453886631</created> | ||||
| @@ -654,7 +656,7 @@ | ||||
|     <servers /> | ||||
|   </component> | ||||
|   <component name="TypeScriptGeneratedFilesManager"> | ||||
|     <option name="version" value="2" /> | ||||
|     <option name="version" value="1" /> | ||||
|   </component> | ||||
|   <component name="UnknownFeatures"> | ||||
|     <option featureType="com.intellij.fileTypeFactory" implementationName="*.js" /> | ||||
| @@ -664,12 +666,13 @@ | ||||
|       <map> | ||||
|         <entry key="MAIN"> | ||||
|           <value> | ||||
|             <State /> | ||||
|             <State> | ||||
|               <option name="COLUMN_ORDER" /> | ||||
|             </State> | ||||
|           </value> | ||||
|         </entry> | ||||
|       </map> | ||||
|     </option> | ||||
|     <option name="oldMeFiltersMigrated" value="true" /> | ||||
|   </component> | ||||
|   <component name="VcsManagerConfiguration"> | ||||
|     <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> | ||||
|   | ||||
| @@ -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<json.length; i++){ | ||||
|         if(id == json[i].mockedResponseId){ | ||||
|             jsonIndex = i; | ||||
|             console.log("Message found"); | ||||
|             initializeMock(i); | ||||
|             initializeMock(jsonIndex); | ||||
|             console.log("Fields initialized"); | ||||
|             selectMessage(id); | ||||
|             console.log("Selection complete"); | ||||
| @@ -115,4 +118,32 @@ function generateMessageTileHtml(id, httpStatus, mediaType){ | ||||
|     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)); | ||||
| } | ||||
|   | ||||
| @@ -74,7 +74,7 @@ | ||||
|                     <div id="history" style="display:none;"></div> | ||||
|                 </div> | ||||
|                 <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> | ||||
|         </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user