feature: Adds support for enabling / disabling modules per OS (#4963)

* fixes #4946
first try, should be checked first
only discovery first

* add OS modules status indication

* add debug output
add os poller module support

* fix some whitespaces

* fix missing semicolon

* fix some whitespaces

* Modify the modules page

It now shows unset for unset device settings.
Also, `$os_module_status = $config['os'][$device['os']]['poller_modules'][$module];` doesn't work like you would expect. Fix that behavior.

* Fix mangled tabs

* optimize debug output
add docs

* text highlighting

* Streamline docs #1
* Update docs
* Spell out Global, OS, Device.
This commit is contained in:
Vitali Kari
2016-11-13 20:46:05 +01:00
committed by Tony Murray
parent dd640af530
commit 8841eece94
5 changed files with 87 additions and 9 deletions

View File

@@ -13,6 +13,7 @@
<tr>
<th>Module</th>
<th>Global</th>
<th>OS</th>
<th>Device</th>
<th></th>
</tr>
@@ -33,6 +34,22 @@ foreach ($poller_modules as $module => $module_status) {
echo('<span class="text-danger">Disabled</span>');
}
echo('
</td>
<td>');
if (isset($config['os'][$device['os']]['poller_modules'][$module])) {
if ($config['os'][$device['os']]['poller_modules'][$module]) {
echo('<span class="text-success">Enabled</span>');
$module_status = 1;
} else {
echo('<span class="text-danger">Disabled</span>');
$module_status = 0;
}
} else {
echo('<span>Unset</span>');
}
echo('
</td>
<td>
@@ -47,11 +64,10 @@ foreach ($poller_modules as $module => $module_status) {
$module_checked = '';
}
} else {
echo('<span id="poller-module-'.$module.'">Unset</span>');
if ($module_status == 1) {
echo('<span id="poller-module-'.$module.'"class="text-success">Enabled</span>');
$module_checked = 'checked';
} else {
echo('<span id="poller-module-'.$module.'"class="text-danger">Disabled</span>');
$module_checked = '';
}
}
@@ -78,6 +94,7 @@ foreach ($poller_modules as $module => $module_status) {
<tr>
<th>Module</th>
<th>Global</th>
<th>OS</th>
<th>Device</th>
<th></th>
</tr>
@@ -101,6 +118,22 @@ foreach ($discovery_modules as $module => $module_status) {
echo('<span class="text-danger">Disabled</span>');
}
echo('
</td>
<td>');
if (isset($config['os'][$device['os']]['discovery_modules'][$module])) {
if ($config['os'][$device['os']]['discovery_modules'][$module]) {
echo('<span class="text-success">Enabled</span>');
$module_status = 1;
} else {
echo('<span class="text-danger">Disabled</span>');
$module_status = 0;
}
} else {
echo('<span>Unset</span>');
}
echo('
</td>
<td>');
@@ -114,11 +147,10 @@ foreach ($discovery_modules as $module => $module_status) {
$module_checked = '';
}
} else {
echo('<span id="discovery-module-'.$module.'">Unset</span>');
if ($module_status == 1) {
echo('<span id="discovery-module-'.$module.'" class="text-success">Enabled</span>');
$module_checked = 'checked';
} else {
echo('<span id="discovery-module-'.$module.'" class="text-danger">Disabled</span>');
$module_checked = '';
}
}