From 2133a1b2fe2d45c7f349bb0ad01d20f20a83d367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Fri, 31 Jul 2026 13:16:50 +0400 Subject: [PATCH] =?UTF-8?q?v1.2.9:=20Phase=201=20=E2=80=94=20sidebar=20+?= =?UTF-8?q?=20views=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- site/app.py | 2 +- site/static/js/views.js | 22 ++++ site/templates/index.html | 209 ++++++++++++++++++++------------------ 3 files changed, 134 insertions(+), 99 deletions(-) create mode 100644 site/static/js/views.js diff --git a/site/app.py b/site/app.py index 4be2fba..0ec72e0 100644 --- a/site/app.py +++ b/site/app.py @@ -19,7 +19,7 @@ from routes.api_scenario_run import bp_run as api_scenario_run_bp from routes.api_scenario_defs import bp_defs as api_scenario_defs_bp # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. -VERSION = "1.2.8" +VERSION = "1.2.9" app = Flask(__name__, template_folder="templates", static_folder="static") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc") diff --git a/site/static/js/views.js b/site/static/js/views.js new file mode 100644 index 0000000..8f65f6b --- /dev/null +++ b/site/static/js/views.js @@ -0,0 +1,22 @@ +// 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(); + } +} diff --git a/site/templates/index.html b/site/templates/index.html index ea6193a..8995382 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -6,15 +6,9 @@ - + -
- Nubes - v{{ config.VERSION }} - {% if token_info.email %}EMail: {{ token_info.email }} | Профиль: {{ token_info.company }} | Стенд: {{ stand.upper() }}{% endif %} - -
- - - {% if has_user_token %}{% endif %} -
- {% if error %}{{ error }}{% endif %} + +
+
Верстак
+
+
+
+
Сервисы
+
+ {% for svc in services %}{% if svc.svcId in config.service_ids %}
{{ svc.svcId }}. {{ svc.svc }}
{% endif %}{% endfor %} +
+
+
+
+
+
Инстансы
+
+ Загрузка... +
+
+ +
+
+ + Создать новый инстанс +
+
+
+
-
- -
- {% if organization %} -
-
Организация
-
- {{ organization.displayName }}{% if client_id %} ({{ client_id }}){% endif %}
- {{ organization.explainedStatus or "OK" }} -
+ + - -
-
-
Сервисы
-
- {% for svc in services %}{% if svc.svcId in config.service_ids %}
{{ svc.svcId }}. {{ svc.svc }}
{% endif %}{% endfor %} -
+ + - -
-
-
Инстансы
-
- Загрузка... -
-
- -
-
- + Создать новый инстанс -
-
-
-
История (последние 50)
- -
-
-
Сценарии (автотесты)
- + + + + + + @@ -165,8 +178,8 @@ window.APP = { - - + + - \ No newline at end of file +