widget networkmap simple working

Former-commit-id: 7a922350fbedefae374f89517e69863d60a8fbee
This commit is contained in:
fbsanchez 2019-03-27 11:47:09 +01:00
parent 3038de3a9d
commit 3c853ff508
2 changed files with 22 additions and 1 deletions

View File

@ -212,6 +212,13 @@ class NetworkMap
*/
public $tooltipParams;
/**
* Shows the map using 100% of height and width if is a widget.
*
* @var boolean
*/
public $isWidget;
/**
* Defines a custom method to parse Graphviz output and generate Graph.
* Function pointer.
@ -369,6 +376,13 @@ class NetworkMap
$this->noPandoraNode = $options['no_pandora_node'];
}
// Initialize as widget?
if (isset($options['widget'])) {
$this->isWidget = (bool) $options['widget'];
} else {
$this->isWidget = true;
}
// Use a custom parser.
if (isset($options['custom_parser'])) {
$this->customParser = $options['custom_parser'];
@ -3323,7 +3337,11 @@ class NetworkMap
// Open networkconsole_id div.
$output .= '<div id="networkconsole_'.$networkmap['id'].'"';
$output .= ' style="width: '.$this->mapOptions['width'].'; height: '.$this->mapOptions['height'].';position: relative; overflow: hidden; background: #FAFAFA">';
if ($this->isWidget) {
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">';
} else {
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
}
$output .= '<div style="display: '.$minimap_display.';">';
$output .= '<canvas id="minimap_'.$networkmap['id'].'"';

View File

@ -2955,6 +2955,9 @@ function init_graph(parameter_object) {
window.height_svg =
$(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin
}
if (!window.height_svg) {
window.height_svg = $("#networkconsole_" + networkmap_id).height();
}
if (typeof parameter_object.font_size != "undefined") {
window.font_size = parameter_object.font_size;