2023-11-03 20:04:10 +01:00

145 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
<head th:replace="~{fragments/resources::head}">
</head>
<body>
<div class="bg-light main-wrapper">
<nav th:replace="~{fragments/resources :: navbar}"></nav>
<div class="d-flex">
<div th:replace="~{fragments/resources :: sidebar('logs')}"></div>
<div class="main-content bg-lighter">
<th:block th:replace="~{fragments/resources :: alerts}"></th:block>
<h1 class="fw-bold mb-4"><i class="align-middle bi bi-gear"></i>
<span class="align-middle">Logs</span>
</h1>
<div class="row mt-4">
<div class="col">
<div class="box">
<h3 class="fw-bold">Logs</h3>
<div class="w-75">
<form th:action="|/${snapadmin_baseUrl}/logs|" class="mt-3" id="log-filter-form" method="GET">
<div class="input-group">
<span class="input-group-text">Action type</span>
<select name="actionType" class="form-select">
<option>Any</option>
<option value="CREATE"
th:selected="${searchRequest.getActionType() != null
&& searchRequest.getActionType().equalsIgnoreCase('CREATE') }">Create</option>
<option value="EDIT"
th:selected="${searchRequest.getActionType() != null
&& searchRequest.getActionType().equalsIgnoreCase('EDIT') }">Edit</option>
<option value="DELETE"
th:selected="${searchRequest.getActionType() != null
&& searchRequest.getActionType().equalsIgnoreCase('DELETE') }">Delete</option>
</select>
<span class="input-group-text ms-3">Table</span>
<select name="table" class="form-select">
<option value="Any">Any</option>
<option th:each="schema : ${schemas}"
th:value="${schema.getTableName()}"
th:text="${schema.getTableName()}"
th:selected="${schema.getTableName().equals(searchRequest.getTable())}">
</option>
</select>
<span class="input-group-text ms-3">Item ID</span>
<input type="text" class="form-control" name="itemId"
th:value="${searchRequest.getItemId()}">
<button class="ui-btn btn btn-primary ms-3">Filter</button>
</div>
</form>
</div>
<div class="separator mt-3 mb-3"></div>
<div class="mt-3" th:if="${page.isEmpty()}">
<div class="alert alert-warning">There are no results for your filtering criteria</div>
</div>
<div class="table-responsive mt-3" th:if="${!page.isEmpty()}">
<nav th:replace="~{fragments/resources :: pagination(page=${page})}"></nav>
<table class="table table-striped mt-3">
<tr class="table-data-row">
<th >
<div class="d-flex justify-content-between">
<div>Action type</div>
<h4>
<th:block th:replace="~{fragments/table_selectable ::
sort_arrow(sortKey=${searchRequest.getSortKey()},
sortOrder=${searchRequest.getSortOrder()},
fieldName='actionType')}">
</h4>
</div>
</th>
<th >
<div class="d-flex justify-content-between">
<div>Table</div>
<h4>
<th:block th:replace="~{fragments/table_selectable ::
sort_arrow(sortKey=${searchRequest.getSortKey()},
sortOrder=${searchRequest.getSortOrder()},
fieldName='onTable')}">
</h4>
</div>
</th>
<th >
<div class="d-flex justify-content-between">
<div>Item ID</div>
<h4>
<th:block th:replace="~{fragments/table_selectable ::
sort_arrow(sortKey=${searchRequest.getSortKey()},
sortOrder=${searchRequest.getSortOrder()},
fieldName='primaryKey')}">
</h4>
</div>
</th>
<th >
<div class="d-flex justify-content-between">
<div>Time</div>
<h4>
<th:block th:replace="~{fragments/table_selectable ::
sort_arrow(sortKey=${searchRequest.getSortKey()},
sortOrder=${searchRequest.getSortOrder()},
fieldName='createdAt')}">
</h4>
</div>
</th>
</tr>
<tr th:each="entry : ${page.getResults()}" class="table-data-row align-middle">
<td th:text="${entry.getActionType()}">
</td>
<td th:text="${entry.getOnTable()}">
</td>
<td>
<th:block th:if="${entry.getActionType() != 'DELETE'}">
<a th:href="|/${snapadmin_baseUrl}/model/${entry.getJavaClass()}/show/${entry.getPrimaryKey()}|"
th:text="${entry.getPrimaryKey()}"></a>
</th:block>
<th:block th:if="${entry.getActionType() == 'DELETE'}">
<span th:text="${entry.getPrimaryKey()}"></span>
</th:block>
</td>
<td th:text="${entry.getFormattedDate()}">
</td>
<!--
<a href="#" class="ui-btn btn btn-primary">
Diff <i class="text-white bi bi-search"></i>
</a>
-->
</tr>
</table>
<nav th:replace="~{fragments/resources :: pagination(page=${page})}"></nav>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>