mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
0a351b49fd
* Move `resources/lang` folder * Shift registered middleware * Remove `fruitcake/laravel-cors` dependency * Streamline `$commands` property * Upgrade to Flysystem 3.0 * Shift core files * Convert `optional()` to nullsafe operator * Remove unnecessary `$model` property * Convert route options to fluent methods Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods. * Convert deprecated `$dates` property to `$casts` * Shift config files * Default config files In an effort to make upgrading the constantly changing config files easier, Shift defaulted them and merged your true customizations - where ENV variables may not be used. * Bump Laravel dependencies * Use `<env>` tags for configuration `<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI. Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/ * Fix error provider * Match new symfony syntax * Match upstream syntax * Fix route syntax * generate composer.lock * Sync back configs * routes * composer * Fix more flare * fix cors * sync lang * Apply fixes from StyleCI (#14517) Co-authored-by: StyleCI Bot <[email protected]> * bump larastan * update packages * wip * Temporarily lower phpstan level * Update phpstan.neon * wip * wip * wip * Apply fixes from StyleCI (#14592) Co-authored-by: StyleCI Bot <[email protected]> * test * Update CiHelper.php * Update test.yml * Update CiHelper.php * Update CiHelper.php * Apply fixes from StyleCI (#14616) Co-authored-by: StyleCI Bot <[email protected]> * test? * fix phpstan problems * dont run snmpsim on github ci * Fix whitespace * More whitespace * More whitespace ??? * I think the space broke it * fix the reset of the whitespace * hard code auth guard --------- Co-authored-by: Shift <[email protected]> Co-authored-by: StyleCI Bot <[email protected]> Co-authored-by: Tony Murray <[email protected]>
251 lines
7.0 KiB
PHP
251 lines
7.0 KiB
PHP
<div class="row">
|
|
<div class="col-sm-6">
|
|
<strong>Poller Modules</strong>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<strong>Discovery Modules</strong>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<table class="table table-striped">
|
|
<tr>
|
|
<th>Module</th>
|
|
<th>Global</th>
|
|
<th>OS</th>
|
|
<th>Device</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php
|
|
|
|
use LibreNMS\Config;
|
|
|
|
$language = \config('app.locale');
|
|
$settings = (include Config::get('install_dir') . '/lang/' . $language . '/settings.php')['settings'];
|
|
|
|
$attribs = get_dev_attribs($device['device_id']);
|
|
$poller_module_names = $settings['poller_modules'];
|
|
$discovery_module_names = $settings['discovery_modules'];
|
|
|
|
$poller_modules = Config::get('poller_modules');
|
|
ksort($poller_modules);
|
|
foreach ($poller_modules as $module => $module_status) {
|
|
$module_name = $poller_module_names[$module]['description'] ?: $module;
|
|
echo '
|
|
<tr>
|
|
<td><strong>' . $module_name . '</strong></td>
|
|
<td>
|
|
';
|
|
|
|
if ($module_status == 1) {
|
|
echo '<span class="text-success">Enabled</span>';
|
|
} else {
|
|
echo '<span class="text-danger">Disabled</span>';
|
|
}
|
|
|
|
echo '
|
|
</td>
|
|
<td>';
|
|
|
|
if (Config::has("os.{$device['os']}.poller_modules.$module")) {
|
|
if (Config::get("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>
|
|
';
|
|
|
|
if (isset($attribs['poll_' . $module])) {
|
|
if ($attribs['poll_' . $module]) {
|
|
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 = '';
|
|
}
|
|
} else {
|
|
echo '<span id="poller-module-' . $module . '">Unset</span>';
|
|
if ($module_status == 1) {
|
|
$module_checked = 'checked';
|
|
} else {
|
|
$module_checked = '';
|
|
}
|
|
}
|
|
|
|
echo '
|
|
</td>
|
|
<td>
|
|
';
|
|
|
|
echo '<input type="checkbox" style="visibility:hidden;width:100px;" name="poller-module" data-poller_module="'
|
|
. $module . '" data-device_id="' . $device['device_id'] . '" ' . $module_checked . '>';
|
|
|
|
echo '
|
|
</td>
|
|
</tr>
|
|
';
|
|
}
|
|
|
|
?>
|
|
|
|
</table>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<table class="table table-striped">
|
|
<tr>
|
|
<th>Module</th>
|
|
<th>Global</th>
|
|
<th>OS</th>
|
|
<th>Device</th>
|
|
<th></th>
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
$discovery_modules = Config::get('discovery_modules');
|
|
ksort($discovery_modules);
|
|
foreach ($discovery_modules as $module => $module_status) {
|
|
$module_name = $discovery_module_names[$module]['description'] ?: $module;
|
|
echo '
|
|
<tr>
|
|
<td>
|
|
<strong>' . $module_name . '</strong>
|
|
</td>
|
|
<td>
|
|
';
|
|
|
|
if ($module_status == 1) {
|
|
echo '<span class="text-success">Enabled</span>';
|
|
} else {
|
|
echo '<span class="text-danger">Disabled</span>';
|
|
}
|
|
|
|
echo '
|
|
</td>
|
|
<td>';
|
|
|
|
if (Config::has("os.{$device['os']}.discovery_modules.$module")) {
|
|
if (Config::get("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>';
|
|
|
|
if (isset($attribs['discover_' . $module])) {
|
|
if ($attribs['discover_' . $module]) {
|
|
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 = '';
|
|
}
|
|
} else {
|
|
echo '<span id="discovery-module-' . $module . '">Unset</span>';
|
|
if ($module_status == 1) {
|
|
$module_checked = 'checked';
|
|
} else {
|
|
$module_checked = '';
|
|
}
|
|
}
|
|
|
|
echo '
|
|
</td>
|
|
<td>';
|
|
|
|
echo '<input type="checkbox" style="visibility:hidden;width:100px;" name="discovery-module" data-discovery_module="'
|
|
. $module . '" data-device_id="' . $device['device_id'] . '" ' . $module_checked . '>';
|
|
|
|
echo '
|
|
</td>
|
|
</tr>';
|
|
}
|
|
echo '
|
|
</table>
|
|
</div>
|
|
';
|
|
|
|
?>
|
|
|
|
<script>
|
|
$("[name='poller-module']").bootstrapSwitch('offColor','danger');
|
|
$('input[name="poller-module"]').on('switchChange.bootstrapSwitch', function(event, state) {
|
|
event.preventDefault();
|
|
var $this = $(this);
|
|
var poller_module = $(this).data("poller_module");
|
|
var device_id = $(this).data("device_id");
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'ajax_form.php',
|
|
data: { type: "poller-module-update", poller_module: poller_module, device_id: device_id, state: state},
|
|
dataType: "html",
|
|
success: function(data){
|
|
//alert('good');
|
|
if(state)
|
|
{
|
|
$('#poller-module-'+poller_module).removeClass('text-danger');
|
|
$('#poller-module-'+poller_module).addClass('text-success');
|
|
$('#poller-module-'+poller_module).html('Enabled');
|
|
}
|
|
else
|
|
{
|
|
$('#poller-module-'+poller_module).removeClass('text-success');
|
|
$('#poller-module-'+poller_module).addClass('text-danger');
|
|
$('#poller-module-'+poller_module).html('Disabled');
|
|
}
|
|
},
|
|
error:function(){
|
|
//alert('bad');
|
|
}
|
|
});
|
|
});
|
|
$("[name='discovery-module']").bootstrapSwitch('offColor','danger');
|
|
$('input[name="discovery-module"]').on('switchChange.bootstrapSwitch', function(event, state) {
|
|
event.preventDefault();
|
|
var $this = $(this);
|
|
var discovery_module = $(this).data("discovery_module");
|
|
var device_id = $(this).data("device_id");
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'ajax_form.php',
|
|
data: { type: "discovery-module-update", discovery_module: discovery_module, device_id: device_id, state: state},
|
|
dataType: "html",
|
|
success: function(data){
|
|
//alert('good');
|
|
if(state)
|
|
{
|
|
$('#discovery-module-'+discovery_module).removeClass('text-danger');
|
|
$('#discovery-module-'+discovery_module).addClass('text-success');
|
|
$('#discovery-module-'+discovery_module).html('Enabled');
|
|
}
|
|
else
|
|
{
|
|
$('#discovery-module-'+discovery_module).removeClass('text-success');
|
|
$('#discovery-module-'+discovery_module).addClass('text-danger');
|
|
$('#discovery-module-'+discovery_module).html('Disabled');
|
|
}
|
|
},
|
|
error:function(){
|
|
//alert('bad');
|
|
}
|
|
});
|
|
});
|
|
</script>
|