#10194 hide widget not activated

This commit is contained in:
Daniel Cebrian 2023-10-03 10:31:57 +02:00
parent 438cb11f95
commit e64eadcb37
5 changed files with 76 additions and 4 deletions

View File

@ -64,6 +64,26 @@ class LogStorage extends Element
}
/**
* Check if log storage module exist.
*
* @return boolean
*/
public function isEnabled():bool
{
if (empty($this->monitoringAgent) === true) {
return false;
}
$existModule = modules_get_agentmodule_id(io_safe_input('Log server connection'), $this->monitoringAgent['id_agente']);
if ($existModule === false) {
return false;
} else {
return true;
}
}
/**
* Returns the html status of log storage.
*

View File

@ -54,6 +54,26 @@ class Overview extends Element
}
/**
* Check if module WUX connection exist.
*
* @return boolean
*/
public function wuxIsEnabled():bool
{
if (empty($this->monitoringAgent) === true) {
return false;
}
$existModule = modules_get_agentmodule_id(io_safe_input('WUX connection'), $this->monitoringAgent['id_agente']);
if ($existModule === false) {
return false;
} else {
return true;
}
}
/**
* Return the html log size status.
*
@ -86,10 +106,11 @@ class Overview extends Element
$output = $image_status.$text;
$align = ($this->wuxIsEnabled() === true) ? 'flex_center' : 'flex_justify';
return html_print_div(
[
'content' => $output,
'class' => 'flex_center margin-top-5',
'class' => 'margin-top-5 '.$align,
'id' => 'status-log-size',
],
true

View File

@ -54,6 +54,26 @@ class SnmpTraps extends Element
}
/**
* Check if snmp traps module exist.
*
* @return boolean
*/
public function isEnabled():bool
{
if (empty($this->monitoringAgent) === true) {
return false;
}
$existModule = modules_get_agentmodule_id(io_safe_input('snmp_trap_queue'), $this->monitoringAgent['id_agente']);
if ($existModule === false) {
return false;
} else {
return true;
}
}
/**
* Returns the html of queues traps.
*

View File

@ -21,6 +21,9 @@
display: flex;
width: 100%;
}
.col-12 {
width: 100%;
}
.col-6,
.col-xl-6 {
width: 50%;

View File

@ -14,14 +14,15 @@
<div class="row">
<div class="col-6">
<div class="row">
<div class="col-6">
<div class="padding10">
<div class="<?php echo ($Overview->wuxIsEnabled() === true) ? 'col-6' : 'col-12'; ?>">
<div class="padding10 <?php echo ($Overview->wuxIsEnabled() === true) ? '' : 'center'; ?>">
<span class="subtitle">
<?php echo __('Pandora FMS log size'); ?>
</span>
<?php echo $Overview->getLogSizeStatus(); ?>
</div>
</div>
<?php if ($Overview->wuxIsEnabled() === true) : ?>
<div class="col-6 br-l">
<div class="padding10">
<span class="subtitle">
@ -30,6 +31,7 @@
<?php echo $Overview->getWuxServerStatus(); ?>
</div>
</div>
<?php endif; ?>
</div>
<div class="br-t">
<div class="padding10">
@ -150,7 +152,7 @@
</div>
<div class="row">
<?php if ($Groups->total < 200) : ?>
<div class="col-6">
<div class="<?php echo (($SnmpTraps->isEnabled() === true && $LogStorage->isEnabled() === true)) ? 'col-6' : 'col-12'; ?>">
<div class="container">
<div class="title br-b">
<?php echo $Groups->title; ?>
@ -162,7 +164,9 @@
</div>
</div>
<?php endif; ?>
<?php if ($LogStorage->isEnabled() === true && $SnmpTraps->isEnabled() === true) : ?>
<div class="col-6">
<?php if ($LogStorage->isEnabled() === true) : ?>
<div class="container" id="logStorage">
<div class="title br-b">
<?php echo $LogStorage->title; ?>
@ -198,6 +202,8 @@
</div>
</div>
</div>
<?php endif; ?>
<?php if ($SnmpTraps->isEnabled() === true) : ?>
<div class="container" id="SNMPTraps">
<div class="title br-b">
<?php echo $SnmpTraps->title; ?>
@ -217,7 +223,9 @@
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>