new drastic
This commit is contained in:
+23
-29
@@ -5,7 +5,7 @@
|
||||
<title>Органайзер АйТи-Депо</title>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.12/jstree.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <!-- Библиотека для Markdown -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.12/themes/default/style.min.css">
|
||||
<style>
|
||||
body {
|
||||
@@ -36,11 +36,11 @@
|
||||
margin: 2px 0;
|
||||
background: #fff;
|
||||
cursor: move;
|
||||
color: #000; /* Цвет текста в светлой теме */
|
||||
color: #000;
|
||||
}
|
||||
.install-item.dark-theme {
|
||||
background: #2a2a2a;
|
||||
color: #e0e0e0; /* Цвет текста в тёмной теме */
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.install-item.selected { background-color: #e6f7ff; }
|
||||
.install-item.selected.dark-theme { background-color: #003a6d; }
|
||||
@@ -110,11 +110,11 @@
|
||||
border-collapse: collapse;
|
||||
background: #f0f0f0;
|
||||
cursor: pointer;
|
||||
color: #000; /* Цвет текста в светлой теме */
|
||||
color: #000;
|
||||
}
|
||||
.header.dark-theme {
|
||||
background: #333;
|
||||
color: #e0e0e0; /* Цвет текста в тёмной теме */
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.header > div {
|
||||
display: table-cell;
|
||||
@@ -124,11 +124,11 @@
|
||||
}
|
||||
.header > div:hover {
|
||||
background: #e0e0e0;
|
||||
color: #000; /* Тёмный текст на светлом фоне в светлой теме */
|
||||
color: #000;
|
||||
}
|
||||
.header.dark-theme > div:hover {
|
||||
background: #444;
|
||||
color: #e0e0e0; /* Светлый текст на тёмном фоне в темной теме */
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.sort-arrow { font-size: 12px; margin-left: 5px; }
|
||||
.protocol-icon {
|
||||
@@ -300,7 +300,7 @@
|
||||
</div>
|
||||
<div id="installs-container">
|
||||
<h1 class="header-logo">
|
||||
<img src="/icons/it-depo-logo.png" alt="АйТи-Депо логотип"> <!-- Логотип -->
|
||||
<img src="/icons/it-depo-logo.png" alt="АйТи-Депо логотип">
|
||||
Органайзер АйТи-Депо
|
||||
<button class="theme-toggle" onclick="toggleTheme()">Темная тема</button>
|
||||
</h1>
|
||||
@@ -345,7 +345,6 @@
|
||||
<div id="notes-content"></div>
|
||||
</div>
|
||||
|
||||
<!-- Модальное окно для редактирования заметок -->
|
||||
<div id="modal-overlay"></div>
|
||||
<div id="note-modal">
|
||||
<h3>Редактировать заметку</h3>
|
||||
@@ -360,10 +359,10 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const API_URL = "/api"; // Замени <server-ip> на IP или домен сервера
|
||||
const API_URL = "/api";
|
||||
let selectedFolderId = null;
|
||||
let allInstalls = [];
|
||||
let allFolders = []; // Добавляем для отслеживания папок
|
||||
let allFolders = [];
|
||||
let selectedInstallId = null;
|
||||
let sortField = null;
|
||||
let sortDirection = 'asc';
|
||||
@@ -386,7 +385,6 @@
|
||||
'rdp': 'rdp://'
|
||||
};
|
||||
|
||||
// Проверка и применение сохранённой темы
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
if (savedTheme === 'dark') {
|
||||
@@ -399,10 +397,8 @@
|
||||
document.getElementById('import-label').classList.add('dark-theme');
|
||||
document.querySelector('.theme-toggle').classList.add('dark-theme');
|
||||
document.querySelector('.theme-toggle').textContent = 'Светлая тема';
|
||||
// Применяем темную тему к уже загруженным элементам таблицы
|
||||
document.querySelectorAll('.install-item').forEach(item => item.classList.add('dark-theme'));
|
||||
document.querySelector('.header').classList.add('dark-theme');
|
||||
// Добавляем класс для темной темы в jstree
|
||||
$('#folder-tree').addClass('jstree-default-dark');
|
||||
}
|
||||
});
|
||||
@@ -452,18 +448,15 @@
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// Загружаем все папки и записи при инициализации
|
||||
loadFolders();
|
||||
loadInstalls(null);
|
||||
|
||||
// Инициализация дерева папок с настройками для темной темы
|
||||
$('#folder-tree').jstree({
|
||||
'core': {
|
||||
'data': function (node, cb) {
|
||||
$.getJSON(`${API_URL}/folders`, function (data) {
|
||||
console.log("Loaded folders:", data);
|
||||
allFolders = data; // Сохраняем все папки
|
||||
// Сортируем папки по имени
|
||||
allFolders = data;
|
||||
const sortedFolders = [...data].sort((a, b) => a.name.localeCompare(b.name));
|
||||
const treeData = [
|
||||
{ id: "root", text: "Корень", parent: "#" }
|
||||
@@ -476,7 +469,6 @@
|
||||
})));
|
||||
cb(treeData);
|
||||
|
||||
// Автоматически выбираем папку "Несортированные" после загрузки дерева
|
||||
const unsortedFolder = sortedFolders.find(f => f.name === 'Несортированные');
|
||||
if (unsortedFolder) {
|
||||
setTimeout(() => {
|
||||
@@ -491,7 +483,7 @@
|
||||
},
|
||||
'check_callback': true,
|
||||
'themes': {
|
||||
'variant': 'default-dark' // Устанавливаем темную тему по умолчанию для jstree
|
||||
'variant': 'default-dark'
|
||||
}
|
||||
},
|
||||
'plugins': ['dnd', 'html_data'],
|
||||
@@ -508,7 +500,6 @@
|
||||
saveFolderPosition(movedNode.id, newParentId);
|
||||
});
|
||||
|
||||
// Обработчики для поиска и выбора папки
|
||||
$('#search-input').on('input', function () {
|
||||
performSearch();
|
||||
});
|
||||
@@ -517,7 +508,6 @@
|
||||
performSearch();
|
||||
});
|
||||
|
||||
// Drag-and-drop для записей
|
||||
$('#installs-list').on('dragstart', '.install-item', function (e) {
|
||||
console.log('Drag start:', $(this).data('id'));
|
||||
e.originalEvent.dataTransfer.setData('text/plain', $(this).data('id'));
|
||||
@@ -542,9 +532,8 @@
|
||||
|
||||
function loadFolders() {
|
||||
$.getJSON(`${API_URL}/folders`, function (data) {
|
||||
// Сортируем папки по имени перед сохранением
|
||||
allFolders = [...data].sort((a, b) => a.name.localeCompare(b.name));
|
||||
updateFolderSelect(); // Обновляем выпадающий список
|
||||
updateFolderSelect();
|
||||
}).fail(function(jqxhr, textStatus, error) {
|
||||
console.error("Error loading folders:", textStatus, error);
|
||||
});
|
||||
@@ -618,7 +607,7 @@
|
||||
|
||||
function sortInstalls(field, filteredInstalls = null) {
|
||||
let installs = filteredInstalls || (selectedFolderId
|
||||
? allInstalls.filter(i => i.folder_id == folderId && i.folder_id !== null)
|
||||
? allInstalls.filter(i => i.folder_id == selectedFolderId && i.folder_id !== null)
|
||||
: allInstalls);
|
||||
|
||||
if (field) {
|
||||
@@ -755,10 +744,9 @@
|
||||
if (field === 'install_time') {
|
||||
data['folder_id'] = selectedFolderId;
|
||||
}
|
||||
// Добавляем текущее значение protocol
|
||||
const install = allInstalls.find(i => i.id === installId);
|
||||
if (install) {
|
||||
data['protocol'] = install.protocol;
|
||||
data['protocol'] = install.protocol; // Сохраняем текущий protocol
|
||||
}
|
||||
$.ajax({
|
||||
url: `${API_URL}/install/${installId}`,
|
||||
@@ -793,12 +781,18 @@
|
||||
|
||||
function moveInstallToFolder(installId, folderId) {
|
||||
console.log('Moving installId:', installId, 'to folderId:', folderId);
|
||||
const install = allInstalls.find(i => i.id === parseInt(installId));
|
||||
if (!install) {
|
||||
console.error('Install not found:', installId);
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: `${API_URL}/install/${installId}`,
|
||||
type: 'PUT',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
folder_id: folderId
|
||||
folder_id: folderId,
|
||||
protocol: install.protocol // Добавляем текущее значение protocol
|
||||
}),
|
||||
success: function () {
|
||||
console.log('Move successful');
|
||||
@@ -863,7 +857,7 @@
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
note: note,
|
||||
protocol: install.protocol
|
||||
protocol: install.protocol // Сохраняем текущий protocol
|
||||
}),
|
||||
success: function () {
|
||||
loadInstalls(selectedFolderId);
|
||||
|
||||
Reference in New Issue
Block a user