mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Custom Maps: geo map and color background tabs blade component geo-map blade component and related script enhancements * Update css/js * style fixes * update db_schema.yaml * fix db_schema hand edit * ignore phpstan being wrong * Handle null * another possible null spot * Use standard file cache for custom map background images * Create map->image as jpeg so we can compress it * whitespace fix * Fix background cancel button when other type is selected than the saved type * Save and restore layer * Map must exist before creating static image * Don't show set as image button for Google and Bing. Bing gives an odd error, but Google won't work.
34 lines
956 B
PHP
34 lines
956 B
PHP
@props([
|
|
'id' => 'geo-map',
|
|
'init' => true,
|
|
'width' => '200px',
|
|
'height' => '100px',
|
|
'lat' => null,
|
|
'lng' => null,
|
|
'zoom' => null,
|
|
'layer' => null,
|
|
'readonly' => false,
|
|
'config' => [],
|
|
])
|
|
|
|
@php
|
|
$config['readonly'] = $readonly;
|
|
$config['lat'] = $lat ?? $config['lat'] ?? 40;
|
|
$config['lng'] = $lng ?? $config['lng'] ?? 40;
|
|
$config['zoom'] = $zoom ?? $config['zoom'] ?? 3;
|
|
$config['layer'] = $layer ?? $config['layer'] ?? null;
|
|
$config['engine'] ??= \LibreNMS\Config::get('geoloc.engine');
|
|
$config['api_key'] ??= \LibreNMS\Config::get('geoloc.api_key');
|
|
$config['tile_url'] ??= \LibreNMS\Config::get('leaflet.tile_url', '{s}.tile.openstreetmap.org');
|
|
@endphp
|
|
|
|
<div id="{{ $id }}" style="width: {{ $width }};height: {{ $height }}" {{ $attributes }}></div>
|
|
|
|
@if($init)
|
|
<script>
|
|
loadjs('js/leaflet.js', function () {
|
|
init_map(@json($id), @json($config))
|
|
})
|
|
</script>
|
|
@endif
|