mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
WIP NetworkMap class
Former-commit-id: f2594c8388e4cb235e39f08945ad064e999cfbcb
This commit is contained in:
parent
1d660d259f
commit
0ad8a0383f
@ -144,11 +144,11 @@ class NetworkMap
|
|||||||
$this->mapOptions['font_size'] = 12;
|
$this->mapOptions['font_size'] = 12;
|
||||||
$this->mapOptions['layout'] = 'spring1';
|
$this->mapOptions['layout'] = 'spring1';
|
||||||
$this->mapOptions['nooverlap'] = 1;
|
$this->mapOptions['nooverlap'] = 1;
|
||||||
$this->mapOptions['zoom'] = 1;
|
$this->mapOptions['zoom'] = 0.5;
|
||||||
$this->mapOptions['ranksep'] = 0.5;
|
$this->mapOptions['ranksep'] = 0.5;
|
||||||
$this->mapOptions['center'] = 0;
|
$this->mapOptions['center'] = 0;
|
||||||
$this->mapOptions['regen'] = 0;
|
$this->mapOptions['regen'] = 0;
|
||||||
$this->mapOptions['pure'] = 0;
|
$this->mapOptions['pure'] = 1;
|
||||||
$this->mapOptions['show_snmp_modules'] = false;
|
$this->mapOptions['show_snmp_modules'] = false;
|
||||||
$this->mapOptions['cut_names'] = false;
|
$this->mapOptions['cut_names'] = false;
|
||||||
$this->mapOptions['relative'] = true;
|
$this->mapOptions['relative'] = true;
|
||||||
@ -158,10 +158,11 @@ class NetworkMap
|
|||||||
$this->mapOptions['size_canvas'] = null;
|
$this->mapOptions['size_canvas'] = null;
|
||||||
$this->mapOptions['old_mode'] = false;
|
$this->mapOptions['old_mode'] = false;
|
||||||
$this->mapOptions['map_filter'] = [
|
$this->mapOptions['map_filter'] = [
|
||||||
|
'dont_show_subgroups' => 0,
|
||||||
'node_radius' => 40,
|
'node_radius' => 40,
|
||||||
'x_offs' => '',
|
'x_offs' => 0,
|
||||||
'y_offs' => '',
|
'y_offs' => 0,
|
||||||
'z_dash' => 0.31,
|
'z_dash' => 0.5,
|
||||||
'node_sep' => 0.1,
|
'node_sep' => 0.1,
|
||||||
'rank_sep' => 1,
|
'rank_sep' => 1,
|
||||||
'mindist' => 1,
|
'mindist' => 1,
|
||||||
@ -274,7 +275,7 @@ class NetworkMap
|
|||||||
$this->graph = networkmap_process_networkmap($this->idMap);
|
$this->graph = networkmap_process_networkmap($this->idMap);
|
||||||
} else {
|
} else {
|
||||||
// Simulated map.
|
// Simulated map.
|
||||||
$this->idMap = '0';
|
$this->idMap = uniqid();
|
||||||
// No tmap definition. Paint data.
|
// No tmap definition. Paint data.
|
||||||
if ($this->idTask) {
|
if ($this->idTask) {
|
||||||
$recon_task = db_get_row_filter(
|
$recon_task = db_get_row_filter(
|
||||||
@ -284,10 +285,27 @@ class NetworkMap
|
|||||||
$this->network = $recon_task['subnet'];
|
$this->network = $recon_task['subnet'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simulate map entry.
|
||||||
|
$this->map = [
|
||||||
|
'id' => $this->idMap,
|
||||||
|
'__simulated' => 1,
|
||||||
|
'background' => '',
|
||||||
|
'background_options' => 0,
|
||||||
|
'source_period' => 60,
|
||||||
|
'filter' => $this->mapOptions['map_filter'],
|
||||||
|
'width' => 900,
|
||||||
|
'height' => 400,
|
||||||
|
'center_x' => 450,
|
||||||
|
'center_y' => 200,
|
||||||
|
];
|
||||||
|
|
||||||
$this->graph = $this->generateNetworkMap();
|
$this->graph = $this->generateNetworkMap();
|
||||||
|
|
||||||
// Simulate map entry.
|
// Direct print. Avoid extra options.
|
||||||
$this->map = ['id' => '0'];
|
// $networkmap['source_period'] = 60;
|
||||||
|
// $networkmap['filter'] = $this->mapOptions['map_filter'];
|
||||||
|
// $networkmap['width'] = 1400;
|
||||||
|
// $networkmap['height'] = 800;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,16 +638,12 @@ class NetworkMap
|
|||||||
public function loadMapData()
|
public function loadMapData()
|
||||||
{
|
{
|
||||||
$networkmap = $this->map;
|
$networkmap = $this->map;
|
||||||
|
|
||||||
|
if (!isset($networkmap['__simulated'])) {
|
||||||
$networkmap['filter'] = json_decode(
|
$networkmap['filter'] = json_decode(
|
||||||
$networkmap['filter'],
|
$networkmap['filter'],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($networkmap['filter'])) {
|
|
||||||
// Direct print. Avoid extra options.
|
|
||||||
$networkmap['source_period'] = 60;
|
|
||||||
$networkmap['filter']['node_radius'] = 40;
|
|
||||||
$networkmap['filter'] = $this->mapOptions['map_filter'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hardcoded.
|
// Hardcoded.
|
||||||
@ -642,13 +656,17 @@ class NetworkMap
|
|||||||
$this->graph['relations']
|
$this->graph['relations']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Print some params to handle it in js.
|
||||||
|
html_print_input_hidden('product_name', get_product_name());
|
||||||
|
html_print_input_hidden('center_logo', ui_get_full_url(ui_get_logo_to_center_networkmap()));
|
||||||
|
|
||||||
$output .= '<script type="text/javascript">
|
$output .= '<script type="text/javascript">
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// VARS FROM THE DB
|
// VARS FROM THE DB
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
var url_background_grid = "'.ui_get_full_url('images/background_grid.png').'";
|
var url_background_grid = "'.ui_get_full_url('images/background_grid.png').'";
|
||||||
';
|
';
|
||||||
$output .= 'var networkmap_id = '.$this->idMap.";\n";
|
$output .= 'var networkmap_id = "'.$this->idMap."\";\n";
|
||||||
|
|
||||||
if (!empty($networkmap['filter'])) {
|
if (!empty($networkmap['filter'])) {
|
||||||
if (empty($networkmap['filter']['x_offs'])) {
|
if (empty($networkmap['filter']['x_offs'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user