62 lines
1.9 KiB
Plaintext
62 lines
1.9 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Таблица — <%= schema %>.<%= name %></title>
|
|
<link rel="stylesheet" href="/public/style.css">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Таблица: <%= schema %>.<%= name %></h1>
|
|
<nav>
|
|
<a href="/">Главная</a>
|
|
<a href="/query">SQL-консоль</a>
|
|
</nav>
|
|
</header>
|
|
|
|
<main>
|
|
<% if (error) { %>
|
|
<p class="error"><%= error %></p>
|
|
<% } else { %>
|
|
<p>Строк всего: <strong><%= count %></strong>. Показано: <%= rows.length %> (стр. <%= page %>).</p>
|
|
|
|
<% if (columns && columns.length) { %>
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr><% columns.forEach(function (c) { %><th><%= c %></th><% }); %></tr>
|
|
</thead>
|
|
<tbody>
|
|
<% rows.forEach(function (r) { %>
|
|
<tr>
|
|
<% columns.forEach(function (c) { %>
|
|
<td>
|
|
<% if (r[c] === null) { %><span class="null">NULL</span>
|
|
<% } else if (typeof r[c] === 'boolean') { %><%= r[c] ? 'true' : 'false' %>
|
|
<% } else if (r[c] instanceof Date) { %><%= r[c].toISOString() %>
|
|
<% } else { %><%= r[c] %><% } %>
|
|
</td>
|
|
<% }); %>
|
|
</tr>
|
|
<% }); %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<nav class="pager">
|
|
<% if (page > 1) { %>
|
|
<a href="/table?schema=<%= schema %>&name=<%= name %>&page=<%= page - 1 %>&per_page=<%= perPage %>">← Назад</a>
|
|
<% } %>
|
|
<% if (page * perPage < count) { %>
|
|
<a href="/table?schema=<%= schema %>&name=<%= name %>&page=<%= page + 1 %>&per_page=<%= perPage %>">Вперёд →</a>
|
|
<% } %>
|
|
</nav>
|
|
<% } else { %>
|
|
<p>Таблица пуста.</p>
|
|
<% } %>
|
|
<% } %>
|
|
</main>
|
|
</body>
|
|
</html>
|