11423-Graph analytics. Remove graphs & several changes

This commit is contained in:
Pablo Aragon 2023-08-24 12:27:06 +02:00
parent 6757e69a75
commit 670cf7d9a7
3 changed files with 82 additions and 8 deletions

View File

@ -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(
`<div class="draggable ui-draggable ui-draggable-handle">${data}</div>`
)
);
// Create remove button.
if (
graphDiv
.children()
.children()
.hasClass("parent_graph") === true
) {
graphDiv
.children()
.children()
.children(":first-child")
.prepend(
$(
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
)
);
} else {
graphDiv
.children()
.append(
$(
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
)
);
}
}
}
});
@ -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();
}
}
});
}

View File

@ -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;
}

View File

@ -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 = "<?php echo __('If you create a new graph, the current settin
const titleSave = "<?php echo __('Saved successfully'); ?>";
const messageSave = "<?php echo __('The filter has been saved successfully'); ?>";
const messageSaveEmpty = "<?php echo __('Empty graph'); ?>";
const messageSaveEmpty = "<?php echo __('It is not possible to create the filter if you have not made any change'); ?>";
const messageSaveEmptyName = "<?php echo __('Empty name'); ?>";
const titleError = "<?php echo __('Error'); ?>";
@ -924,7 +924,7 @@ const titleUpdateConfirm = "<?php echo __('Updated successfully'); ?>";
const messageUpdateConfirm = "<?php echo __('The filter has been updated successfully'); ?>";
const titleUpdateError = "<?php echo __('Error'); ?>";
const messageUpdateError = "<?php echo __('Empty graph'); ?>";
const messageUpdateError = "<?php echo __('It is not possible to update the filter if you have not made any change'); ?>";
const titleLoad = "<?php echo __('Overwrite current graph?'); ?>";
const messageLoad = "<?php echo __('If you load a filter, it will clear the current graph'); ?>";
@ -936,4 +936,7 @@ const titleExport = "<?php echo __('Export to custom graph'); ?>";
const titleExportConfirm = "<?php echo __('Exported successfully'); ?>";
const messageExportConfirm = "<?php echo __('graphs have been created in Custom graphs'); ?>";
const titleRemoveConfirm = "<?php echo __('Delete graph'); ?>";
const messageRemoveConfirm = "<?php echo __('Do you want to delete the graph? Remember to save the changes.'); ?>";
</script>