. * * @link http://librenms.org * @copyright 2019 Thomas Berberich * @author Thomas Berberich */ namespace App\Http\Controllers\Maps; use App\Http\Controllers\Controller; use LibreNMS\Config; class MapController extends Controller { protected function visOptions() { return Config::get('network_map_vis_options'); } protected function nodeDisabledStyle() { return ['color' => [ 'highlight' => [ 'background' => Config::get('network_map_legend.di.node'), ], 'border' => Config::get('network_map_legend.di.border'), 'background' => Config::get('network_map_legend.di.node'), ], ]; } protected function nodeHighlightStyle() { return ['color' => [ 'highlight' => [ 'border' => Config::get('network_map_legend.highlight.border'), ], 'border' => Config::get('network_map_legend.highlight.border'), ], 'borderWidth' => Config::get('network_map_legend.highlight.borderWidth'), ]; } protected function nodeDownStyle() { return ['color' => [ 'highlight' => [ 'background' => Config::get('network_map_legend.dn.node'), 'border' => Config::get('network_map_legend.dn.border'), ], 'border' => Config::get('network_map_legend.dn.border'), 'background' => Config::get('network_map_legend.dn.node'), ], ]; } protected function nodeUpStyle() { return []; } protected function deviceStyle($device, $highlight_node = 0) { if ($device->disabled) { $device_style = $this->nodeDisabledStyle(); } elseif (! $device->status) { $device_style = $this->nodeDownStyle(); } else { $device_style = $this->nodeUpStyle(); } if ($device->device_id == $highlight_node) { $device_style = array_merge($device_style, $this->nodeHighlightStyle()); } return $device_style; } }