This repository has been archived by the owner on Feb 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
97 lines (83 loc) · 3.31 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Live Logs and SQL</title>
<script type="module" src="js/main.js"></script>
<link rel="stylesheet" href="main.css">
</head>
<body>
<h1>Live Logs and SQL</h1>
<!-- Блок выбора сервера и ввода токена -->
<label for="server-select">Select Server:</label>
<select id="server-select" class="server-selector">
<option value="http://localhost:34000">Localhost</option>
<option value="https://mock.coffeedev.dev">Mock Server</option>
<option value="custom">Custom Server</option>
</select>
<div id="custom-server-input" style="display: none;">
<input type="text" id="custom-domain" placeholder="http://domain.com" />
</div>
<input type="text" id="token-input" placeholder="Enter your token here" />
<div id="log-window">
Loading logs...
</div>
<!-- Блок для отображения таблиц -->
<div id="tables-list">
<h3 id="table-name">Available Tables</h3>
<table id="tables-table">
<thead>
<tr>
<th>Table Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr><td colspan="2">Loading tables...</td></tr>
</tbody>
</table>
<div id="table-details" style="display: none;">
<button id="back-button">Back to Table List</button>
<h3>Table Details</h3>
<div id="table-details-content"></div>
</div>
</div>
<!-- Блок для ввода и выполнения SQL -->
<div id="sql-command-block">
<label for="command-input">Enter SQL Command:</label>
<textarea id="command-input" rows="4" placeholder="e.g. SELECT * FROM users"></textarea>
<button id="execute-button">Execute SQL</button>
<div id="output-area">
Output will be shown here.
</div>
</div>
<!-- Кнопка для прокрутки окна логов вниз -->
<button id="scroll-button">Scroll to Bottom</button>
<script>
document.getElementById('token-input').addEventListener('input', function() {
const token = this.value;
document.cookie = `token=${token}; path=/;`;
});
document.getElementById('server-select').addEventListener('change', function() {
const server = this.value;
document.cookie = `server=${server}; path=/;`;
console.log("server cookie", server);
});
window.addEventListener('load', function() {
const getCookie = (name) => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
};
const server = getCookie('server');
if (server) {
document.getElementById('server-select').value = server;
if (server === 'custom') {
document.getElementById('custom-server-input').style.display = 'block';
}
}
});
</script>
</body>
</html>