From 6b4f344bfdd620e76eac081436f2dedd630dfae0 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Fri, 11 Oct 2024 10:58:08 +0300 Subject: [PATCH] Adds initial "latest data" code --- app/classes/agent.php | 6 +++++ app/pages/graphs.php | 16 ++++++------- app/pages/latest.php | 26 +++++++++++++++++++- app/templates/latest-data.php | 45 +++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 app/templates/latest-data.php diff --git a/app/classes/agent.php b/app/classes/agent.php index e6029f0..4a6dfb9 100644 --- a/app/classes/agent.php +++ b/app/classes/agent.php @@ -210,6 +210,12 @@ class Agent { $_SESSION["agent{$agent_id}_cache_time"] = ''; } + + // get latest stored jilo agents data + public function getLatestData($platform_id, $agent_type, $metric_type) { + // retrieves data already stored in db from another function (or the jilo-server to-be) + } + } ?> diff --git a/app/pages/graphs.php b/app/pages/graphs.php index 0568168..bbdd628 100644 --- a/app/pages/graphs.php +++ b/app/pages/graphs.php @@ -4,15 +4,15 @@ $graph[0]['data0'] = [ ['date' => '2024-10-06', 'value' => 10], ['date' => '2024-10-07', 'value' => 20], - ['date' => '2024-10-08', 'value' => 15], - ['date' => '2024-10-09', 'value' => 25], + ['date' => '2024-10-10', 'value' => 15], + ['date' => '2024-10-11', 'value' => 25], ]; $graph[0]['data1'] = [ ['date' => '2024-10-06', 'value' => 12], ['date' => '2024-10-07', 'value' => 23], - ['date' => '2024-10-08', 'value' => 11], - ['date' => '2024-10-09', 'value' => 27], + ['date' => '2024-10-10', 'value' => 11], + ['date' => '2024-10-11', 'value' => 27], ]; $graph[0]['graph_name'] = 'conferences'; @@ -23,15 +23,15 @@ $graph[0]['graph_data1_label'] = 'Conferences from Jitsi API (Jilo Agents)'; $graph[1]['data0'] = [ ['date' => '2024-10-06', 'value' => 20], ['date' => '2024-10-07', 'value' => 30], - ['date' => '2024-10-08', 'value' => 15], - ['date' => '2024-10-09', 'value' => 55], + ['date' => '2024-10-10', 'value' => 15], + ['date' => '2024-10-11', 'value' => 55], ]; $graph[1]['data1'] = [ ['date' => '2024-10-06', 'value' => 22], ['date' => '2024-10-07', 'value' => 33], - ['date' => '2024-10-08', 'value' => 11], - ['date' => '2024-10-09', 'value' => 57], + ['date' => '2024-10-10', 'value' => 11], + ['date' => '2024-10-11', 'value' => 57], ]; $graph[1]['graph_name'] = 'participants'; diff --git a/app/pages/latest.php b/app/pages/latest.php index 318a429..353ebf3 100644 --- a/app/pages/latest.php +++ b/app/pages/latest.php @@ -1,5 +1,29 @@ getLatestData($platform_id, 'jvb', 'conferences'); +$latestJvbParticipants = $agentObject->getLatestData($platform_id, 'jvb', 'participants'); +$latestJicofoConferences = $agentObject->getLatestData($platform_id, 'jicofo', 'conferences'); +$latestJicofoParticipants = $agentObject->getLatestData($platform_id, 'jicofo', 'participants'); + +$widget['records'] = array(); + +// prepare the widget +$widget['full'] = false; +$widget['name'] = 'LatestData'; +$widget['title'] = 'Latest data from Jilo Agents'; +$widget['collapsible'] = false; +$widget['collapsed'] = false; +$widget['filter'] = false; +if (!empty($latestJvbConferences) && !empty($latestJvbParticipants) && !empty($latestJicofoConferences) && !empty($latestJicofoParticipants)) { + $widget['full'] = true; +} +$widget['pagination'] = true; + + +include '../app/templates/latest-data.php'; ?> diff --git a/app/templates/latest-data.php b/app/templates/latest-data.php new file mode 100644 index 0000000..be11cf0 --- /dev/null +++ b/app/templates/latest-data.php @@ -0,0 +1,45 @@ + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
conferences + + 0 +
participants + + 0 +
+ +

No records found.

+ +

NB: This functionality is still under development.

+
+
+