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%); transform: translateY(-50%);
margin-left: 0; margin-left: 0;
} }
/* Стили для выбранного узла в jstree в темной теме */
.jstree-default-dark .jstree-clicked { .jstree-default-dark .jstree-clicked {
background: #005580 !important; background: #005580 !important;
color: #e0e0e0 !important; color: #e0e0e0 !important;
@ -751,6 +750,11 @@
if (field === 'install_time') { if (field === 'install_time') {
data['folder_id'] = selectedFolderId; data['folder_id'] = selectedFolderId;
} }
// Добавляем текущее значение protocol
const install = allInstalls.find(i => i.id === installId);
if (install) {
data['protocol'] = install.protocol;
}
$.ajax({ $.ajax({
url: `${API_URL}/install/${installId}`, url: `${API_URL}/install/${installId}`,
type: 'PUT', type: 'PUT',
@ -787,7 +791,11 @@
url: `${API_URL}/install/${installId}`, url: `${API_URL}/install/${installId}`,
type: 'PUT', type: 'PUT',
contentType: 'application/json', 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 () { success: function () {
loadInstalls(selectedFolderId); 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() { function saveNote() {
const note = $('#note-textarea').val() || ''; const note = $('#note-textarea').val() || '';
$.ajax({ const install = allInstalls.find(i => i.id === selectedInstallId);
url: `${API_URL}/install/${selectedInstallId}`, if (install) {
type: 'PUT', $.ajax({
contentType: 'application/json', url: `${API_URL}/install/${selectedInstallId}`,
data: JSON.stringify({ note: note }), type: 'PUT',
success: function () { contentType: 'application/json',
loadInstalls(selectedFolderId); data: JSON.stringify({
closeNoteModal(); note: note,
}, // Добавляем текущее значение protocol
error: function (xhr, status, error) { protocol: install.protocol
console.error("Ошибка сохранения заметки:", status, error); }),
alert("Не удалось сохранить заметку"); success: function () {
} loadInstalls(selectedFolderId);
}); closeNoteModal();
},
error: function (xhr, status, error) {
console.error("Ошибка сохранения заметки:", status, error);
alert("Не удалось сохранить заметку");
}
});
}
} }
function closeNoteModal() { function closeNoteModal() {
@ -911,7 +888,7 @@
function formatItalic() { function formatItalic() {
const textarea = $('#note-textarea'); const textarea = $('#note-textarea');
const start = textarea[0].selectionStart; const start = textarea[0].selectionStart;
const end = textarea[0].selectionEnd; end: textarea[0].selectionEnd;
const text = textarea.val(); const text = textarea.val();
const selected = text.substring(start, end); const selected = text.substring(start, end);
const newText = `*${selected}*`; const newText = `*${selected}*`;