diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index 1bba3990b9..3c63b13a82 100755 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -56,10 +56,20 @@ body { font-family: "Lato" !important; } +a { + text-decoration: underline !important; + text-decoration-color: var(--muted-color) !important; + color: var(--primary-color); +} + .small { font-size: 10px !important; } +.font-10pt { + font-size: 10pt !important; +} + .center { text-align: center; } @@ -488,6 +498,7 @@ table.event_details td.cell_event_name { @media screen and (max-width: 35em) { /* Hide the title of event name */ + #last_agent_events tbody tr.events td.cell_0 b.ui-table-cell-label, #list_events tbody tr.events td.cell_0 b.ui-table-cell-label { display: none; } @@ -520,26 +531,36 @@ table.event_details td.cell_event_name { font-weight: bold; } +.agents_tiny_stats span { + background-color: transparent !important; +} + +.agents_tiny_stats .red, .color-red { color: #c00 !important; } +.agents_tiny_stats .green, .color-green { color: #5a8629 !important; } +.agents_tiny_stats .orange, .color-orange { color: #fd7304 !important; } +.agents_tiny_stats .yellow, .color-yellow { color: #f3c500 !important; } +.agents_tiny_stats .grey, .color-grey { color: #808080 !important; } +.agents_tiny_stats .blue, .color-blue { color: #4a83f3 !important; } @@ -903,6 +924,7 @@ table.event_details td.cell_event_name { font-size: 12px !important; } + table#list_module_data tr, table#list_servers tr, table[id^="service-table-"] tr { display: flex; @@ -911,6 +933,7 @@ table.event_details td.cell_event_name { align-items: center; } + table#list_module_data b.ui-table-cell-label, table#list_servers b.ui-table-cell-label, table[id^="service-table-"] b.ui-table-cell-label { display: none; @@ -2114,33 +2137,65 @@ table#last-activity > tbody > tr > td > b { } /* Events table */ +table#last_agent_events > tbody > tr.events > td.cell_0, table#list_events > tbody > tr.events > td.cell_0 { border-top-left-radius: 8px !important; border-top-right-radius: 8px !important; } +table#last_agent_events > tbody > tr.events > td.vertical_middle, table#list_events > tbody > tr.events > td.vertical_middle { border-bottom-left-radius: 8px !important; border-bottom-right-radius: 8px !important; color: #4a4a4a; } +table#last_agent_events > tbody > tr.events, table#list_events > tbody > tr.events { background-color: var(--secondary-color) !important; } +table#last_agent_events > tbody > tr.events.datos_green > td, table#list_events > tbody > tr.events.datos_green > td { background-color: #81b92e40; } +table#last_agent_events > tbody > tr.events.datos_red > td, table#list_events > tbody > tr.events.datos_red > td { background-color: #ed474a40; } +table#last_agent_events > tbody > tr.events.datos_yellow > td, table#list_events > tbody > tr.events.datos_yellow > td { background-color: #fcab1040; } +table#last_agent_events > tbody > tr.events.datos_blue > td, table#list_events > tbody > tr.events.datos_blue > td { background-color: #25a8ff40; } +table#last_agent_events > tbody > tr.events.datos_grey > td, table#list_events > tbody > tr.events.datos_grey > td { background-color: #adadad40; } + +table#list_module_data > thead > tr > th { + display: initial; +} + +h4[id^="service-"].ui-collapsible-heading + > a + > span.ui-icon.ui-collapsible-icon-right { + margin-top: 2px !important; +} + +h4[id^="service-"].ui-collapsible-heading + > a.ui-collapsible-heading-toggle.ui-button.ui-button-a { + padding-left: 10px !important; +} + +table[id^="service-table-"] { + padding: 0px !important; +} + +table[id^="service-table-"] > tbody > tr { + padding: 0px 5px !important; + height: 48px !important; +} diff --git a/pandora_console/mobile/index.php b/pandora_console/mobile/index.php index 401f96ae11..fe0eb231d8 100644 --- a/pandora_console/mobile/index.php +++ b/pandora_console/mobile/index.php @@ -45,6 +45,7 @@ require_once 'operation/visualmaps.php'; require_once 'operation/visualmap.php'; require_once 'operation/server_status.php'; require_once 'operation/services.php'; +require_once 'operation/module_data.php'; $enterpriseHook = enterprise_include('mobile/include/enterprise.class.php'); $enterpriseHook = enterprise_include('mobile/operation/home.php'); @@ -189,6 +190,11 @@ switch ($action) { $services->ajax($parameter2); break; + case 'module_data': + $module_data = new ModuleData(); + $module_data->ajax($parameter2); + break; + default: if (class_exists('Enterprise')) { $enterprise->enterpriseAjax($parameter1, $parameter2); @@ -429,6 +435,11 @@ switch ($action) { $services = new Services(); $services->show(); break; + + case 'module_data': + $module_data = new ModuleData(); + $module_data->show(); + break; } break; } diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index 5bd28c3350..f1ff032862 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -27,6 +27,8 @@ * ============================================================================ */ +use PandoraFMS\Event; + // Begin. require_once '../include/functions_users.php'; @@ -130,9 +132,13 @@ class Agent { $ui = Ui::getInstance(); $system = System::getInstance(); + $eventObj = new Events; $ui->createPage(); + $options = $eventObj->getEventDialogOptions(); + $ui->addDialog($options); + if ($this->id != 0) { $agent_alias = (string) $this->agent['alias']; diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 1021bd862c..9b08557d7d 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -1201,7 +1201,7 @@ class Events data: postvars, success: function (data) { - if (data.correct) { + if (data.correct) { event = data.event; //Fill the dialog $("#detail_event_dialog .cell_event_name") diff --git a/pandora_console/mobile/operation/module_data.php b/pandora_console/mobile/operation/module_data.php new file mode 100644 index 0000000000..101397de47 --- /dev/null +++ b/pandora_console/mobile/operation/module_data.php @@ -0,0 +1,354 @@ +checkACL($this->acl)) { + $this->correct_acl = true; + } else { + $this->correct_acl = false; + } + + $this->moduleId = $system->getRequest('module_id'); + } + + + public function ajax($parameter2=false) + { + $system = System::getInstance(); + + if (!$this->correct_acl) { + return; + } else { + switch ($parameter2) { + case 'get_module_data': + $this->getFilters(); + $page = $system->getRequest('page', 0); + $module_id = $system->getRequest('module_id'); + $servers = []; + $end = 1; + + $listData = $this->getListData($page, true); + + if (!empty($listData['data'])) { + $end = 0; + $servers = $listData['data']; + } + + echo json_encode(['end' => $end, 'servers' => $servers]); + break; + } + } + } + + + public function show() + { + if (!$this->correct_acl) { + $this->show_fail_acl(); + } else { + $this->show_module_data(); + } + } + + + private function show_fail_acl() + { + $error['type'] = 'onStart'; + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = System::getDefaultACLFailText(); + if (class_exists('HomeEnterprise')) { + $home = new HomeEnterprise(); + } else { + $home = new Home(); + } + + $home->show($error); + } + + + private function show_module_data() + { + $ui = Ui::getInstance(); + + $ui->createPage(); + $ui->createDefaultHeader( + __('Module data'), + $ui->createHeaderButton( + [ + 'icon' => 'ui-icon-back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php?page=modules', + 'class' => 'header-button-left', + ] + ) + ); + $ui->showFooter(false); + $ui->beginContent(); + $this->listDataHtml(); + $ui->endContent(); + $ui->showPage(); + } + + + private function getListData($page=0, $ajax=false) + { + global $config; + $system = System::getInstance(); + + $total = 0; + $data = []; + + $module_data = modules_get_agentmodule_data( + $this->moduleId, + 604800, + 0, + false, + false, + 'DESC' + ); + + $total = (int) count($module_data); + + foreach ($module_data as $module) { + $row[__('Data')] = ''.$module['data'].''; + $row[__('Timestamp')] = ''.human_time_comparation($module['utimestamp'], 'tiny').''; + + array_push($data, $row); + } + + return [ + 'data' => $data, + 'total' => $total, + ]; + } + + + public function listDataHtml($page=0, $return=false) + { + $system = System::getInstance(); + $ui = Ui::getInstance(); + + $listData = $this->getListData($page); + if ($listData['total'] == 0) { + $html = '
'.__('No data').'
'; + if (!$return) { + $ui->contentAddHtml($html); + } else { + return $html; + } + } else { + if (!$return) { + $table = new Table(); + $table->id = 'list_module_data'; + $table->importFromHash($listData['data']); + + $ui->contentAddHtml(''.$agent_name.'
'); + + $ui->contentAddHtml($table->getHTML()); + + $ui->contentAddHtml('