main
Satur@it-depot.ru 2025-03-06 13:07:08 +03:00
parent b3050ec4a7
commit cbb5367d64
1 changed files with 18 additions and 36 deletions

View File

@ -26,10 +26,6 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
} }
.install-item .connection-id { .install-item .connection-id {
width: 30%; width: 30%;
@ -37,10 +33,6 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
} }
.install-item .install-time { .install-item .install-time {
width: 25%; width: 25%;
@ -48,17 +40,9 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
} }
.install-item .actions { .install-item .actions {
width: 25%; width: 25%;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
} }
.form-container { margin-bottom: 20px; } .form-container { margin-bottom: 20px; }
.jstree-node { position: relative; } .jstree-node { position: relative; }
@ -92,7 +76,7 @@
color: blue; color: blue;
text-decoration: underline; text-decoration: underline;
cursor: pointer; cursor: pointer;
margin-right: 3px; /* Отступ для баланса */ margin-right: 5px;
} }
.edit-button { .edit-button {
background: #fff; background: #fff;
@ -101,7 +85,7 @@
padding: 2px 5px; padding: 2px 5px;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
margin: 0 2px; /* Уменьшенный отступ для центрирования */ margin: 0 2px;
transition: background 0.2s ease; transition: background 0.2s ease;
} }
.edit-button:hover { .edit-button:hover {
@ -115,7 +99,7 @@
padding: 2px 5px; padding: 2px 5px;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
margin: 0 2px; /* Уменьшенный отступ для центрирования */ margin: 0 2px;
transition: background 0.2s ease; transition: background 0.2s ease;
} }
.copy-button:hover { .copy-button:hover {
@ -123,7 +107,7 @@
color: #218838; color: #218838;
} }
.action-buttons { margin-left: 5px; } .action-buttons { margin-left: 5px; }
.action-buttons button { margin: 0 2px; } /* Уменьшенный отступ для центрирования */ .action-buttons button { margin: 0 2px; }
#import-form { margin-top: 5px; } #import-form { margin-top: 5px; }
#import-file { display: none; } #import-file { display: none; }
#import-label { #import-label {
@ -217,9 +201,9 @@
<div class="time-hint">Пример: 2025-03-05 14:30:00</div> <div class="time-hint">Пример: 2025-03-05 14:30:00</div>
</div> </div>
<div class="header"> <div class="header">
<div>Имя компьютера<span class="sort-arrow"></span></div> <div onclick="sortInstalls('computer_name')">Имя компьютера<span class="sort-arrow"></span></div>
<div>ID подключения<span class="sort-arrow"></span></div> <div onclick="sortInstalls('rust_id')">ID подключения<span class="sort-arrow"></span></div>
<div>Время установки<span class="sort-arrow"></span></div> <div onclick="sortInstalls('install_time')">Время установки<span class="sort-arrow"></span></div>
<div>Действия</div> <div>Действия</div>
</div> </div>
<div id="installs-list"></div> <div id="installs-list"></div>
@ -280,6 +264,7 @@
'core': { 'core': {
'data': function (node, cb) { 'data': function (node, cb) {
$.getJSON(`${API_URL}/folders`, function (data) { $.getJSON(`${API_URL}/folders`, function (data) {
console.log("Loaded folders:", data); // Лог для отладки
allFolders = data; // Сохраняем все папки allFolders = data; // Сохраняем все папки
const treeData = [ const treeData = [
{ id: "root", text: "Корень", parent: "#" } { id: "root", text: "Корень", parent: "#" }
@ -301,6 +286,8 @@
updateFolderActions(); updateFolderActions();
}, 100); // Задержка для инициализации jstree }, 100); // Задержка для инициализации jstree
} }
}).fail(function(jqxhr, textStatus, error) {
console.error("Error loading folders:", textStatus, error);
}); });
}, },
'check_callback': true 'check_callback': true
@ -343,18 +330,21 @@
$.getJSON(`${API_URL}/folders`, function (data) { $.getJSON(`${API_URL}/folders`, function (data) {
allFolders = data; // Обновляем список папок allFolders = data; // Обновляем список папок
updateFolderSelect(); // Обновляем выпадающий список updateFolderSelect(); // Обновляем выпадающий список
}).fail(function(jqxhr, textStatus, error) {
console.error("Error loading folders:", textStatus, error);
}); });
} }
function loadInstalls(folderId) { function loadInstalls(folderId) {
$.getJSON(`${API_URL}/installs`, function (data) { $.getJSON(`${API_URL}/installs`, function (data) {
console.log("Loaded installs:", data); // Логируем данные для отладки console.log("Loaded installs:", data); // Лог для отладки
allInstalls = data; allInstalls = data;
let filtered = folderId ? data.filter(i => i.folder_id == folderId && i.folder_id !== null) : data; let filtered = folderId ? data.filter(i => i.folder_id == folderId && i.folder_id !== null) : data;
displayInstalls(filtered); displayInstalls(filtered);
updateNotesPanel(); updateNotesPanel();
}).fail(function(jqxhr, textStatus, error) { }).fail(function(jqxhr, textStatus, error) {
console.error("Error loading installs:", textStatus, error); console.error("Error loading installs:", textStatus, error);
$('#installs-list').html('<p>Ошибка загрузки данных. Проверьте консоль.</p>');
}); });
selectedFolderId = folderId; selectedFolderId = folderId;
} }
@ -408,7 +398,6 @@
$('.install-item').removeClass('selected'); $('.install-item').removeClass('selected');
$(`#installs-list .install-item[data-id="${installId}"]`).addClass('selected'); $(`#installs-list .install-item[data-id="${installId}"]`).addClass('selected');
updateNotesPanel(); updateNotesPanel();
// Убрано подтверждение, переход сразу
const link = protocolLinks[protocol] + rustId; const link = protocolLinks[protocol] + rustId;
window.location.href = link; window.location.href = link;
} }
@ -598,13 +587,6 @@
}); });
} }
function openRemote(id, protocol) {
if (confirm(`Подключиться к ${id} через ${protocol}?`)) {
const link = protocolLinks[protocol] + id;
window.location.href = link;
}
}
function exportCSV() { function exportCSV() {
const folderId = $('#folder-select').val() || ''; const folderId = $('#folder-select').val() || '';
window.location.href = `${API_URL}/export/csv?folder_id=${folderId}`; window.location.href = `${API_URL}/export/csv?folder_id=${folderId}`;