Обновление интерфейса: улучшения в templates/index.html

This commit is contained in:
Sergey Antropoff 2025-08-18 18:19:09 +03:00
parent 7cd7ba0653
commit 2d565d52a6

View File

@ -433,12 +433,19 @@ a{color:var(--link)}
border-color: var(--accent);
}
.options-btn.active {
/* Кнопка options когда меню открыто (неактивное состояние) */
.options-btn:not(.active) {
background: var(--accent);
color: #0b0d12;
border-color: var(--accent);
}
.options-btn.active {
background: var(--chip);
color: var(--muted);
border-color: var(--border);
}
.logout-btn:hover {
background: var(--err);
color: #fff;
@ -3133,6 +3140,9 @@ function updateContainerSelectionUI() {
}
}
}
// Обновляем видимость кнопок LogLevels
updateLogLevelsVisibility();
}
// Функция для сохранения выбранного контейнера в localStorage
@ -3268,6 +3278,9 @@ async function updateMultiViewMode() {
setTimeout(() => {
initializeLevelButtons();
}, 100);
// Обновляем видимость кнопок LogLevels
updateLogLevelsVisibility();
}
async function setupMultiView() {
@ -3397,6 +3410,9 @@ async function setupMultiView() {
setTimeout(() => {
updateLogStyles();
}, 1500); // Задержка после настройки счетчиков
// Обновляем видимость кнопок LogLevels
updateLogLevelsVisibility();
}
function createMultiViewPanel(service) {
@ -3616,6 +3632,9 @@ function clearLogArea() {
if (logTitle) {
logTitle.textContent = 'LogBoard+';
}
// Обновляем видимость кнопок LogLevels
updateLogLevelsVisibility();
}
@ -3713,18 +3732,14 @@ async function fetchServices(){
await switchToSingle(selectedService);
}
} else {
// Нет сохраненного режима, используем первый контейнер
console.log('No saved view mode, using first container');
if (state.services.length) {
await switchToSingle(state.services[0]);
}
// Нет сохраненного режима, не открываем автоматически первый контейнер
console.log('No saved view mode, not auto-opening first container');
// Пользователь сам выберет нужный контейнер
}
} else {
// Нет сохраненного режима, используем первый контейнер
console.log('No saved view mode found, using first container');
if (state.services.length) {
await switchToSingle(state.services[0]);
}
// Нет сохраненного режима, не открываем автоматически первый контейнер
console.log('No saved view mode found, not auto-opening first container');
// Пользователь сам выберет нужный контейнер
}
// Добавляем обработчики для счетчиков после загрузки сервисов
@ -5340,6 +5355,33 @@ function updateCounterVisibility() {
}
}
// Функция для управления видимостью кнопок LogLevels
function updateLogLevelsVisibility() {
const singleViewLevels = document.querySelector('.single-view-levels');
const multiViewLevels = document.querySelectorAll('.multi-view-levels');
// Проверяем, есть ли выбранные контейнеры
const hasSelectedContainers = state.selectedContainers.length > 0 || state.current;
// Управляем видимостью кнопок в single view
if (singleViewLevels) {
if (hasSelectedContainers) {
singleViewLevels.style.display = 'flex';
} else {
singleViewLevels.style.display = 'none';
}
}
// Управляем видимостью кнопок в multi view
multiViewLevels.forEach(levelsContainer => {
if (hasSelectedContainers) {
levelsContainer.style.display = 'flex';
} else {
levelsContainer.style.display = 'none';
}
});
}
// Функция для обновления логов и счетчиков
async function refreshLogsAndCounters() {
if (state.multiViewMode && state.selectedContainers.length > 0) {
@ -5500,10 +5542,9 @@ els.refreshBtn.onclick = async () => {
// Переключаемся на обновленный контейнер
await switchToSingle(updatedContainer);
} else {
// Если контейнер больше не существует, переключаемся на первый доступный
if (state.services.length > 0) {
await switchToSingle(state.services[0]);
}
// Если контейнер больше не существует, не открываем автоматически первый доступный
// Пользователь сам выберет нужный контейнер
console.log('Container no longer exists, not auto-opening first available container');
}
}
};
@ -6634,6 +6675,9 @@ window.addEventListener('keydown', async (e)=>{
cleanDuplicateLines(els.logContent);
}
}, 1000);
// Инициализируем видимость кнопок LogLevels
updateLogLevelsVisibility();
})();
</script>