Monitor partner card: onboard phase indicator per remote host
vv_partner_state() now reads setup.db and adds onboard_phase (0/1/2/null) to each host entry. Partner card JS renders a badge under the hostname for remote hosts that haven't completed Phase 2: amber "Awaiting onboard" (phase 1) or grey "Not provisioned" (phase 0). Phase 2 complete shows nothing extra.
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,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user