started to making view of history on frontend
This commit is contained in:
@@ -29,6 +29,7 @@ function loadHistory(dateFrom, dateTo){
|
||||
contentType: "application/json"
|
||||
}).done(function(data){
|
||||
historyJson = data;
|
||||
console.log(data);
|
||||
displayHistory();
|
||||
});
|
||||
}
|
||||
@@ -36,6 +37,7 @@ function loadHistory(dateFrom, dateTo){
|
||||
function getLast24hHistoryData(){
|
||||
$.getJSON(host + '/api/event/' + clientUUID + '/' + lastId, function(data){
|
||||
historyJson = data;
|
||||
console.log(data);
|
||||
displayHistory();
|
||||
});
|
||||
}
|
||||
@@ -47,12 +49,34 @@ function historyToHtml(){
|
||||
let style = i%2==0 ? ' class="even"' : '';
|
||||
innerHTML += '<tr' + style + '>' +
|
||||
'<td>' + historyJson[i].dateTimeStamp + '</td>' +
|
||||
'<td>' + historyJson[i].interfaceName + '</td>' +
|
||||
'<td>' + historyJson[i].httpMethod + '</td>' +
|
||||
'<td>' + historyJson[i].requestBody + '</td>' +
|
||||
'<td>' +
|
||||
'<th> Header Name </th>' +
|
||||
'<th> Header Value </th>' +
|
||||
historyJson[i].headers.forEach(
|
||||
|
||||
)
|
||||
+ '</td>'
|
||||
'<td>' + parseHeaders(historyJson[i].headers) + '</td>' +
|
||||
'</tr>';
|
||||
}
|
||||
return innerHTML;
|
||||
}
|
||||
|
||||
function parseHeaders(json){
|
||||
console.log(json);
|
||||
parsedJson = "";
|
||||
Object.keys( json ).forEach(
|
||||
(key) => {
|
||||
console.log(key);
|
||||
console.log(json.key)
|
||||
parsedJson += key + " : " + json[key] + "\n";
|
||||
}
|
||||
)
|
||||
return parsedJson;
|
||||
}
|
||||
|
||||
function displayHistory(){
|
||||
$('#historyTable tbody').html(historyToHtml());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user