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:
@@ -416,11 +416,9 @@
|
||||
<span class="host-name">{{ host.name }}</span>
|
||||
</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>
|
||||
{% if current_user and current_user.admin and host.owner %}
|
||||
<span class="glance-chip neutral">{{ host.owner }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="host-right">
|
||||
@@ -483,6 +481,7 @@
|
||||
const GLANCE_PLUGINS = ['cpu_monitor','memory_monitor','disk_monitor',
|
||||
'network_monitor','nagios_runner','os_info'];
|
||||
const SKIP_FIELDS = new Set(['id','name']);
|
||||
const CURRENT_USER_ADMIN = {{ 'true' if current_user and current_user.admin else 'false' }};
|
||||
|
||||
// ── Cache ───────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -561,6 +560,12 @@
|
||||
|
||||
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
|
||||
const cpu = getCache(hostname, 'cpu_monitor');
|
||||
if (cpu) {
|
||||
|
||||
Reference in New Issue
Block a user