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:
+1
-1
@@ -19,7 +19,7 @@ from routes.api_scenario_run import bp_run as api_scenario_run_bp
|
||||
from routes.api_scenario_defs import bp_defs as api_scenario_defs_bp
|
||||
|
||||
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
||||
VERSION = "1.1.56"
|
||||
VERSION = "1.1.57"
|
||||
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
|
||||
|
||||
@@ -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) + 'ч';
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<div class="card-body" style="padding:0;max-height:150px;overflow-y:auto;">
|
||||
<table>
|
||||
{% for i in items %}
|
||||
<tr><td style="font-size:11px;padding:2px 8px;">{{ i.displayName }}</td><td><span class="badge badge-success" style="font-size:9px;">{{ i.explainedStatus or '?' }}</span></td></tr>
|
||||
<tr><td style="font-size:11px;padding:2px 8px;">{{ i.displayName }}<br><span style="color:var(--muted);font-size:9px;">{{ i.instanceUid }}</span></td><td><span class="badge badge-success" style="font-size:9px;">{{ i.explainedStatus or '?' }}</span></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user