T157 static content and table generated. Added css to table
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
function getData(uuid){
|
||||
$.getJSON('http://localhost:8097/mock/json', function(json) {
|
||||
fillStaticFields(json[0].clientUUID
|
||||
, json[0].mockedResponseId
|
||||
, json[0].mediaType
|
||||
, json[0].messageBody
|
||||
, json[0].httpStatus);
|
||||
fillHeaderTable(json[0].httpHeaders);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function fillStaticFields(uuid, id, mediaType, body, httpStatus){
|
||||
$('#messageLink').html(createLink(uuid,id));
|
||||
$('#typeSelector').val(mediaType);
|
||||
$('#bodyEditor').html(body);
|
||||
|
||||
//TODO: HttpStatus
|
||||
}
|
||||
|
||||
function createLink(uuid, id){
|
||||
var link = 'http://localhost:8097/klaus/v1/'+uuid+'/'+id;
|
||||
return link;
|
||||
}
|
||||
|
||||
function fillHeaderTable(headers){
|
||||
var innerHTML = $('#headerTable').html();
|
||||
innerHTML += generateHeaderTable(headers);
|
||||
$('#headerTable').html(innerHTML);
|
||||
}
|
||||
|
||||
function generateHeaderTable(headers){
|
||||
var innerHTML = '';
|
||||
var keys = Object.keys(headers);
|
||||
for(var h in headers){
|
||||
innerHTML +=
|
||||
'<tr>' +
|
||||
'<td class="headerName">' + keys[h] + '</td>' +
|
||||
'<td class="headerField">' + headers[h] + '</td>' +
|
||||
'</tr>'
|
||||
}
|
||||
return innerHTML;
|
||||
}
|
||||
|
||||
$(document).ready(getData());
|
||||
@@ -27,24 +27,3 @@ function createMessageTab() {
|
||||
|
||||
$("#optional").click(changeAdvancedVisibility);
|
||||
$(".menuFactory").click(createMessageTab);
|
||||
|
||||
// var key = $("#headerKey");
|
||||
// var value = $("#headerValue");
|
||||
// function addHeaderTableRow(){
|
||||
// var headerTable = document.getElementById("headerTable");
|
||||
// headerTable.innerHTML +=
|
||||
// '<tr>' +
|
||||
// '<td>' +
|
||||
// '<input type="text" name="value" class="headerName" value="' + key.val() + '"\n disabled="disabled"/>' +
|
||||
// '</td>' +
|
||||
// '<td>' +
|
||||
// '<input type="text" name="httpHeaders[' + key.val() + ']" class="headerField" id="httpHeaders' + key.val() + '" value="' + value.val() +'"/>' +
|
||||
// '</td>' +
|
||||
// '</tr>';
|
||||
// key.html("");
|
||||
// value.html("");
|
||||
// // alert("key: " + key.val() +
|
||||
// // "\n" + "value: " + value.val());
|
||||
// }
|
||||
|
||||
// key.keypress(function(e){ if(e.key == 'Enter') addHeaderTableRow()});
|
||||
|
||||
Reference in New Issue
Block a user