This commit is contained in:
현성필
2023-05-12 11:47:09 +09:00
parent ac5f4146f4
commit c47320f56c
24 changed files with 444 additions and 30 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ spring:
show-sql: false
database-platform: org.hibernate.dialect.H2Dialect
thymeleaf:
prefix: classpath:templates/
prefix: classpath:/templates/
check-template-location: true
suffix: .html
mode: HTML
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/api_tester_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/api_tester_layout}">
<body>
<section layout:fragment="contentFragment">
@@ -28,7 +28,7 @@
<div id="apiRequestTemplate" style="display: none;">
<div class="tab-pane fade mt-1">
<div class="d-flex align-items-center">
<div class="form-floating col-md-2 me-1">
<div class="form-floating col-md-1 me-1">
<select name="method" class="form-select method">
<option value="POST">POST</option>
<option value="GET">GET</option>
@@ -42,12 +42,18 @@
</select>
<label class="form-label must">Method</label>
</div>
<div class="form-floating col-md-3 me-1">
<div class="form-floating col-md-1 me-1">
<select class="form-select server" name="server">
<option th:each="server : ${servers}" th:value="${server.id}" th:text="${server.name}"></option>
<option th:each="server : ${servers}" th:value="${server.id}" th:text="${server.name}" th:data-path="${server.basePath}"></option>
</select>
<label class="form-label must">Server</label>
</div>
<div class="form-floating col-md-1 me-1">
<div class="form-floating col-md">
<input type="text" name="basePath" class="form-control" readonly>
<label class="must">base path</label>
</div>
</div>
<div class="input-group col-md">
<div class="form-floating col-md">
<input type="text" name="path" class="form-control path" placeholder="호출할 경로 (/부터 입력)"
@@ -351,9 +357,12 @@
});
model.server = target.find('select[name="server"]').val();
target.find('input[name="basePath"]').val(target.find('select[name="server"] option:selected').data('path'));
target.find('.server').on('change', function () {
target.find('select[name="server"]').on('change', function () {
model.server = $(this).val();
let selected = $(this).find('option:selected');
target.find('input[name="basePath"]').val(selected.data('path'));
});
target.find('.method').on('change', function () {
+1 -1
View File
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/base_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/base_layout}">
<body>
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/default_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/default_layout}">
<body>
<section layout:fragment="contentFragment">
@@ -52,7 +52,7 @@
<input type="number" th:field="*{responses[__${status.index}__].statusCode}" required/>
<textarea th:field="*{responses[__${status.index}__].body}"></textarea>
<input type="number" th:field="*{responses[__${status.index}__].delay}" required/>
<input type="text" th:field="*{responses[__${status.index}__].defaultResponse}" />
<input type="hidden" th:field="*{responses[__${status.index}__].defaultResponse}" />
<ul class="response_conditions">
<li th:each="condition, status: *{responses[__${status.index}__].conditions}">
<select>
@@ -122,6 +122,7 @@
<div class="card-header">응답 내용</div>
<div class="card-body">
<div class="form-floating mt-1">
<input type="hidden" name="defaultResponse" required/>
<input class="form-control" type="number" name="statusCode" required/>
<label class="form-label must">Status</label>
</div>
@@ -319,10 +320,12 @@
nodeCopy.find('.btn_add_condition').attr("data-id", i);
nodeCopy.find('.btn_add_header').attr("data-id", i);
nodeCopy.find('input[name="statusCode"]').attr('name', 'responses[' + i + '].statusCode');
nodeCopy.find('input[name="defaultResponse"]').attr('name', 'responses[' + i + '].defaultResponse');
nodeCopy.find('input[name="delay"]').attr('name', 'responses[' + i + '].delay');
nodeCopy.find('textarea[name="body"]').attr('name', 'responses[' + i + '].body');
nodeCopy.find('input[name="responses[' + i + '].statusCode"]').val(model.responses[i].statusCode);
nodeCopy.find('input[name="responses[' + i + '].defaultResponse"]').val(model.responses[i].defaultResponse);
nodeCopy.find('input[name="responses[' + i + '].delay"]').val(model.responses[i].delay);
nodeCopy.find('textarea[name="responses[' + i + '].body"]').val(model.responses[i].body);
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/default_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/default_layout}">
<body>
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/base_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/base_layout}">
<body>
<section layout:fragment="contentFragment">
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/default_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/default_layout}">
<body>
<section layout:fragment="contentFragment">
@@ -1,6 +1,6 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{/layout/default_layout}">
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/default_layout}">
<body>