main
Satur@it-depot.ru 2025-03-06 14:25:10 +03:00
parent 03bc10a98e
commit 6a904b76f0
2 changed files with 52 additions and 12 deletions

1
app.py
View File

@ -168,6 +168,7 @@ def update_install(install_id: int, data: InstallData):
new_computer_name = data.computer_name if data.computer_name is not None else current[1]
new_install_time = data.install_time if data.install_time is not None else current[2]
new_folder_id = data.folder_id if data.folder_id is not None else current[3]
# Используем текущее значение protocol, если data.protocol не передано (None)
new_protocol = data.protocol if data.protocol is not None else current[4]
new_note = data.note if data.note is not None else current[5]

View File

@ -787,24 +787,64 @@
}
function moveInstallToFolder(installId, folderId) {
const install = allInstalls.find(i => i.id === installId);
if (install) {
$.ajax({
url: `${API_URL}/install/${installId}`,
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify({
folder_id: folderId,
protocol: install.protocol
}),
success: function () {
loadInstalls(selectedFolderId);
},
error: function (xhr, status, error) {
console.error("Ошибка переноса:", status, error);
}
});
}
}
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}/install/${installId}`,
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify({
folder_id: folderId,
// Добавляем текущее значение protocol
protocol: allInstalls.find(i => i.id === installId)?.protocol || 'rustdesk'
}),
success: function () {
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) {
console.error("Ошибка переноса:", 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() || '';
const install = allInstalls.find(i => i.id === selectedInstallId);
@ -815,7 +855,6 @@
contentType: 'application/json',
data: JSON.stringify({
note: note,
// Добавляем текущее значение protocol
protocol: install.protocol
}),
success: function () {
@ -888,7 +927,7 @@
function formatItalic() {
const textarea = $('#note-textarea');
const start = textarea[0].selectionStart;
end: textarea[0].selectionEnd;
const end = textarea[0].selectionEnd;
const text = textarea.val();
const selected = text.substring(start, end);
const newText = `*${selected}*`;