Merge branch 'ent-8620-copiando-a-grafana-3-grouped-meter-graphs-como-widget-en-dashboard' into 'develop'

new widget grouped meter graphs pandora_enterprise#8620

See merge request artica/pandorafms!5179
This commit is contained in:
Diego Muñoz-Reja 2022-10-18 13:10:26 +00:00
commit d86fd78b98
10 changed files with 1259 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -3487,12 +3487,13 @@ function agents_get_agent_custom_field($agent_id, $custom_field_name)
/**
* Unverified documentation.
*
* @param integer $id_group Module group.
* @param array $id_agents Array of agent ids.
* @param boolean $selection Show common (false) or all modules (true).
* @param boolean $return Return (false) or dump to output (true).
* @param boolean $index_by_name Use module name as key.
* @param boolean $pure_return Return as retrieved from DB.
* @param integer $id_group Module group.
* @param array $id_agents Array of agent ids.
* @param boolean $selection Show common (false) or all modules (true).
* @param boolean $return Return (false) or dump to output (true).
* @param boolean $index_by_name Use module name as key.
* @param boolean $pure_return Return as retrieved from DB.
* @param boolean $notStringModules Not string modules.
*
* @return array With modules or null if error.
*/
@ -3502,7 +3503,8 @@ function select_modules_for_agent_group(
$selection,
$return=true,
$index_by_name=false,
$pure_return=false
$pure_return=false,
$notStringModules=false
) {
global $config;
$agents = (empty($id_agents)) ? [] : implode(',', $id_agents);
@ -3510,6 +3512,7 @@ function select_modules_for_agent_group(
$filter_agent_group = '';
$filter_group = '';
$filter_agent = '';
$filter_not_string_modules = '';
$selection_filter = '';
$sql_conditions_tags = '';
$sql_tags_inner = '';
@ -3524,6 +3527,23 @@ function select_modules_for_agent_group(
$filter_agent = ' AND tagente.id_agente IN ('.$agents.')';
}
if ($notStringModules === true) {
$filter_not_string_modules = sprintf(
' AND (tagente_modulo.id_tipo_modulo <> %d AND
tagente_modulo.id_tipo_modulo <> %d AND
tagente_modulo.id_tipo_modulo <> %d AND
tagente_modulo.id_tipo_modulo <> %d AND
tagente_modulo.id_tipo_modulo <> %d AND
tagente_modulo.id_tipo_modulo <> %d)',
MODULE_TYPE_GENERIC_DATA_STRING,
MODULE_TYPE_REMOTE_TCP_STRING,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_ASYNC_STRING,
MODULE_TYPE_WEB_CONTENT_STRING,
MODULE_TYPE_REMOTE_CMD_STRING
);
}
if (!users_can_manage_group_all('AR')) {
$group_string = implode(',', $groups);
$filter_agent_group = " AND (
@ -3567,6 +3587,7 @@ function select_modules_for_agent_group(
$filter_agent_group
$filter_group
$filter_agent
$filter_not_string_modules
$sql_conditions_tags
) x
GROUP BY nombre

View File

@ -5601,7 +5601,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
0,
$data['agent_ids'],
$data['selectionModules'],
true
true,
false,
(isset($data['notStringModules']) === true && $data['notStringModules'] === true) ? true : false
);
}

View File

@ -3607,8 +3607,26 @@ function modules_get_agentmodule_mininterval_no_async($id_agent)
}
function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true, $useName=false)
{
/**
* Get modules agents.
*
* @param integer $id_module_group ID module group.
* @param array $id_agents Array agents.
* @param boolean $selection Selection.
* @param boolean $select_mode Mode.
* @param boolean $useName Use name.
* @param boolean $notStringModules Not string modules.
*
* @return array Modules for this agents.
*/
function get_modules_agents(
$id_module_group,
$id_agents,
$selection,
$select_mode=true,
$useName=false,
$notStringModules=false
) {
if ((bool) is_metaconsole() === true) {
if ($select_mode === true) {
$agents = array_reduce(
@ -3657,7 +3675,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
$selection,
false,
$useName,
true
true,
$notStringModules
);
metaconsole_restore_db();
@ -3746,7 +3765,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
$selection,
false,
$useName,
false
false,
$notStringModules
);
}

View File

@ -1536,3 +1536,18 @@ function loadSliceWidget(settings) {
}
});
}
// eslint-disable-next-line no-unused-vars
function showManualThresholds(element) {
$("#min_warning").val(null);
$("#max_warning").val(null);
$("#min_critical").val(null);
$("#max_critical").val(null);
if ($(element).is(":checked") === true) {
$(".dashboard-input-threshold-warning").removeClass("invisible_important");
$(".dashboard-input-threshold-critical").removeClass("invisible_important");
} else {
$(".dashboard-input-threshold-warning").addClass("invisible_important");
$(".dashboard-input-threshold-critical").addClass("invisible_important");
}
}

View File

@ -416,6 +416,7 @@ class Widget
$className .= '\OsQuickReportWidget';
break;
case 'GroupedMeterGraphs':
case 'ColorModuleTabs':
case 'BlockHistogram':
$className .= '\\'.$name;

File diff suppressed because it is too large Load Diff

View File

@ -710,9 +710,13 @@ class AgentModuleWidget extends Widget
if (empty($allModules) === false) {
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
$modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
);
if (isset($reduceAllModules['modules_selected'][$tserver]) === true) {
$modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
);
} else {
$modules = null;
}
} else {
$modules = $agent->searchModules(
['nombre' => array_keys($allModules)]

View File

@ -677,6 +677,128 @@ form.modal-dashboard
text-align: initial;
}
.container-grouped-meter {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 98%;
margin-top: 10px;
}
.container-grouped-meter .container-info-module-meter {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 100%;
height: 30px;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-title {
flex: 1 1 20%;
font-size: 100%;
font-weight: bolder;
text-align: right;
padding-right: 10px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-graphs {
flex: 1 1 65%;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 100%;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-graphs
div {
border-radius: 2px;
width: 17px;
height: 90%;
opacity: 0.4;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-graphs
div.meter-graph-critical {
background-color: #e63c52;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-graphs
div.meter-graph-warning {
background-color: #f3b200;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-graphs
div.meter-graph-normal {
background-color: #82b92e;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-graphs
div.meter-graph-opacity {
opacity: 1;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-data {
flex: 1 1 15%;
font-size: 150%;
font-weight: bolder;
text-align: right;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-data.meter-data-critical {
color: #e63c52;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-data.meter-data-warning {
color: #f3b200;
}
.container-grouped-meter
.container-info-module-meter
.container-info-module-meter-data.meter-data-normal {
color: #82b92e;
}
.dashboard-input-threshold {
align-items: center;
justify-content: space-between;
}
.dashboard-input-threshold input {
max-width: 20% !important;
}
.dashboard-input-threshold label:not(:first-child) {
flex: 0 !important;
}
.content-widget .dataTables_wrapper {
width: 98%;
margin-top: 5px;

View File

@ -223,7 +223,7 @@ if (is_ajax()) {
$id_agents,
$selection,
$select_mode,
true
(bool) !$select_mode
);
// Clean double safe input.