From 43c4e993cca0f0cd0726a065877e7f836032ea0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=84=EC=84=B1=ED=95=84?= Date: Wed, 25 Oct 2023 15:19:20 +0900 Subject: [PATCH] =?UTF-8?q?DB=20=EC=BB=AC=EB=9F=BC=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=EA=B7=B8=EB=A0=88=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20API=20=EC=9A=94=EC=B2=AD=20=EC=A0=80=EC=9E=A5=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApiRequestMigrationService.java | 4 ++ src/main/resources/static/js/APITester.js | 37 +++++++++++-------- .../templates/page/routes/mockRouteList.html | 6 +-- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/eactive/httpmockserver/client/service/ApiRequestMigrationService.java b/src/main/java/com/eactive/httpmockserver/client/service/ApiRequestMigrationService.java index 35931a3..5d414be 100644 --- a/src/main/java/com/eactive/httpmockserver/client/service/ApiRequestMigrationService.java +++ b/src/main/java/com/eactive/httpmockserver/client/service/ApiRequestMigrationService.java @@ -37,6 +37,10 @@ public class ApiRequestMigrationService { try (Statement statement = connection.createStatement()) { statement.execute(sql2); } + String sql3 = String.format("ALTER TABLE %s ALTER COLUMN %s %s;", "API_REQUEST_INFO", "REQUEST_BODY", "CLOB"); + try (Statement statement = connection.createStatement()) { + statement.execute(sql3); + } } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/resources/static/js/APITester.js b/src/main/resources/static/js/APITester.js index 28bfc8b..c9aaead 100644 --- a/src/main/resources/static/js/APITester.js +++ b/src/main/resources/static/js/APITester.js @@ -366,7 +366,7 @@ class APITester { showCollectionDeleteModal(event) { const collectionId = $(event.currentTarget).closest('button').data('collection'); - $('#confirm_delete_modal').find('.confirm_delete').attr('data-id', collectionId); + $('#confirm_delete_modal').find('.confirm_delete').data('id', collectionId); $('#confirm_delete_modal').modal('show'); } @@ -394,9 +394,9 @@ class APITester { showDeleteApiRequestModal(event) { let collectionId = $(event.currentTarget).closest('li').data('collection'); let apiId = $(event.currentTarget).closest('li').data('id'); - - $('#confirm_delete_api_modal').find('.confirm_delete_api').attr('data-id', apiId); - $('#confirm_delete_api_modal').find('.confirm_delete_api').attr('data-collection', collectionId); + console.log('apiId: ' + apiId); + $('#confirm_delete_api_modal').find('.confirm_delete_api').data('id', apiId); + $('#confirm_delete_api_modal').find('.confirm_delete_api').data('collection', collectionId); $('#confirm_delete_api_modal').modal('show'); } @@ -893,7 +893,7 @@ class APITester { }, error: function (response, textStatus, errorThrown) { me.hideLoadingOverlay(); - $('.toast-body').text(response.responseJSON); + $('.toast-body').text(response.responseJSON.error); $('.toast').toast('show'); }, complete: function () { @@ -922,7 +922,7 @@ class APITester { }, error: function (response, textStatus, errorThrown) { me.hideLoadingOverlay(); - $('.toast-body').text(response.responseJSON); + $('.toast-body').text(response.responseJSON.error); $('.toast').toast('show'); }, complete: function () { @@ -964,6 +964,8 @@ class APITester { }, error: function (response, textStatus, errorThrown) { me.hideLoadingOverlay(); + $('.toast-body').text(response.responseJSON.error); + $('.toast').toast('show'); }, complete: function () { me.loadCollections(); @@ -1031,10 +1033,19 @@ class APITester { deleteApiRequest(event) { let collectionId = $(event.currentTarget).closest('button').data('collection'); - let apiId = $(event.currentTarget).closest('button').data('id'); - + let apiId = $(event.currentTarget).closest('.confirm_delete_api').data('id'); + console.log(event.currentTarget); + console.log($(event.currentTarget)); + console.log('deleteApiRequest: ' + apiId); + console.log('collectionId: ' + collectionId); + let apiIndex = this.apiRequests.findIndex(function (api) { + return api.id === apiId; + }); + console.log(apiIndex); + if(apiIndex >= 0){ + this.closeTabWithApiIndex(apiIndex); + } const me = this; - let apiRequests = this.apiRequests; this.currentAjaxRequest = $.ajax({ url: `/mgmt/collections/${collectionId}/apis/delete.do`, type: 'POST', @@ -1047,14 +1058,10 @@ class APITester { }, complete: function () { me.hideLoadingOverlay(); - - //get the api with apiIndex index from apiRequests - let apiIndex = apiRequests.findIndex(function (api) { - return api.id === apiId; - }); - me.closeTabWithApiIndex(apiIndex); me.loadCollections(); $('#confirm_delete_api_modal').modal('hide'); + // $('#confirm_delete_api_modal').find('.confirm_delete_api').removeAttr('data-id'); + // $('#confirm_delete_api_modal').find('.confirm_delete_api').removeAttr('data-collection'); } }); } diff --git a/src/main/resources/templates/page/routes/mockRouteList.html b/src/main/resources/templates/page/routes/mockRouteList.html index 5611cbd..bd19dc1 100644 --- a/src/main/resources/templates/page/routes/mockRouteList.html +++ b/src/main/resources/templates/page/routes/mockRouteList.html @@ -8,9 +8,9 @@
-
+
-

응답 API 목록

+
응답 API 목록
@@ -35,7 +35,7 @@
-
+