v1.1.57: fix scenario editor body bug + relativeTime columns + infra UUIDs
- scenario-form.js: fix ReferenceError body is not defined in renderEditor() - utils.js: relativeTime(iso) → 3ч 12м / 2д 5ч / только что - instances.js: columns created / modified with relativeTime() - index.html: instanceUid under displayName in infra column
This commit is contained in:
@@ -35,8 +35,10 @@ function renderInstances(){
|
||||
const sc=status==='running'?'badge-success':'';
|
||||
html+=`<div class="inst-item" onclick="toggleInstance('${i.instanceUid}')" data-iuid="${i.instanceUid}">
|
||||
<span style="display:inline-block;width:220px;">${_esc(i.displayName)}</span>
|
||||
<span style="display:inline-block;width:160px;color:var(--muted);font-size:11px;">${_esc(i.svc||'')}</span>
|
||||
<span style="display:inline-block;width:140px;color:var(--muted);font-size:11px;">${_esc(i.svc||'')}</span>
|
||||
<span class="badge ${sc}" style="font-size:9px;">${_esc(status)}</span>
|
||||
<span style="display:inline-block;width:60px;color:var(--muted);font-size:9px;text-align:right;" title="${i.instanceConfigDtCreated||''}">${relativeTime(i.instanceConfigDtCreated)}</span>
|
||||
<span style="display:inline-block;width:60px;color:var(--muted);font-size:9px;text-align:right;" title="${i.instanceConfigDtModified||''}">${relativeTime(i.instanceConfigDtModified)}</span>
|
||||
</div>`;
|
||||
html+=`<div class="inst-ops" id="ops-${i.instanceUid}"></div>`;
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ function showScenarioEditor(def) {
|
||||
}
|
||||
|
||||
function renderEditor() {
|
||||
const body = document.getElementById('scenario-body');
|
||||
const st = scenarioEditorState;
|
||||
let html = '<div style="font-size:12px;">';
|
||||
html += '<div style="margin-bottom:6px;"><label style="font-size:11px;">Название:</label><br>';
|
||||
|
||||
@@ -43,3 +43,18 @@ function toggleLog(){
|
||||
if(el.style.display==='none'){ el.style.display='block'; startLogPoll(); }
|
||||
else el.style.display='none';
|
||||
}
|
||||
|
||||
function relativeTime(iso) {
|
||||
if (!iso) return '-';
|
||||
const d = new Date(iso);
|
||||
if (isNaN(d.getTime())) return '-';
|
||||
const sec = Math.floor((Date.now() - d.getTime()) / 1000);
|
||||
if (sec < 0) return 'только что';
|
||||
if (sec < 60) return sec + 'с';
|
||||
const min = Math.floor(sec / 60);
|
||||
if (min < 60) return min + 'м';
|
||||
const hr = Math.floor(min / 60);
|
||||
if (hr < 24) return hr + 'ч ' + (min % 60) + 'м';
|
||||
const days = Math.floor(hr / 24);
|
||||
return days + 'д ' + (hr % 24) + 'ч';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user