diff --git a/pandora_console/include/javascript/graph_analytics.js b/pandora_console/include/javascript/graph_analytics.js index 77cdab85d7..a6d52be7cc 100644 --- a/pandora_console/include/javascript/graph_analytics.js +++ b/pandora_console/include/javascript/graph_analytics.js @@ -118,10 +118,16 @@ $("#search-left").keyup(function(e) { helper: "clone" }); } else { - console.error("NO DATA FOUND"); + $("#agents-toggle").hide(); + $("#groups-toggle").hide(); + $("#modules-toggle").hide(); } } }); + } else { + $("#agents-toggle").hide(); + $("#groups-toggle").hide(); + $("#modules-toggle").hide(); } }); @@ -245,6 +251,32 @@ function createDroppableZones( `
${data}
` ) ); + + // Create remove button. + if ( + graphDiv + .children() + .children() + .hasClass("parent_graph") === true + ) { + graphDiv + .children() + .children() + .children(":first-child") + .prepend( + $( + '' + ) + ); + } else { + graphDiv + .children() + .append( + $( + '' + ) + ); + } } } }); @@ -266,8 +298,6 @@ function createDroppableZones( // Set droppable zones. $(".droppable").droppable(droppableOptions); - - // todo: Create draggable graphs. } function getModulesByGraphs() { @@ -654,3 +684,30 @@ $("#button-export-modal").click(function(e) { }); } }); + +// Remove graph. +function removeGraph(e) { + confirmDialog({ + title: titleRemoveConfirm, + message: messageRemoveConfirm, + onAccept: function() { + if ( + $(e) + .parent() + .hasClass("menu_graph") === true + ) { + $(e) + .parent() + .parent() + .parent() + .parent() + .remove(); + } else { + $(e) + .parent() + .parent() + .remove(); + } + } + }); +} diff --git a/pandora_console/include/styles/graph_analytics.css b/pandora_console/include/styles/graph_analytics.css index 2499a0620e..3fcb3080ae 100644 --- a/pandora_console/include/styles/graph_analytics.css +++ b/pandora_console/include/styles/graph_analytics.css @@ -287,6 +287,10 @@ div.graphs-div-main { color: #82b92e; } +#droppable-graphs .droppable .draggable.ui-draggable.ui-draggable-handle { + text-align: center; +} + #droppable-graphs .parent_graph { padding-top: 40px; } @@ -355,3 +359,13 @@ div.graph-analytics-legend > span:first-child { #droppable-graphs td.legendColorBox { display: none; } + +#droppable-graphs .remove-graph-analytics { + width: 20px; + opacity: 0; + cursor: pointer; +} + +#droppable-graphs > div:hover .remove-graph-analytics { + opacity: 1; +} diff --git a/pandora_console/operation/reporting/graph_analytics.php b/pandora_console/operation/reporting/graph_analytics.php index b3549defe2..5cd0299c5e 100644 --- a/pandora_console/operation/reporting/graph_analytics.php +++ b/pandora_console/operation/reporting/graph_analytics.php @@ -225,7 +225,7 @@ if (is_ajax()) { } if (empty($graphs) === true) { - echo __('Empty graphs'); + echo __('It is not possible to create the filter if you have not made any change'); return; } @@ -243,7 +243,7 @@ if (is_ajax()) { echo 'saved'; return; } else { - echo __('Empty graphs'); + echo __('It is not possible to create the filter if you have not made any change'); return; } } @@ -254,7 +254,7 @@ if (is_ajax()) { $interval = (int) get_parameter('interval'); if (empty($graphs) === true) { - echo __('Empty graphs'); + echo __('It is not possible to update the filter if you have not made any change'); return; } @@ -912,7 +912,7 @@ const messageNew = ""; const messageSave = ""; -const messageSaveEmpty = ""; +const messageSaveEmpty = ""; const messageSaveEmptyName = ""; const titleError = ""; @@ -924,7 +924,7 @@ const titleUpdateConfirm = ""; const messageUpdateConfirm = ""; const titleUpdateError = ""; -const messageUpdateError = ""; +const messageUpdateError = ""; const titleLoad = ""; const messageLoad = ""; @@ -936,4 +936,7 @@ const titleExport = ""; const titleExportConfirm = ""; const messageExportConfirm = ""; + +const titleRemoveConfirm = ""; +const messageRemoveConfirm = ""; \ No newline at end of file