Satur@it-depot.ru 2025-03-06 14:16:30 +03:00
parent e9ceead91b
commit 03bc10a98e
1 changed files with 32 additions and 55 deletions

View File

@ -83,7 +83,6 @@
transform: translateY(-50%);
margin-left: 0;
}
/* Стили для выбранного узла в jstree в темной теме */
.jstree-default-dark .jstree-clicked {
background: #005580 !important;
color: #e0e0e0 !important;
@ -751,6 +750,11 @@
if (field === 'install_time') {
data['folder_id'] = selectedFolderId;
}
// Добавляем текущее значение protocol
const install = allInstalls.find(i => i.id === installId);
if (install) {
data['protocol'] = install.protocol;
}
$.ajax({
url: `${API_URL}/install/${installId}`,
type: 'PUT',
@ -787,7 +791,11 @@
url: `${API_URL}/install/${installId}`,
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify({ folder_id: folderId }),
data: JSON.stringify({
folder_id: folderId,
// Добавляем текущее значение protocol
protocol: allInstalls.find(i => i.id === installId)?.protocol || 'rustdesk'
}),
success: function () {
loadInstalls(selectedFolderId);
},
@ -797,60 +805,29 @@
});
}
function exportCSV() {
const folderId = $('#folder-select').val() || '';
window.location.href = `${API_URL}/export/csv?folder_id=${folderId}`;
}
function importCSV(file) {
if (!file) return;
const folderId = $('#folder-select').val() || '';
const formData = new FormData();
formData.append('file', file);
if (folderId) {
formData.append('folder_id', folderId);
}
$.ajax({
url: `${API_URL}/import/csv`,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
alert(response.message);
loadInstalls(selectedFolderId);
},
error: function (xhr, status, error) {
alert(`Ошибка импорта: ${xhr.responseJSON.detail || error}`);
}
});
}
function openNoteModal(installId, currentNote) {
selectedInstallId = installId;
$('#note-textarea').val(currentNote);
$('#note-modal').show();
$('#modal-overlay').show();
}
function saveNote() {
const note = $('#note-textarea').val() || '';
$.ajax({
url: `${API_URL}/install/${selectedInstallId}`,
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify({ note: note }),
success: function () {
loadInstalls(selectedFolderId);
closeNoteModal();
},
error: function (xhr, status, error) {
console.error("Ошибка сохранения заметки:", status, error);
alert("Не удалось сохранить заметку");
}
});
const install = allInstalls.find(i => i.id === selectedInstallId);
if (install) {
$.ajax({
url: `${API_URL}/install/${selectedInstallId}`,
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify({
note: note,
// Добавляем текущее значение protocol
protocol: install.protocol
}),
success: function () {
loadInstalls(selectedFolderId);
closeNoteModal();
},
error: function (xhr, status, error) {
console.error("Ошибка сохранения заметки:", status, error);
alert("Не удалось сохранить заметку");
}
});
}
}
function closeNoteModal() {
@ -911,7 +888,7 @@
function formatItalic() {
const textarea = $('#note-textarea');
const start = textarea[0].selectionStart;
const end = textarea[0].selectionEnd;
end: textarea[0].selectionEnd;
const text = textarea.val();
const selected = text.substring(start, end);
const newText = `*${selected}*`;