Monitor partner card: onboard phase badges (re-add)
This commit is contained in:
@@ -20,6 +20,8 @@ function vv_partner_state(): array {
|
||||
$hostIds = array_filter(array_keys($vars), fn($k) => preg_match('/^HOST\d+$/', $k) && ($vars[$k] ?? '') !== '');
|
||||
sort($hostIds);
|
||||
|
||||
$setupDb = vv_setup_state_read();
|
||||
|
||||
$hosts = [];
|
||||
foreach ($hostIds as $id) {
|
||||
$hostname = $vars[$id] ?? '';
|
||||
@@ -27,13 +29,17 @@ function vv_partner_state(): array {
|
||||
$isMe = strcasecmp($hostname, $myName) === 0;
|
||||
$isOwner = strcasecmp($id, $vars['PARTNERSHIP_OWNER_HOST'] ?? '') === 0;
|
||||
$online = $isMe ? true : ($tsPeers[strtolower($hostname)] ?? null);
|
||||
$onboardPhase = $isMe ? null
|
||||
: (($setupDb[$id . '_PHASE2_DONE'] ?? '') === 'true' ? 2
|
||||
: (($setupDb[$id . '_PHASE1_DONE'] ?? '') === 'true' ? 1 : 0));
|
||||
$hosts[] = [
|
||||
'id' => $id,
|
||||
'hostname' => $hostname,
|
||||
'owner' => $vars[$id . '_OWNER'] ?? '',
|
||||
'is_me' => $isMe,
|
||||
'is_owner' => $isOwner,
|
||||
'online' => $online,
|
||||
'id' => $id,
|
||||
'hostname' => $hostname,
|
||||
'owner' => $vars[$id . '_OWNER'] ?? '',
|
||||
'is_me' => $isMe,
|
||||
'is_owner' => $isOwner,
|
||||
'online' => $online,
|
||||
'onboard_phase' => $onboardPhase,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -632,6 +632,14 @@ function vvPollMonitor() {
|
||||
h.is_owner ? `<span style="background:#1a2a3a;color:#4a9eff;font-size:8px;padding:1px 5px;border-radius:3px;margin-left:4px;">OWNER</span>` : '',
|
||||
].join('');
|
||||
|
||||
// Onboard phase badge for remote hosts not yet fully onboarded
|
||||
const phase = h.onboard_phase ?? null;
|
||||
const onboardBadge = (!h.is_me && phase !== null && phase < 2)
|
||||
? (phase === 1
|
||||
? `<div style="font-size:9px;color:#ff9800;margin-top:3px;padding:2px 5px;background:#1a1200;border:1px solid #3a2800;border-radius:3px;display:inline-block;">⏳ Awaiting onboard</div>`
|
||||
: `<div style="font-size:9px;color:#444;margin-top:3px;padding:2px 5px;background:#111;border:1px solid #222;border-radius:3px;display:inline-block;">○ Not provisioned</div>`)
|
||||
: '';
|
||||
|
||||
// Remote stats from Unraid API (only available for non-self hosts with an API key)
|
||||
const rs = !h.is_me ? (ptRemote[h.id] ?? null) : null;
|
||||
let statsHtml = '';
|
||||
@@ -677,6 +685,7 @@ function vvPollMonitor() {
|
||||
<span style="font-size:10px;color:#555;margin-right:4px;">${h.id}</span>
|
||||
<span style="font-size:12px;color:#ccc;font-weight:500;">${h.owner || h.hostname}</span>${tags}
|
||||
<div style="font-size:10px;color:#555;margin-top:1px;">${h.hostname}</div>
|
||||
${onboardBadge}
|
||||
</div>
|
||||
<span style="color:${dot};font-size:10px;white-space:nowrap;">● ${label}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user