diff --git a/src/main/resources/templates/page/apiTester.html b/src/main/resources/templates/page/apiTester.html index 9f35c9c..2f29d3f 100644 --- a/src/main/resources/templates/page/apiTester.html +++ b/src/main/resources/templates/page/apiTester.html @@ -112,7 +112,12 @@
- + +
@@ -205,6 +210,7 @@ let view = { currentIdx: 0, responses: [], + requests: [], init: function () { $("#cancel-ajax").on("click", function () { if (controller.currentAjaxRequest) { @@ -230,9 +236,11 @@ let template = $('#inputTemplate').children().find('tr').clone(); template.find('input[name="key"]').val(model.queryParams[i].key); template.find('input[name="value"]').val(model.queryParams[i].value); + if(model.queryParams[i].enabled){ template.find('input[name="enabled"]').prop("checked",model.queryParams[i].enabled); } + template.find('button').attr("data-id", i); template.find('input[name="enabled"]').on('change', function () { @@ -259,10 +267,8 @@ target.find('.request_headers').empty(); let model = apiRequests[tabIdx]; - console.log(model); for (let i = 0; i < model.headers.length; i++) { let template = $('#inputTemplate').children().find('tr').clone(); - console.log(model.headers[i]); if(model.headers[i].enabled){ template.find('input[name="enabled"]').prop("checked",model.headers[i].enabled); } @@ -283,27 +289,40 @@ target.find('.request_headers').append(template); } }, - renderTab: function(idx){ - let apiRequestTabContent = $('#apiRequestTabContent'); + renderTabHeader : function(){ let apiRequestTabTitle = $('#apiRequestTabTitle'); + apiRequestTabTitle.empty(); + for (let idx = 0; idx < apiRequests.length; idx++) { + let $span = $('') + .html(' '); + + $span.on('click', function(event) { + event.stopPropagation(); + controller.removeAPIRequest(idx); + }); + + let tabButton = $('