index.html: full rewrite - Sidebar (192px/72px, blue top border): Верстак/Обзор/История/Сценарии/Логи - Views: workbench (service left rail + instances/params right), overview, history, scenarios, logs - Token form moved to sidebar bottom - All existing DOM ids preserved: inst-list, params-area, params-form, btn-test, test-status, create-btn-area, history-card, history-body, scenario-card, scenario-body - Log panel adjusted: left 72px (sidebar width) - Fonts increased: 12-14px views.js (NEW): switchView(id) — show/hide views, auto-load content on open
23 lines
1.1 KiB
JavaScript
23 lines
1.1 KiB
JavaScript
// views.js — переключение видов (sidebar navigation)
|
|
|
|
function switchView(viewId) {
|
|
document.querySelectorAll('.view').forEach(v => v.classList.add('hidden'));
|
|
const target = document.getElementById('view-' + viewId);
|
|
if (target) target.classList.remove('hidden');
|
|
// Подсветка активного пункта
|
|
document.querySelectorAll('.sidebar-item').forEach(el => el.classList.remove('active'));
|
|
const btn = document.querySelector('.sidebar-item[data-view="' + viewId + '"]');
|
|
if (btn) btn.classList.add('active');
|
|
// Автозагрузка при открытии вида
|
|
if (viewId === 'history-view' && typeof toggleHistory === 'function') {
|
|
if (!historyOpen) toggleHistory();
|
|
}
|
|
if (viewId === 'scenarios-view' && typeof toggleScenario === 'function') {
|
|
if (!scenarioOpen) toggleScenario();
|
|
}
|
|
if (viewId === 'logs-view' && typeof toggleLog === 'function') {
|
|
const lp = document.getElementById('log-panel');
|
|
if (lp && lp.style.display === 'none') toggleLog();
|
|
}
|
|
}
|