From 8f4659d2ef1af0d1f0ae9b485b5b901846ccc8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Fri, 8 May 2026 09:19:01 +0400 Subject: [PATCH] =?UTF-8?q?feat:=20v1.3.67=20=E2=80=94=20UI=20table=20refa?= =?UTF-8?q?ctor:=20remove=20Env/Pkg=20columns,=20add=20Type=20icon=20+=20I?= =?UTF-8?q?nfo=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/deploy/console.yaml | 2 +- console/ui/index.html | 19 ++++++++++--- console/ui/js/app.js | 22 +++++++++++---- console/ui/js/modals.js | 55 +++++++++++++++++++++++++++++++++++-- 4 files changed, 86 insertions(+), 12 deletions(-) diff --git a/console/deploy/console.yaml b/console/deploy/console.yaml index 4ad8e5b..9d7c815 100644 --- a/console/deploy/console.yaml +++ b/console/deploy/console.yaml @@ -55,7 +55,7 @@ spec: serviceAccountName: fission-console containers: - name: console - image: naeel/fission-console:v1.3.66 + image: naeel/fission-console:v1.3.67 imagePullPolicy: Always ports: - containerPort: 8090 diff --git a/console/ui/index.html b/console/ui/index.html index c37e953..ad7ea03 100644 --- a/console/ui/index.html +++ b/console/ui/index.html @@ -102,7 +102,7 @@
NUBES
FISSION CONSOLE
-
v1.3.66
+
v1.3.67
@@ -146,8 +146,7 @@ Имя - Окружение - Пакет + Тип Создана Изменена Маршрут @@ -384,6 +383,18 @@
+ + diff --git a/console/ui/js/app.js b/console/ui/js/app.js index 469d86e..6820a0c 100644 --- a/console/ui/js/app.js +++ b/console/ui/js/app.js @@ -5,7 +5,7 @@ async function reloadAll() { // Показываем таблицу сразу с placeholder'ом document.getElementById('fn-rows').innerHTML = - '⏳ Загружаем функции...'; + '⏳ Загружаем функции...'; try { const [envs, pkgs, fns, http, times] = await Promise.all([ @@ -35,6 +35,8 @@ async function reloadAll() { const ann = meta.annotations || {}; const env = (spec.environment && spec.environment.name) || '-'; const pkg = (spec.package && spec.package.packageref && spec.package.packageref.name) || '-'; + const entrypoint = (spec.package && spec.package.functionName) || '-'; + const timeout = spec.functionTimeout || 60; const name = (f.metadata && f.metadata.name) || '-'; const trig = httpTriggerByFn(name) || {}; const timeTrig = timeTriggerByFn(name) || {}; @@ -45,18 +47,28 @@ async function reloadAll() { const cronCell = cron ? '' + h(cron) + '' : ''; const createdAt = ann['fission-console/created-at'] || meta.creationTimestamp || '-'; const updatedAt = ann['fission-console/updated-at'] || createdAt; + const sourceType = ann['fission-console/source-type'] || 'code'; + const sourceIcon = sourceType === 'archive' + ? '📦' + : '📝'; var isGo = /go[-_]env/.test(env); var isTf = /^tf-/.test(name); var tfBadge = (isGo || isTf) ? 'TF ' : ''; + // Сохраняем все данные в data-атрибуте для openInfo (избегаем повторного запроса) + var infoData = h(JSON.stringify({ + name: name, env: env, pkg: pkg, entrypoint: entrypoint, timeout: timeout, + route: route, methods: methods, sourceType: sourceType, + createdAt: createdAt, updatedAt: updatedAt, cron: cron + })); var actions = tfBadge + + ' ' + ' ' + ' ' + ' ' + ''; return '' + '' + h(name) + '' + - '' + h(env) + '' + - '' + h(pkg) + '' + + '' + sourceIcon + '' + '' + timestampCell(createdAt) + '' + '' + timestampCell(updatedAt) + '' + '' + h(route) + '' + @@ -69,7 +81,7 @@ async function reloadAll() { var fnList = fns || []; if (fnList.length === 0) { progress.stop('Загружено: нет функций', ''); - document.getElementById('fn-rows').innerHTML = 'Нет функций'; + document.getElementById('fn-rows').innerHTML = 'Нет функций'; } else { // Рендерим первую строку сразу — убираем placeholder var tbody = document.getElementById('fn-rows'); @@ -90,7 +102,7 @@ async function reloadAll() { setTimeout(appendNext, 40); } } catch (e) { - document.getElementById('fn-rows').innerHTML = 'Load error: ' + e.message + ''; + document.getElementById('fn-rows').innerHTML = 'Load error: ' + e.message + ''; progress.stop('Ошибка загрузки: ' + e.message, 'err'); } } diff --git a/console/ui/js/modals.js b/console/ui/js/modals.js index 0bbdedb..3b1673e 100644 --- a/console/ui/js/modals.js +++ b/console/ui/js/modals.js @@ -46,12 +46,12 @@ function makeDraggable(modalId) { // Инициализация после загрузки DOM document.addEventListener('DOMContentLoaded', function() { - ['create-code-modal', 'create-archive-modal', 'edit-modal', 'help-modal', 'invoke-modal', 'logs-modal'].forEach(makeDraggable); + ['create-code-modal', 'create-archive-modal', 'edit-modal', 'help-modal', 'invoke-modal', 'logs-modal', 'info-modal'].forEach(makeDraggable); // ESC закрывает активное модальное окно document.addEventListener('keydown', function(e) { if (e.key !== 'Escape') return; - var modals = ['create-code-modal', 'create-archive-modal', 'edit-modal', 'help-modal', 'invoke-modal', 'logs-modal']; + var modals = ['create-code-modal', 'create-archive-modal', 'edit-modal', 'help-modal', 'invoke-modal', 'logs-modal', 'info-modal']; for (var i = 0; i < modals.length; i++) { var el = document.getElementById(modals[i]); if (el && el.classList.contains('open')) { @@ -179,3 +179,54 @@ async function _fetchLogs(name) { out.value = 'Ошибка загрузки логов: ' + e.message; } } + +// openInfo — открывает модалку с подробной информацией о функции. +// Данные берутся из data-атрибута кнопки (без дополнительного запроса к API). +function openInfo(name, btn) { + var raw = btn ? btn.getAttribute('data-info') : null; + var info = null; + try { info = raw ? JSON.parse(raw) : null; } catch(e) {} + if (!info) { + document.getElementById('info-rows').innerHTML = 'Нет данных'; + document.getElementById('info-title').textContent = 'Информация: ' + name; + document.getElementById('info-modal').classList.add('open'); + return; + } + + function copyBtn(val) { + return val && val !== '-' + ? ' ' + : ''; + } + + var rows = [ + ['Имя', info.name], + ['Окружение', info.env], + ['Пакет', info.pkg], + ['Entrypoint', info.entrypoint], + ['Таймаут', info.timeout ? info.timeout + ' сек' : '-'], + ['Тип источника', info.sourceType === 'archive' ? '📦 archive' : '📝 code'], + ['Маршрут', info.route], + ['Методы', Array.isArray(info.methods) && info.methods.length ? info.methods.join(', ') : '-'], + ['Cron', info.cron || '-'], + ['Создана', info.createdAt], + ['Изменена', info.updatedAt], + ]; + + var html = rows.map(function(r) { + var val = r[1] || '-'; + return '' + + '' + h(r[0]) + '' + + '' + h(val) + copyBtn(val) + '' + + ''; + }).join(''); + + document.getElementById('info-title').textContent = 'Информация: ' + name; + document.getElementById('info-rows').innerHTML = html; + document.getElementById('info-modal').classList.add('open'); +} + +// closeInfo — закрывает Info-модалку. +function closeInfo() { + document.getElementById('info-modal').classList.remove('open'); +}