mock route 등록/수정 로직 변경, 복제 기능 추가

This commit is contained in:
현성필
2023-08-23 16:13:16 +09:00
parent 613e64de6d
commit d2f6d1c846
10 changed files with 215 additions and 24 deletions
@@ -29,7 +29,7 @@
</div>
<div class="d-flex align-items-center mt-2">
<div class="form-floating col-md-1 me-2">
<select name="method" class="form-select"
<select name="method" class="form-select" th:readonly="${mockRoute.id != null}"
th:classappend="${#fields.hasErrors('method')}? 'is-invalid'" id="method">
<option th:selected="${mockRoute.method == 'POST'}" value="POST">POST</option>
<option th:selected="${mockRoute.method == 'GET'}" value="GET">GET</option>
@@ -45,11 +45,18 @@
</div>
<div class="form-floating col-md">
<input type="text" name="pathPattern" class="form-control" id="pathPattern"
th:field="*{pathPattern}"
th:field="*{pathPattern}" th:readonly="${mockRoute.id != null}"
placeholder="서버에 노출 되는 경로 (/부터 입력)" required>
<label for="pathPattern" class="must">Path</label>
</div>
</div>
<div class="form-floating col-md">
<input type="hidden" th:classappend="${#fields.hasGlobalErrors() || #fields.hasErrors('pathPattern')}? 'is-invalid'"
placeholder="서버에 노출 되는 경로 (/부터 입력)" required th:readonly="${mockRoute.id != null}">
<th:block th:each="err : ${#fields.errors('pathPattern')}">
<div th:text="${err}" class="invalid-feedback"></div>
</th:block>
</div>
<div id="responses" class="mt-1">
<div class="row" th:each="response, status: *{responses}">
<input type="number" th:field="*{responses[__${status.index}__].statusCode}" required/>
@@ -90,6 +90,9 @@
<button type="button" class="btn btn-primary btn-sm me-2" th:onclick="fnSelectItem([[${row.id}]])" th:value="#{button.update}"><i class="fa-sharp fa-solid fa-edit"></i>
[[#{button.update}]]
</button>
<button type="button" class="btn btn-primary btn-sm me-2" th:onclick="fnCloneItem([[${row.id}]])"><i class="fa-sharp fa-solid fa-copy"></i>
복제
</button>
</div>
</td>
</tr>
@@ -100,6 +103,9 @@
</tbody>
</table>
</form>
<form name="cloneForm" th:action="@{/mgmt/routes/clone_view.do}" method="post" style="display: none">
<input type="hidden" name="id">
</form>
</div>
<div class="card-footer">
<div th:replace="~{fragment/pagination :: pagination(jsFunction='fn_select_page')}"></div>
@@ -123,6 +129,11 @@
location.href = "[[@{/mgmt/routes/update_view.do}]]" + "?id=" + id;
}
function fnCloneItem(id){
document.cloneForm.id.value = id;
document.cloneForm.submit();
}
$(function () {
let fnSearch = document.querySelector(".btn_search");
let fnDelete = document.querySelector(".btn_delete");