Skip to content

Commit a2c071d

Browse files
web UI improvements
1 parent f98254f commit a2c071d

3 files changed

Lines changed: 70 additions & 2 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>Release</Configuration>
6+
<Platform>Any CPU</Platform>
7+
<PublishDir>bin\Release\net8.0\publish\osx-x64\</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net8.0</TargetFramework>
11+
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
12+
<SelfContained>false</SelfContained>
13+
<PublishSingleFile>true</PublishSingleFile>
14+
</PropertyGroup>
15+
</Project>

wwwroot/app.js

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ class DeviceConfig {
44
this.ws = null;
55
this.isConnected = false;
66
this.deviceInfo = null;
7-
this.maxLogEntries = 200; // Максимальное количество записей в логе
7+
this.maxLogEntries = 32; // Максимальное количество записей в логе
88

99
this.initWebSocket();
1010
this.initEventListeners();
1111
this.updateUI();
12-
1312
this.setDefaultFlags();
13+
this.initLogToggle();
1414
}
1515

1616
initWebSocket() {
@@ -73,6 +73,48 @@ class DeviceConfig {
7373
}
7474
}
7575

76+
initLogToggle() {
77+
const logPanel = document.querySelector('.log-panel');
78+
const logHeader = logPanel ? logPanel.querySelector('h2') : null;
79+
const logContainer = document.getElementById('logContainer');
80+
81+
if (!logHeader || !logContainer) {
82+
console.warn('Log elements not found');
83+
return;
84+
}
85+
86+
// Делаем заголовок кликабельным
87+
logHeader.style.cursor = 'pointer';
88+
logHeader.style.userSelect = 'none';
89+
90+
// По умолчанию скрываем лог
91+
logContainer.style.display = 'none';
92+
93+
// Удаляем старый индикатор если есть
94+
const oldIcon = logHeader.querySelector('.log-toggle-icon');
95+
if (oldIcon) oldIcon.remove();
96+
97+
// Добавляем индикатор состояния
98+
const toggleIcon = document.createElement('span');
99+
toggleIcon.className = 'log-toggle-icon';
100+
toggleIcon.textContent = ' ▶';
101+
logHeader.appendChild(toggleIcon);
102+
103+
// Обработчик клика
104+
logHeader.addEventListener('click', () => {
105+
const isHidden = logContainer.style.display === 'none';
106+
107+
if (isHidden) {
108+
logContainer.style.display = 'block';
109+
toggleIcon.textContent = ' ▼';
110+
logContainer.scrollTop = logContainer.scrollHeight;
111+
} else {
112+
logContainer.style.display = 'none';
113+
toggleIcon.textContent = ' ▶';
114+
}
115+
});
116+
}
117+
76118
handleMessage(message) {
77119
switch (message.type) {
78120
case 'device_status':

wwwroot/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,25 @@ select.form-control {
355355
justify-content: space-between;
356356
align-items: center;
357357
margin-bottom: 10px;
358+
cursor: pointer;
359+
user-select: none;
358360
}
359361

362+
.log-header:hover {
363+
opacity: 0.8;
364+
}
365+
360366
.log-header h2 {
361367
margin-bottom: 0;
362368
border-bottom: none;
363369
padding-bottom: 0;
364370
}
365371

372+
.log-toggle-icon {
373+
font-size: 0.8em;
374+
margin-left: 10px;
375+
}
376+
366377
.btn-small {
367378
padding: 5px 14px;
368379
font-size: 11px;

0 commit comments

Comments
 (0)