T157 PUT/update working, POST/addNew problems with eureka
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -23,6 +23,7 @@
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" 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" />
|
||||
@@ -311,7 +312,7 @@
|
||||
<workItem from="1612259068808" duration="10440000" />
|
||||
<workItem from="1612279535476" duration="5692000" />
|
||||
<workItem from="1612442837870" duration="8318000" />
|
||||
<workItem from="1612609113694" duration="7143000" />
|
||||
<workItem from="1612609113694" duration="11380000" />
|
||||
</task>
|
||||
<task id="LOCAL-00077" summary="testing jenkins docker">
|
||||
<created>1601453886631</created>
|
||||
|
||||
@@ -69,8 +69,9 @@ public class MockController {
|
||||
return messages;
|
||||
}
|
||||
|
||||
@PostMapping("/mock/json")
|
||||
public ResponseEntity<String> addNewMessage(@RequestParam UUID clientUUID){
|
||||
@PostMapping("/mock/json/{uuid}")
|
||||
public ResponseEntity<String> addNewMessage(@PathVariable String uuidValue){
|
||||
UUID clientUUID = UUID.fromString(uuidValue);
|
||||
List<MockedMessageDto> messages = klausService.getAllMockedResponses(clientUUID);
|
||||
MockedMessageDto nextMessage = buildDefaultMessage(clientUUID, findNextId(messages));
|
||||
return klausService.setMockedResponse(nextMessage);
|
||||
@@ -106,8 +107,8 @@ public class MockController {
|
||||
public static int findNextId(List<MockedMessageDto> messages) {
|
||||
int highestId = 0;
|
||||
for (MockedMessageDto m : messages)
|
||||
highestId = highestId < m.getMockedResponseId() ? highestId : m.getMockedResponseId();
|
||||
return highestId;
|
||||
highestId = highestId > m.getMockedResponseId() ? highestId : m.getMockedResponseId();
|
||||
return ++highestId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,15 +56,27 @@ function updateData(){
|
||||
$.ajax({
|
||||
url: 'http://localhost:8097/mock/json',
|
||||
type: 'PUT',
|
||||
data: updatedJson,
|
||||
success: function(data) {
|
||||
console.log('PUT request received 200');
|
||||
}
|
||||
data: JSON.stringify(updatedJson, null, 2),
|
||||
error: function(e) {
|
||||
console.log(e);
|
||||
},
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
// success: function(data) {
|
||||
// console.log('PUT request received 200');
|
||||
// }
|
||||
});
|
||||
getData();
|
||||
}
|
||||
|
||||
function addMessage(){
|
||||
$.ajax({
|
||||
url: 'http://localhost:8097/mock/json/'+clientUUID,
|
||||
type: 'POST',
|
||||
// success: function(data) {
|
||||
// console.log('PUT request received 200');
|
||||
// }
|
||||
});
|
||||
// $.put('http://localhost:8097/mock/json', function(data){
|
||||
//
|
||||
// });
|
||||
// console.log('PUT request sent');
|
||||
getData();
|
||||
}
|
||||
|
||||
@@ -133,6 +145,7 @@ function generateHeaderTable(headers){
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div id="selectMenuContent" style="display: none;">
|
||||
<div id="selectMenuHead" class="articleHead">List</div>
|
||||
<div id="listItems"></div>
|
||||
<div id="iconPlus" class="menuItem"><i class="icon-plus"></i></div>
|
||||
<div id="iconPlus" class="menuItem" onclick="addMessage()"><i class="icon-plus"></i></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user