feat: v1.3.67 — UI table refactor: remove Env/Pkg columns, add Type icon + Info modal
This commit is contained in:
+17
-5
@@ -5,7 +5,7 @@ async function reloadAll() {
|
||||
|
||||
// Показываем таблицу сразу с placeholder'ом
|
||||
document.getElementById('fn-rows').innerHTML =
|
||||
'<tr><td colspan="9" style="color:var(--text-secondary); font-style:italic;">⏳ Загружаем функции...</td></tr>';
|
||||
'<tr><td colspan="8" style="color:var(--text-secondary); font-style:italic;">⏳ Загружаем функции...</td></tr>';
|
||||
|
||||
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 ? '<span class="chip">' + h(cron) + '</span>' : '<span class="mono" style="color:var(--text-secondary)">—</span>';
|
||||
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'
|
||||
? '<span title="Из архива (.zip)" style="font-size:1.1em; cursor:default;">📦</span>'
|
||||
: '<span title="Из кода (редактор)" style="font-size:1.1em; cursor:default;">📝</span>';
|
||||
var isGo = /go[-_]env/.test(env);
|
||||
var isTf = /^tf-/.test(name);
|
||||
var tfBadge = (isGo || isTf) ? '<span class="chip" style="background:#555;color:#ffa" title="Управляется Terraform. Изменения могут быть перезаписаны при terraform apply.">TF</span> ' : '';
|
||||
// Сохраняем все данные в 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 +
|
||||
'<button class="btn ghost" onclick="openInfo(\'' + h(name) + '\', this)" data-info="' + infoData + '">Info</button> ' +
|
||||
'<button class="btn ghost" onclick="openEdit(\'' + h(name) + '\')">Ред.</button> ' +
|
||||
'<button class="btn ghost" onclick="openInvoke(\'' + h(name) + '\')">Вызов</button> ' +
|
||||
'<button class="btn ghost" onclick="openLogs(\'' + h(name) + '\')">Логи</button> ' +
|
||||
'<button class="btn danger" onclick="removeFn(\'' + h(name) + '\')">Удалить</button>';
|
||||
return '<tr>' +
|
||||
'<td class="mono">' + h(name) + '</td>' +
|
||||
'<td>' + h(env) + '</td>' +
|
||||
'<td class="mono">' + h(pkg) + '</td>' +
|
||||
'<td style="text-align:center;">' + sourceIcon + '</td>' +
|
||||
'<td>' + timestampCell(createdAt) + '</td>' +
|
||||
'<td>' + timestampCell(updatedAt) + '</td>' +
|
||||
'<td class="mono">' + h(route) + '</td>' +
|
||||
@@ -69,7 +81,7 @@ async function reloadAll() {
|
||||
var fnList = fns || [];
|
||||
if (fnList.length === 0) {
|
||||
progress.stop('Загружено: нет функций', '');
|
||||
document.getElementById('fn-rows').innerHTML = '<tr><td colspan="9">Нет функций</td></tr>';
|
||||
document.getElementById('fn-rows').innerHTML = '<tr><td colspan="8">Нет функций</td></tr>';
|
||||
} 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 = '<tr><td colspan="9">Load error: ' + e.message + '</td></tr>';
|
||||
document.getElementById('fn-rows').innerHTML = '<tr><td colspan="8">Load error: ' + e.message + '</td></tr>';
|
||||
progress.stop('Ошибка загрузки: ' + e.message, 'err');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user