diff --git a/templates/index.html b/templates/index.html index 7d8106a..303495f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -351,6 +351,32 @@ .export-import-container button { margin-left: 10px; } + #add-record-button { + display: block; + margin: 20px auto; + width: 250px; + height: 60px; + font-size: 18px; + font-weight: bold; + color: #fff; + background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%); + border: none; + border-radius: 30px; + cursor: pointer; + box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); + transition: all 0.3s ease; + } + #add-record-button:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); + background: linear-gradient(90deg, #3d9afe 0%, #00d4fe 100%); + } + #add-record-button.dark-theme { + background: linear-gradient(90deg, #2a6eb4 0%, #1e90ff 100%); + } + #add-record-button.dark-theme:hover { + background: linear-gradient(90deg, #1e5ea4 0%, #1c7ed6 100%); + } @@ -379,7 +405,7 @@ - +
Имя компьютера
ID подключения
@@ -468,7 +494,7 @@ document.getElementById('import-label').classList.add('dark-theme'); document.getElementById('splitter').classList.add('dark-theme'); document.querySelector('.theme-toggle').classList.add('dark-theme'); - document.querySelector('.theme-toggle').textContent = 'Светлая тема'; + document.querySelector('#add-record-button').classList.add('dark-theme'); document.querySelectorAll('.install-item').forEach(item => item.classList.add('dark-theme')); document.querySelector('.header').classList.add('dark-theme'); $('#folder-tree').addClass('jstree-default-dark'); @@ -532,6 +558,7 @@ $('.install-item').removeClass('selected'); $(items[currentIndex]).addClass('selected'); updateNotesPanel(); + $(items[currentIndex])[0].scrollIntoView({ behavior: 'smooth', block: 'nearest' }); }); }); @@ -546,6 +573,7 @@ const importLabel = document.getElementById('import-label'); const splitter = document.getElementById('splitter'); const themeToggle = document.querySelector('.theme-toggle'); + const addRecordButton = document.getElementById('add-record-button'); const header = document.querySelector('.header'); const installItems = document.querySelectorAll('.install-item'); const folderTree = $('#folder-tree'); @@ -561,6 +589,7 @@ importLabel.classList.remove('dark-theme'); splitter.classList.remove('dark-theme'); themeToggle.classList.remove('dark-theme'); + addRecordButton.classList.remove('dark-theme'); header.classList.remove('dark-theme'); installItems.forEach(item => item.classList.remove('dark-theme')); folderTree.removeClass('jstree-default-dark'); @@ -577,6 +606,7 @@ importLabel.classList.add('dark-theme'); splitter.classList.add('dark-theme'); themeToggle.classList.add('dark-theme'); + addRecordButton.classList.add('dark-theme'); header.classList.add('dark-theme'); installItems.forEach(item => item.classList.add('dark-theme')); folderTree.addClass('jstree-default-dark'); @@ -706,6 +736,11 @@ let filtered = folderId ? data.filter(i => i.folder_id == folderId && i.folder_id !== null) : data; displayInstalls(filtered); updateNotesPanel(); + // Восстанавливаем выделение после перерендера + if (selectedInstallId) { + const items = $('#installs-list .install-item'); + $(`#installs-list .install-item[data-id="${selectedInstallId}"]`).addClass('selected'); + } }).fail(function(jqxhr, textStatus, error) { console.error("Error loading installs:", textStatus, error); $('#installs-list').html('

Ошибка загрузки данных. Проверьте консоль.

'); @@ -754,6 +789,10 @@ `).join('')); } updateSortArrows(); + // Восстанавливаем выделение после перерендера + if (selectedInstallId) { + $(`#installs-list .install-item[data-id="${selectedInstallId}"]`).addClass('selected'); + } } function selectInstall(installId, rustId, protocol) { @@ -1079,6 +1118,7 @@ const note = $('#note-textarea').val() || ''; const install = allInstalls.find(i => i.id === selectedInstallId); if (install) { + const currentSelectedId = selectedInstallId; // Сохраняем текущий selectedInstallId $.ajax({ url: `${API_URL}/install/${selectedInstallId}`, type: 'PUT', @@ -1093,8 +1133,13 @@ }), success: function () { console.log('Note saved successfully'); - loadInstalls(selectedFolderId); - closeNoteModal(); + loadInstalls(selectedFolderId); // Перезагружаем список + selectedInstallId = currentSelectedId; // Восстанавливаем selectedInstallId + closeNoteModal(); // Закрываем модальное окно + // Восстанавливаем выделение + const items = $('#installs-list .install-item'); + $(`#installs-list .install-item[data-id="${selectedInstallId}"]`).addClass('selected'); + updateNotesPanel(); }, error: function (xhr, status, error) { console.error("Ошибка сохранения заметки:", status, error);