Remove outdated edge gateway object classes, add new agent implementation

Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
This commit is contained in:
Jeppe Bundgaard
2026-04-21 14:13:17 +02:00
parent d30a006457
commit 7d450e285e
90 changed files with 11811 additions and 2760 deletions
@@ -0,0 +1,91 @@
<?php
app_require('classes/edge_gateway_manager.php');
use classes\edge_gateway_manager;
it('summarizes fleet usage statistics for the dashboard landing view', function (): void {
$summary = edge_gateway_manager::summarizeFleetUsage([
[
'id' => 701,
'department_id' => 1,
'status' => edge_gateway_manager::STATUS_ONLINE,
'version_drift' => ['is_drifted' => true],
'channel_status' => ['broker' => ['connected' => true]],
'active_operation' => ['id' => 91, 'type' => 'DISCOVERY'],
'recent_operations_summary' => ['pending' => 1, 'in_progress' => 1],
'backlog_depth' => ['operations' => 2, 'commands' => 3],
'metadata' => [
'system_metrics' => [
'latency_ms' => 184,
'cpu_usage_pct' => 27,
'memory_usage_pct' => 61,
'disk_usage_pct' => 58,
],
],
],
[
'id' => 702,
'department_id' => 2,
'status' => edge_gateway_manager::STATUS_OFFLINE,
'version_drift' => ['is_drifted' => false],
'channel_status' => ['broker' => ['connected' => false]],
'active_operation' => null,
'recent_operations_summary' => ['pending' => 0, 'in_progress' => 0],
'backlog_depth' => ['operations' => 0, 'commands' => 1],
'metadata' => [
'system_metrics' => [
'latency_ms' => 412,
'cpu_usage_pct' => 9,
'memory_usage_pct' => 42,
'disk_usage_pct' => 76,
],
],
],
], [
'total' => 2,
'online' => 1,
'offline' => 1,
], [
'total' => 3,
'fallback_overrides' => 2,
'cloud_only' => 1,
'local_only' => 1,
]);
expect($summary['gateways'])->toBe([
'total' => 2,
'departments' => 2,
'online' => 1,
'offline' => 1,
'degraded' => 0,
'drifted' => 1,
'broker_connected' => 1,
]);
expect($summary['inventory'])->toBe([
'total' => 2,
'online' => 1,
'offline' => 1,
]);
expect($summary['bindings'])->toBe([
'total' => 3,
'fallback_overrides' => 2,
'cloud_only' => 1,
'local_only' => 1,
]);
expect($summary['operations'])->toBe([
'active' => 1,
'pending' => 1,
'in_progress' => 1,
'backlog' => 2,
]);
expect($summary['commands'])->toBe([
'backlog' => 4,
]);
expect($summary['system'])->toBe([
'latency_ms_avg' => 298,
'cpu_usage_pct_avg' => 18,
'memory_usage_pct_avg' => 52,
'disk_usage_pct_avg' => 67,
]);
});