Fix notes

main
Satur@it-depot.ru 2025-03-06 15:39:49 +03:00
parent bd9d227676
commit 43dde5d3f3
1 changed files with 27 additions and 19 deletions

View File

@ -100,8 +100,8 @@
color: #e0e0e0 !important;
}
#search-container {
margin-top: 20px; /* Сдвигаем поиск ниже */
text-align: left; /* Выравнивание влево для поля поиска */
margin-top: 20px;
text-align: left;
}
#search-container.dark-theme input, #search-container.dark-theme select {
background-color: #333;
@ -109,16 +109,16 @@
border: 1px solid #555;
}
#search-input {
width: 300px; /* Увеличенная ширина */
height: 40px; /* Увеличенная высота */
font-size: 16px; /* Более заметный текст */
padding: 5px 10px; /* Внутренние отступы */
border: 2px solid #007bff; /* Более толстая и заметная граница */
border-radius: 5px; /* Скругленные углы */
width: 300px;
height: 40px;
font-size: 16px;
padding: 5px 10px;
border: 2px solid #007bff;
border-radius: 5px;
transition: border-color 0.3s ease;
}
#search-input:focus {
border-color: #0056b3; /* Изменение цвета границы при фокусе */
border-color: #0056b3;
outline: none;
}
#search-input.dark-theme {
@ -314,14 +314,13 @@
.theme-toggle.dark-theme:hover {
background: #0066cc;
}
/* Новый стиль для правого блока кнопок */
.export-import-container {
display: flex;
justify-content: flex-end; /* Выравнивание вправо */
margin-top: 10px; /* Отступ сверху */
justify-content: flex-end;
margin-top: 10px;
}
.export-import-container button {
margin-left: 10px; /* Отступ между кнопками */
margin-left: 10px;
}
</style>
</head>
@ -646,7 +645,7 @@
<div class="computer-name">${item.computer_name} <button class="edit-button ${isDarkTheme ? 'dark-theme' : ''}" onclick="editField(${item.id}, 'computer_name', '${item.computer_name}')">✏️</button></div>
<div class="connection-id"><span class="protocol-icon">${protocolIcons[item.protocol]}</span><a href="${protocolLinks[item.protocol]}${item.rust_id}" class="connection-link ${isDarkTheme ? 'dark-theme' : ''}" target="_blank">${item.rust_id}</a> <button class="copy-button ${isDarkTheme ? 'dark-theme' : ''}" onclick="copyToClipboard('${item.rust_id}')">📋</button> <button class="edit-button ${isDarkTheme ? 'dark-theme' : ''}" onclick="editField(${item.id}, 'rust_id', '${item.rust_id}')">✏️</button></div>
<div class="install-time">${item.install_time} <button class="edit-button ${isDarkTheme ? 'dark-theme' : ''}" onclick="editField(${item.id}, 'install_time', '${item.install_time}')">✏️</button></div>
<div class="actions"><span class="action-buttons"><button onclick="deleteInstall(${item.id})">Удалить</button> <button onclick="openNoteModal(${item.id}, '${item.note}')">Заметка</button></span></div>
<div class="actions"><span class="action-buttons"><button onclick="deleteInstall(${item.id})">Удалить</button> <button onclick="openNoteModal(${item.id}, '${item.note || ''}')">Заметка</button></span></div>
</div>
`).join(''));
}
@ -898,13 +897,21 @@
}
function openNoteModal(installId, currentNote) {
selectedInstallId = installId;
$('#note-textarea').val(currentNote);
console.log('Opening note modal for installId:', installId, 'with note:', currentNote);
selectedInstallId = installId; // Устанавливаем выбранный ID
$('#note-textarea').val(currentNote || ''); // Устанавливаем текущую заметку или пустую строку
$('#note-modal').show();
$('#modal-overlay').show();
}
function saveNote() {
console.log('Saving note for installId:', selectedInstallId);
if (!selectedInstallId) {
console.error('No install selected');
alert('Выберите запись для редактирования заметки.');
return;
}
const note = $('#note-textarea').val() || '';
const install = allInstalls.find(i => i.id === selectedInstallId);
if (install) {
@ -914,15 +921,16 @@
contentType: 'application/json',
data: JSON.stringify({
note: note,
protocol: install.protocol
protocol: install.protocol // Сохраняем текущий protocol
}),
success: function () {
loadInstalls(selectedFolderId);
console.log('Note saved successfully');
loadInstalls(selectedFolderId); // Обновляем список установок
closeNoteModal();
},
error: function (xhr, status, error) {
console.error("Ошибка сохранения заметки:", status, error);
alert("Не удалось сохранить заметку");
alert(`Не удалось сохранить заметку: ${xhr.responseJSON?.detail || error}`);
}
});
}