From c59042c0349ef45a3fec566c6577dfada01f087b Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 3 Nov 2020 18:01:24 +0100 Subject: [PATCH] WIP --- .../javascript/pandora_visual_console.js | 37 +++++++++++--- .../VisualConsole/Items/NetworkLink.php | 2 + .../rest-api/models/VisualConsole/View.php | 51 +++++++++++++++++++ 3 files changed, 82 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index 2e0bf5d32c..f157a0d362 100755 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -194,15 +194,36 @@ function createVisualConsole( item ); } else if (meta.lineMode && item.props.type == 21) { - confirmDialog({ - title: "todo", - message: - "
" +
-            item.props.labelStart +
-            "

" +
-            item.props.labelEnd +
-            "
" + load_modal({ + url: baseUrl + "/ajax.php", + modal: { + title: "NetworkLink information", + ok: "Ok" + }, + extradata: [ + { + name: "from", + value: item.props.linkedStart + }, + { + name: "to", + value: item.props.linkedEnd + } + ], + onshow: { + page: "include/rest-api/index", + method: "networkLinkPopup" + } }); + // confirmDialog({ + // title: "todo", + // message: + // "
" +
+        //     item.props.labelStart +
+        //     "

" +
+        //     item.props.labelEnd +
+        //     "
" + // }); } }); // VC Item moved. diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/NetworkLink.php b/pandora_console/include/rest-api/models/VisualConsole/Items/NetworkLink.php index 5f834cbe32..f084ffba4c 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/NetworkLink.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/NetworkLink.php @@ -479,6 +479,7 @@ final class NetworkLink extends Model ); $labelStart = $module->nombre(); + $labelStart .= ': '.$module->lastValue(); } } @@ -492,6 +493,7 @@ final class NetworkLink extends Model ); $labelEnd = $module->nombre(); + $labelEnd .= ': '.$module->lastValue(); } } diff --git a/pandora_console/include/rest-api/models/VisualConsole/View.php b/pandora_console/include/rest-api/models/VisualConsole/View.php index 4bee403489..bf942a62c4 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/View.php +++ b/pandora_console/include/rest-api/models/VisualConsole/View.php @@ -613,4 +613,55 @@ class View extends \HTML } + /** + * Returns a popup for networkLink viewer. + * + * @return void + */ + public function networkLinkPopup() + { + global $config; + include_once $config['homedir'].'/include/functions_graph.php'; + $item_idFrom = get_parameter('from'); + $item_idTo = get_parameter('to'); + + $itemFrom = db_get_row_filter( + 'tlayout_data', + ['id' => $item_idFrom] + ); + + $itemTo = db_get_row_filter( + 'tlayout_data', + ['id' => $item_idTo] + ); + + $from = new \PandoraFMS\Module((int) $itemFrom['id_agente_modulo']); + $to = new \PandoraFMS\Module((int) $itemTo['id_agente_modulo']); + + echo 'From '.$from->nombre().' con valor '.$from->lastValue(); + ini_set('display_errors', 1); + + echo \grafico_modulo_sparse( + [ + 'agent_module_id' => $from->id_agente_modulo(), + 'period' => SECONDS_1DAY, + 'height' => 150, + 'menu' => false, + ] + ); + + echo 'To '.$to->nombre().' con valor '.$to->lastValue(); + + echo \grafico_modulo_sparse( + [ + 'agent_module_id' => $to->id_agente_modulo(), + 'period' => SECONDS_1DAY, + 'height' => 150, + 'menu' => false, + ] + ); + + } + + }