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