feat: v1.3.67 — UI table refactor: remove Env/Pkg columns, add Type icon + Info modal
This commit is contained in:
+53
-2
@@ -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 = '<tr><td colspan="2">Нет данных</td></tr>';
|
||||
document.getElementById('info-title').textContent = 'Информация: ' + name;
|
||||
document.getElementById('info-modal').classList.add('open');
|
||||
return;
|
||||
}
|
||||
|
||||
function copyBtn(val) {
|
||||
return val && val !== '-'
|
||||
? ' <button class="btn ghost" style="padding:1px 6px; font-size:11px;" onclick="navigator.clipboard.writeText(\'' + val.replace(/\\/g, '\\\\').replace(/'/g, "\\'") + '\')">📋</button>'
|
||||
: '';
|
||||
}
|
||||
|
||||
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 '<tr>' +
|
||||
'<td style="color:var(--text-secondary);padding:4px 10px 4px 0;white-space:nowrap;vertical-align:top;">' + h(r[0]) + '</td>' +
|
||||
'<td class="mono" style="word-break:break-all;padding:4px 0;">' + h(val) + copyBtn(val) + '</td>' +
|
||||
'</tr>';
|
||||
}).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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user