Эх сурвалжийг харах

L2 topology: populate history selector from snapshots

clm0081 3 өдөр өмнө
parent
commit
639c41a6ee

+ 18 - 0
web-modules/WecomCenter/assets/l2topology/app.js

@@ -1489,6 +1489,24 @@
       });
     });
     if (el('l2-history-count')) el('l2-history-count').textContent = list.length;
+    // Keep the toolbar selector in sync with the same history list.  The
+    // side panel is the primary entry point; the selector is a shortcut.
+    var sel = el('l2-ts');
+    if (sel) {
+      var old = sel.value;
+      sel.innerHTML = '';
+      var live = document.createElement('option');
+      live.value = '';
+      live.textContent = t('l2.time_live', 'Live');
+      sel.appendChild(live);
+      list.forEach(function (it) {
+        var opt = document.createElement('option');
+        opt.value = String(it.ts || '');
+        opt.textContent = it.captured_at || fmtTs(it.ts);
+        sel.appendChild(opt);
+      });
+      sel.value = used || old || '';
+    }
   }
 
   function esc(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'})[c]; }); }