From f6101824ea288e26df194bacdd24d86e9b52297f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=84=EC=84=B1=ED=95=84?= Date: Tue, 9 May 2023 21:34:02 +0900 Subject: [PATCH] =?UTF-8?q?request=20body=20select=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/page/apiTester.html | 77 +++++++++++++------ 1 file changed, 53 insertions(+), 24 deletions(-) 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 = $('