T158 added option to add and remove headers as will
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
//TODO: Add sleep after PUT,POST,DELETE request. Data might not be processed before GET request
|
||||
//TODO: Add button to add new header
|
||||
//TODO: Update cookie when displayed message is changed
|
||||
//TODO: Add delete buttons for headers
|
||||
@@ -6,6 +5,7 @@
|
||||
var clientUUID;
|
||||
var json;
|
||||
var jsonIndex = 0;
|
||||
var htable_row = 0;
|
||||
const C_UUID = 'mock-uuid';
|
||||
function getData(){
|
||||
// sleep(5000);
|
||||
@@ -79,6 +79,7 @@ function addMessage(){
|
||||
|
||||
function clearMock(){
|
||||
fillStaticFields('','','','');
|
||||
htable_row = 0;
|
||||
$('#httpStatusValues').html('');
|
||||
}
|
||||
|
||||
@@ -128,18 +129,45 @@ function generateHeaderTable(headers){
|
||||
for(var val in headers){
|
||||
values[index++]=headers[val];
|
||||
}
|
||||
|
||||
for(let i=0; i<count; i++){
|
||||
innerHTML+=
|
||||
'<tr class="httpStatusValue">' +
|
||||
'<tr id="hrow' + htable_row + '" class="httpStatusValue">' +
|
||||
'<td>' +
|
||||
'<input type="text" name="headerKey" placeholder="key" class="tableField headerName" value="' + keys[i] + '"/></td>' +
|
||||
'<input " type="text" name="headerKey" placeholder="key" class="tableField headerName" value="' + keys[i] + '"/></td>' +
|
||||
'<td>' +
|
||||
'<input type="text" name="headerKey" placeholder="key" class="tableField" value="' + values[i] + '"/></td>' +
|
||||
'<input " type="text" name="headerKey" placeholder="key" class="tableField" value="' + values[i] + '"/></td>' +
|
||||
'<td class="btn-function-table btn-table-remove" onclick="removeRow(' + htable_row + ')">X</td>' +
|
||||
'</tr>';
|
||||
htable_row++;
|
||||
}
|
||||
return innerHTML;
|
||||
}
|
||||
|
||||
function removeRow(row){
|
||||
$('#hrow' + row).remove();
|
||||
}
|
||||
|
||||
function addRow(){
|
||||
var table = $('#httpStatusValues');
|
||||
var hkey = $('#headerKeyInput');
|
||||
var hval = $('#headerValueInput');
|
||||
if(hkey.val() == 'key' || hkey.val() == '' || hval.val() == 'value' || hval.val() == '') return;
|
||||
var innerHtml =
|
||||
'<tr id="hrow' + htable_row + '" class="httpStatusValue">' +
|
||||
'<td>' +
|
||||
'<input " type="text" name="headerKey" placeholder="key" class="tableField headerName" value="' + hkey.val() +
|
||||
'"/></td>' +
|
||||
'<td>' +
|
||||
'<input " type="text" name="headerKey" placeholder="key" class="tableField" value="' + hval.val() + '"/></td>' +
|
||||
'<td class="btn-function-table btn-table-remove" onclick="removeRow(' + htable_row + ')">X</td>' +
|
||||
'</tr>';
|
||||
htable_row++;
|
||||
table.append(innerHtml);
|
||||
hkey.val('');
|
||||
hval.val('');
|
||||
}
|
||||
|
||||
function fillMessageList(){
|
||||
$("#listItems").html('');
|
||||
var innerHTML = '';
|
||||
|
||||
Reference in New Issue
Block a user