plugins: persist owner chip in glance strip across JS updates

Store owner in data-owner attribute; updateHostHeader always prepends it
so it survives innerHTML replacement. Render it immediately on page load
before JS fetches plugin data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-08 09:57:58 -04:00
parent 1a19088cfe
commit b81a0d2a6c
+9 -4
View File
@@ -416,11 +416,9 @@
<span class="host-name">{{ host.name }}</span> <span class="host-name">{{ host.name }}</span>
</div> </div>
<div class="glance-strip" id="glance-{{ host.name }}"> <div class="glance-strip" id="glance-{{ host.name }}" data-owner="{{ host.owner or '' }}">
{% if current_user and current_user.admin and host.owner %}<span class="glance-chip neutral">{{ host.owner }}</span>{% endif %}
<span class="glance-loading"></span> <span class="glance-loading"></span>
{% if current_user and current_user.admin and host.owner %}
<span class="glance-chip neutral">{{ host.owner }}</span>
{% endif %}
</div> </div>
<div class="host-right"> <div class="host-right">
@@ -483,6 +481,7 @@
const GLANCE_PLUGINS = ['cpu_monitor','memory_monitor','disk_monitor', const GLANCE_PLUGINS = ['cpu_monitor','memory_monitor','disk_monitor',
'network_monitor','nagios_runner','os_info']; 'network_monitor','nagios_runner','os_info'];
const SKIP_FIELDS = new Set(['id','name']); const SKIP_FIELDS = new Set(['id','name']);
const CURRENT_USER_ADMIN = {{ 'true' if current_user and current_user.admin else 'false' }};
// ── Cache ─────────────────────────────────────────────────────────────── // ── Cache ───────────────────────────────────────────────────────────────
@@ -561,6 +560,12 @@
const chips = []; const chips = [];
// Owner (admin only, static from server)
const owner = strip.dataset.owner;
if (CURRENT_USER_ADMIN && owner) {
chips.push(`<span class="glance-chip neutral">${owner}</span>`);
}
// CPU // CPU
const cpu = getCache(hostname, 'cpu_monitor'); const cpu = getCache(hostname, 'cpu_monitor');
if (cpu) { if (cpu) {