feat: функции со статусом (Ready/Cold/Building/Error)

- Backend: новый файл status.go с функцией определения статуса пода и Package buildStatus
- API: GET /functions теперь возвращает функции с полем status в аннотациях
- Frontend: добавлена колонка Status в таблицу функций с цветными кругами
- Легенда статусов выше таблицы
- Версия v1.3.70
This commit is contained in:
“Naeel”
2026-05-09 06:29:46 +04:00
parent 810980cfcd
commit f6f9382887
6 changed files with 189 additions and 6 deletions
+15 -2
View File
@@ -102,7 +102,7 @@
<div class="nubes">NUBES</div>
<div class="product">FISSION CONSOLE</div>
</div>
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.69</div>
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.70</div>
</div>
<div class="row" style="margin:0;">
<button class="btn ghost" onclick="reloadAll()">Refresh</button>
@@ -142,10 +142,23 @@
<div style="font-weight:600;">Функции</div>
<div class="hint">Actions: view, edit code, invoke, delete</div>
</div>
<!-- Легенда статусов -->
<div style="margin-bottom:12px; padding:8px; background:var(--bg-alt); border-radius:4px; font-size:0.9em; color:var(--text-secondary);">
<strong>Статусы функций:</strong>
<span style="margin-left:16px;">
<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background:#2a2; vertical-align:middle;"></span> Готова
<span style="margin-left:12px; display:inline-block; width:10px; height:10px; border-radius:50%; background:#22a; vertical-align:middle;"></span> Холодная
<span style="margin-left:12px; display:inline-block; width:10px; height:10px; border-radius:50%; background:#aa2; vertical-align:middle;"></span> Сборка
<span style="margin-left:12px; display:inline-block; width:10px; height:10px; border-radius:50%; background:#a22; vertical-align:middle;"></span> Ошибка
</span>
</div>
<table>
<thead>
<tr>
<th>Имя</th>
<th title="Статус функции (Готова / Холодная / Сборка / Ошибка)">Статус</th>
<th title="Тип источника функции">Тип</th>
<th>Создана</th>
<th>Изменена</th>
@@ -485,7 +498,7 @@
</div>
<div class="actions" style="justify-content:space-between; align-items:center;">
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.69</span>
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.70</span>
<button class="btn ghost" onclick="closeHelp()">Закрыть</button>
</div>
</div>
+16 -1
View File
@@ -48,6 +48,20 @@ async function reloadAll() {
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 status = ann['fission-console/status'] || 'Cold';
// Статус функции: иконка и цвет
const statusColor = {
'Ready': '#2a2', 'Cold': '#22a', 'Building': '#aa2', 'Error': '#a22'
}[status] || '#666';
const statusTitle = {
'Ready': 'Готова (есть pod)',
'Cold': 'Холодная (pod создаётся при первом вызове)',
'Building': 'Собирается / деплоится',
'Error': 'Ошибка (pod в CrashLoopBackOff или build failed)'
}[status] || 'Неизвестно';
const statusDot = '<span style="display:inline-block; width:12px; height:12px; border-radius:50%; background:' + statusColor + '; cursor:default;" title="' + h(statusTitle) + '"></span>';
const sourceIcon = sourceType === 'archive'
? '<span title="Из архива (.zip)" style="font-size:1.1em; cursor:default;">📦</span>'
: '<span title="Из кода (редактор)" style="font-size:1.1em; cursor:default;">📝</span>';
@@ -58,7 +72,7 @@ async function reloadAll() {
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
createdAt: createdAt, updatedAt: updatedAt, cron: cron, status: status
}));
var actions = tfBadge +
'<button class="btn ghost" onclick="openInfo(\'' + h(name) + '\', this)" data-info="' + infoData + '">Info</button> ' +
@@ -68,6 +82,7 @@ async function reloadAll() {
'<button class="btn danger" onclick="removeFn(\'' + h(name) + '\')">Удалить</button>';
return '<tr>' +
'<td class="mono">' + h(name) + '</td>' +
'<td style="text-align:center;">' + statusDot + '</td>' +
'<td style="text-align:center;">' + sourceIcon + '</td>' +
'<td>' + timestampCell(createdAt) + '</td>' +
'<td>' + timestampCell(updatedAt) + '</td>' +