mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
fixed graph in mobile view metaconsole
This commit is contained in:
parent
034181037d
commit
8ea9b67326
@ -47,6 +47,8 @@ class ModuleGraph
|
|||||||
|
|
||||||
private $module = null;
|
private $module = null;
|
||||||
|
|
||||||
|
private $server_id = '';
|
||||||
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
@ -68,6 +70,8 @@ class ModuleGraph
|
|||||||
|
|
||||||
$this->id = (int) $system->getRequest('id', 0);
|
$this->id = (int) $system->getRequest('id', 0);
|
||||||
$this->id_agent = (int) $system->getRequest('id_agent', 0);
|
$this->id_agent = (int) $system->getRequest('id_agent', 0);
|
||||||
|
$this->server_id = $system->getRequest('server_id', '');
|
||||||
|
|
||||||
$this->module = modules_get_agentmodule($this->id);
|
$this->module = modules_get_agentmodule($this->id);
|
||||||
$this->graph_type = return_graphtype($this->module['id_tipo_modulo']);
|
$this->graph_type = return_graphtype($this->module['id_tipo_modulo']);
|
||||||
|
|
||||||
@ -124,6 +128,16 @@ class ModuleGraph
|
|||||||
switch ($parameter2) {
|
switch ($parameter2) {
|
||||||
case 'get_graph':
|
case 'get_graph':
|
||||||
$this->getFilters();
|
$this->getFilters();
|
||||||
|
if ($system->getConfig('metaconsole')) {
|
||||||
|
$server_data = metaconsole_get_connection_by_id(
|
||||||
|
$this->server_id
|
||||||
|
);
|
||||||
|
// Establishes connection.
|
||||||
|
if (metaconsole_load_external_db($server_data) !== NOERR) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$correct = 0;
|
$correct = 0;
|
||||||
$graph = '';
|
$graph = '';
|
||||||
$correct = 1;
|
$correct = 1;
|
||||||
@ -197,6 +211,10 @@ class ModuleGraph
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($system->getConfig('metaconsole')) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
$graph = ob_get_clean().$graph;
|
$graph = ob_get_clean().$graph;
|
||||||
|
|
||||||
echo json_encode(['correct' => $correct, 'graph' => $graph]);
|
echo json_encode(['correct' => $correct, 'graph' => $graph]);
|
||||||
@ -252,7 +270,7 @@ class ModuleGraph
|
|||||||
- $(".ui-collapsible").height()
|
- $(".ui-collapsible").height()
|
||||||
- 55;
|
- 55;
|
||||||
var width = $(document).width() - 25;
|
var width = $(document).width() - 25;
|
||||||
ajax_get_graph($("#id_module").val(), heigth, width);
|
ajax_get_graph($("#id_module").val(), heigth, width, $("#server_id").val());
|
||||||
}
|
}
|
||||||
|
|
||||||
load_graph();
|
load_graph();
|
||||||
@ -264,7 +282,7 @@ class ModuleGraph
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function ajax_get_graph(id, heigth_graph, width_graph) {
|
function ajax_get_graph(id, heigth_graph, width_graph, server_id) {
|
||||||
postvars = {};
|
postvars = {};
|
||||||
postvars["action"] = "ajax";
|
postvars["action"] = "ajax";
|
||||||
postvars["parameter1"] = "module_graph";
|
postvars["parameter1"] = "module_graph";
|
||||||
@ -284,6 +302,8 @@ class ModuleGraph
|
|||||||
|
|
||||||
postvars["id"] = id;
|
postvars["id"] = id;
|
||||||
|
|
||||||
|
postvars["server_id"] = server_id;
|
||||||
|
|
||||||
$.ajax ({
|
$.ajax ({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "index.php",
|
url: "index.php",
|
||||||
@ -360,9 +380,18 @@ class ModuleGraph
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$ui->contentAddHtml(
|
||||||
|
$ui->getInput(
|
||||||
|
[
|
||||||
|
'id' => 'server_id',
|
||||||
|
'value' => $this->server_id,
|
||||||
|
'type' => 'hidden',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
$title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module['nombre']);
|
$title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module['nombre']);
|
||||||
$ui->contentBeginCollapsible($title);
|
$ui->contentBeginCollapsible($title);
|
||||||
$ui->beginForm('index.php?page=module_graph&id='.$this->id);
|
$ui->beginForm('index.php?page=module_graph&id='.$this->id.'&server_id='.$this->server_id);
|
||||||
$options = [
|
$options = [
|
||||||
'name' => 'draw_alerts',
|
'name' => 'draw_alerts',
|
||||||
'value' => 1,
|
'value' => 1,
|
||||||
|
@ -485,6 +485,8 @@ class Modules
|
|||||||
$temp_modules = db_get_all_rows_sql($sql_select.$sql.$sql_limit);
|
$temp_modules = db_get_all_rows_sql($sql_select.$sql.$sql_limit);
|
||||||
|
|
||||||
foreach ($temp_modules as $result_element_key => $result_element_value) {
|
foreach ($temp_modules as $result_element_key => $result_element_value) {
|
||||||
|
$result_element_value['server_id'] = $server['id'];
|
||||||
|
$result_element_value['server_name'] = $server['server_name'];
|
||||||
array_push($modules_db, $result_element_value);
|
array_push($modules_db, $result_element_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +686,19 @@ class Modules
|
|||||||
|
|
||||||
$row[7] = ui_get_snapshot_image($link, $is_snapshot).' ';
|
$row[7] = ui_get_snapshot_image($link, $is_snapshot).' ';
|
||||||
} else {
|
} else {
|
||||||
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">'.'<span style="display: none;" class="show_collapside">'.$row[__('Status')].' </span>'.'<a data-ajax="false" class="ui-link" '.'href="index.php?page=module_graph&id='.$module['id_agente_modulo'].'&id_agent='.$this->id_agent.'">'.$output.'</a>'.'</span>';
|
if ($system->getConfig('metaconsole')) {
|
||||||
|
$row[__('Data')] = '<span style="white-space: nowrap;">';
|
||||||
|
$row[__('Data')] .= '<span style="display: none;" class="show_collapside">';
|
||||||
|
$row[__('Data')] .= $row[__('Status')].' </span>';
|
||||||
|
$row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
|
||||||
|
$row[__('Data')] .= 'href="index.php?page=module_graph&id='.$module['id_agente_modulo'];
|
||||||
|
$row[__('Data')] .= '&server_id='.$module['server_id'];
|
||||||
|
$row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
|
||||||
|
$row[__('Data')] .= $output.'</a></span>';
|
||||||
|
$row[7] = $row[__('Data')];
|
||||||
|
} else {
|
||||||
|
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">'.'<span style="display: none;" class="show_collapside">'.$row[__('Status')].' </span>'.'<a data-ajax="false" class="ui-link" '.'href="index.php?page=module_graph&id='.$module['id_agente_modulo'].'&id_agent='.$this->id_agent.'">'.$output.'</a>'.'</span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$ajax) {
|
if (!$ajax) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user