mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Show custom maps in device overview (#15985)
* Show custom maps in device overview * remove extra line return * Sort by name
This commit is contained in:
@@ -794,6 +794,11 @@ class Device extends BaseModel
|
||||
return $this->hasMany(Ipv4Mac::class, 'device_id');
|
||||
}
|
||||
|
||||
public function maps(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(CustomMap::class, CustomMapNode::class, 'device_id', 'custom_map_id', 'device_id', 'custom_map_id');
|
||||
}
|
||||
|
||||
public function mefInfo(): HasMany
|
||||
{
|
||||
return $this->hasMany(MefInfo::class, 'device_id');
|
||||
|
@@ -15,6 +15,7 @@ echo '
|
||||
<div class="col-md-6">
|
||||
';
|
||||
require 'includes/html/dev-overview-data.inc.php';
|
||||
require 'overview/maps.inc.php';
|
||||
require 'includes/html/dev-groups-overview-data.inc.php';
|
||||
require 'overview/puppet_agent.inc.php';
|
||||
|
||||
|
7
includes/html/pages/device/overview/maps.inc.php
Normal file
7
includes/html/pages/device/overview/maps.inc.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$maps = DeviceCache::getPrimary()->maps;
|
||||
|
||||
if ($maps->isNotEmpty()) {
|
||||
echo view('device.overview.maps', ['maps' => $maps->sortBy('name')]);
|
||||
}
|
13
resources/views/device/overview/maps.blade.php
Normal file
13
resources/views/device/overview/maps.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<x-panel class="device-overview panel-condensed">
|
||||
<x-slot name="heading">
|
||||
<i class="fa fa-map-marked fa-lg icon-theme" aria-hidden="true"></i>
|
||||
<strong>{{ __('Custom Maps') }}</strong>
|
||||
</x-slot>
|
||||
@foreach($maps as $map)
|
||||
<p><a href="{{ route('maps.custom.show', $map->custom_map_id) }}">{{ $map->name }}</a></p>
|
||||
@endforeach
|
||||
</x-panel>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user