mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Replace legacy menu with new Blade generated one (#10173)
* Remove legacy index php file * fix routing page missing data * WIP * fix $navbar global usage * remove global use of $locations * ObjectCache again... * move vars.inc.php to init.php for legacy ajax * navbar is more local than I thought before. Fix it. * Fix some sensors tables escaping * restore custom menu functionality, but with blade and docs * cleanup * tidy menu @if checks * Fix up the rest of the global variables and remove print-menubar.php * consolidate some counting in the menu * filter out empty custom port descr types * Fix up custom port groups * Fix up apps menu * Fix services menu when all are ok * Limit cached data to the user it is for * Fix style * A few clean ups * fix pseudowire bug
This commit is contained in:
81
resources/views/layouts/legacy_page.blade.php
Normal file
81
resources/views/layouts/legacy_page.blade.php
Normal file
@@ -0,0 +1,81 @@
|
||||
@extends('layouts.librenmsv1')
|
||||
|
||||
@section('content')
|
||||
{!! $content !!}
|
||||
|
||||
@if($refresh)
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#countdown_timer_status").html("<i class=\"fa fa-pause fa-fw fa-lg\"></i> Pause");
|
||||
var Countdown = {
|
||||
sec: {{ (int)$refresh }},
|
||||
|
||||
Start: function () {
|
||||
var cur = this;
|
||||
this.interval = setInterval(function () {
|
||||
$("#countdown_timer_status").html("<i class=\"fa fa-pause fa-fw fa-lg\"></i> Pause");
|
||||
cur.sec -= 1;
|
||||
display_time = cur.sec;
|
||||
if (display_time == 0) {
|
||||
location.reload();
|
||||
}
|
||||
if (display_time % 1 === 0 && display_time <= 300) {
|
||||
$("#countdown_timer").html("<i class=\"fa fa-clock-o fa-fw fa-lg\"></i> Refresh in " + display_time);
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
Pause: function () {
|
||||
clearInterval(this.interval);
|
||||
$("#countdown_timer_status").html("<i class=\"fa fa-play fa-fw fa-lg\"></i> Resume");
|
||||
delete this.interval;
|
||||
},
|
||||
|
||||
Resume: function () {
|
||||
if (!this.interval) this.Start();
|
||||
}
|
||||
};
|
||||
|
||||
Countdown.Start();
|
||||
|
||||
$("#countdown_timer_status").click("", function (event) {
|
||||
event.preventDefault();
|
||||
if (Countdown.interval) {
|
||||
Countdown.Pause();
|
||||
} else {
|
||||
Countdown.Resume();
|
||||
}
|
||||
});
|
||||
|
||||
$("#countdown_timer").click("", function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@else
|
||||
<script type="text/javascript">
|
||||
var no_refresh = true;
|
||||
$(document).ready(function () {
|
||||
$("#countdown_timer").html("Refresh disabled");
|
||||
$("#countdown_timer_status").html("<i class=\"fa fa-pause fa-fw fa-lg\"></i>");
|
||||
$("#countdown_timer_status").click("", function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@config('enable_footer')
|
||||
<nav class="navbar navbar-default {{ $navbar }} navbar-fixed-bottom">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<h5>Powered by <a href="{{ \LibreNMS\Config::get('project_home') }}" target="_blank" rel="noopener" class="red">{{ \LibreNMS\Config::get('project_name') }}</a>.</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@endconfig
|
||||
@endsection
|
@@ -9,7 +9,7 @@
|
||||
</button>
|
||||
<a class="hidden-md hidden-sm navbar-brand" href>
|
||||
@if($title_image)
|
||||
<img src="{{ $title_image }}" alt="{{ $project_name }}">
|
||||
<img src="{{ asset($title_image) }}" alt="{{ $project_name }}">
|
||||
@else
|
||||
{{ $project_name }}
|
||||
@endif
|
||||
@@ -28,7 +28,7 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ url('availability-map') }}"><i class="fa fa-arrow-circle-up fa-fw fa-lg" aria-hidden="true"></i> Availability</a></li>
|
||||
<li><a href="{{ url('map') }}"><i class="fa fa-sitemap fa-fw fa-lg" aria-hidden="true"></i> Network</a></li>
|
||||
@if($device_groups)
|
||||
@if($device_groups->isNotEmpty())
|
||||
<li class="dropdown-submenu"><a href="#"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> Device Groups Maps</a><ul class="dropdown-menu scrollable-menu">
|
||||
@foreach($device_groups as $group)
|
||||
<li><a href="{{ url('map', [$group->id]) }}" title="{{ $group->desc }}"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i>
|
||||
@@ -93,7 +93,7 @@
|
||||
<li class="dropdown">
|
||||
<a href="{{ url('devices/') }}" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-server fa-fw fa-lg fa-nav-icons hidden-md" aria-hidden="true"></i> <span class="hidden-sm">Devices</span></a>
|
||||
<ul class="dropdown-menu">
|
||||
@if($device_types)
|
||||
@if($device_types->isNotEmpty())
|
||||
<li class="dropdown-submenu">
|
||||
<a href="{{ url('devices') }}"><i class="fa fa-server fa-fw fa-lg" aria-hidden="true"></i> All Devices</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
@@ -105,7 +105,7 @@
|
||||
<li class="dropdown-submenu"><a href="#">No devices</a></li>
|
||||
@endif
|
||||
|
||||
@if($device_groups)
|
||||
@if($device_groups->isNotEmpty())
|
||||
<li class="dropdown-submenu"><a href="#"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> Device Groups</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
@foreach($device_groups as $group)
|
||||
@@ -115,7 +115,7 @@
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if($locations)
|
||||
@if($locations->isNotEmpty())
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#"><i class="fa fa-map-marker fa-fw fa-lg" aria-hidden="true"></i> @lang('Geo Locations')</a>
|
||||
@@ -151,13 +151,13 @@
|
||||
<a href="{{ url('services') }}" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-cogs fa-fw fa-lg fa-nav-icons hidden-md" aria-hidden="true"></i> <span class="hidden-sm">Services</span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ url('services') }}"><i class="fa fa-cogs fa-fw fa-lg" aria-hidden="true"></i> All Services </a></li>
|
||||
@if($service_status)
|
||||
@if($service_counts['warning'] || $service_counts['critical'])
|
||||
<li role="presentation" class="divider"></li>
|
||||
@if($service_warning)
|
||||
<li><a href="{{ url('services/state=warning') }}"><i class="fa fa-bell fa-col-warning fa-fw fa-lg" aria-hidden="true"></i> Warning ({{ $service_warning }})</a></li>
|
||||
@if($service_counts['warning'])
|
||||
<li><a href="{{ url('services/state=warning') }}"><i class="fa fa-bell fa-col-warning fa-fw fa-lg" aria-hidden="true"></i> Warning ({{ $service_counts['warning'] }})</a></li>
|
||||
@endif
|
||||
@if($service_critical)
|
||||
<li><a href="{{ url('services/state=critical') }}"><i class="fa fa-bell fa-col-danger fa-fw fa-lg" aria-hidden="true"></i> Critical ({{ $service_critical }})</a></li>
|
||||
@if($service_counts['critical'])
|
||||
<li><a href="{{ url('services/state=critical') }}"><i class="fa fa-bell fa-col-danger fa-fw fa-lg" aria-hidden="true"></i> Critical ({{ $service_counts['critical'] }})</a></li>
|
||||
@endif
|
||||
@endif
|
||||
@admin
|
||||
@@ -185,33 +185,35 @@
|
||||
<li><a href="{{ url('bills') }}"><i class="fa fa-money fa-fw fa-lg" aria-hidden="true"></i> Traffic Bills</a></li>
|
||||
@endconfig
|
||||
|
||||
@if($port_counts['pseudowire'] > 0))
|
||||
@if($port_counts['pseudowire'] > 0)
|
||||
<li><a href="{{ url('pseudowires') }}"><i class="fa fa-arrows-alt fa-fw fa-lg" aria-hidden="true"></i> Pseudowires</a></li>
|
||||
@endif
|
||||
|
||||
@if(auth()->user()->hasGlobalRead())
|
||||
<li role="presentation" class="divider"></li>
|
||||
@config('int_customers')
|
||||
<li><a href="{{ url('customers') }}"><i class="fa fa-users fa-fw fa-lg" aria-hidden="true"></i> Customers</a></li>
|
||||
@endconfig
|
||||
@config('int_l2tp')
|
||||
<li><a href="{{ url('iftype/type=l2tp') }}"><i class="fa fa-link fa-fw fa-lg" aria-hidden="true"></i> L2TP</a></li>
|
||||
@endconfig
|
||||
@config('int_transit')
|
||||
<li><a href="{{ url('iftype/type=transit') }}"><i class="fa fa-truck fa-fw fa-lg" aria-hidden="true"></i> Transit</a></li>
|
||||
@endconfig
|
||||
@config('int_peering')
|
||||
<li><a href="{{ url('iftype/type=peering') }}"><i class="fa fa-handshake-o fa-fw fa-lg" aria-hidden="true"></i> Peering</a></li>
|
||||
@endconfig
|
||||
@if(\LibreNMS\Config::get('int_peering') && \LibreNMS\Config::get('int_transit'))
|
||||
<li><a href="{{ url('iftype/type=peering,transit') }}"><i class="fa fa-rocket fa-fw fa-lg" aria-hidden="true"></i> Peering + Transit</a></li>
|
||||
@if($port_groups_exist)
|
||||
<li role="presentation" class="divider"></li>
|
||||
@config('int_customers')
|
||||
<li><a href="{{ url('customers') }}"><i class="fa fa-users fa-fw fa-lg" aria-hidden="true"></i> Customers</a></li>
|
||||
@endconfig
|
||||
@config('int_l2tp')
|
||||
<li><a href="{{ url('iftype/type=l2tp') }}"><i class="fa fa-link fa-fw fa-lg" aria-hidden="true"></i> L2TP</a></li>
|
||||
@endconfig
|
||||
@config('int_transit')
|
||||
<li><a href="{{ url('iftype/type=transit') }}"><i class="fa fa-truck fa-fw fa-lg" aria-hidden="true"></i> Transit</a></li>
|
||||
@endconfig
|
||||
@config('int_peering')
|
||||
<li><a href="{{ url('iftype/type=peering') }}"><i class="fa fa-handshake-o fa-fw fa-lg" aria-hidden="true"></i> Peering</a></li>
|
||||
@endconfig
|
||||
@if(\LibreNMS\Config::get('int_peering') && \LibreNMS\Config::get('int_transit'))
|
||||
<li><a href="{{ url('iftype/type=peering,transit') }}"><i class="fa fa-rocket fa-fw fa-lg" aria-hidden="true"></i> Peering + Transit</a></li>
|
||||
@endif
|
||||
@config('int_core')
|
||||
<li><a href="{{ url('iftype/type=core') }}"><i class="fa fa-code-fork fa-fw fa-lg" aria-hidden="true"></i> Core</a></li>
|
||||
@endconfig
|
||||
@foreach($custom_port_descr as $custom_descr)
|
||||
<li><a href="{{ url('iftype/type=' . urlencode($custom_descr)) }}"><i class="fa fa-connectdevelop fa-fw fa-lg" aria-hidden="true"></i> {{ ucwords($custom_descr) }}</a></li>
|
||||
@endforeach
|
||||
@endif
|
||||
@config('int_core')
|
||||
<li><a href="{{ url('iftype/type=core') }}"><i class="fa fa-code-fork fa-fw fa-lg" aria-hidden="true"></i> Core</a></li>
|
||||
@endconfig
|
||||
@foreach((array)\LibreNMS\Config::get('custom_descr', []) as $custom_type)
|
||||
<li><a href="{{ url('iftype/type=' . urlencode(strtolower($custom_type))) }}"><i class="fa fa-connectdevelop fa-fw fa-lg" aria-hidden="true"></i> {{ ucfirst($custom_type) }}</a></li>
|
||||
@endforeach
|
||||
|
||||
<li role="presentation" class="divider"></li>
|
||||
|
||||
@@ -241,14 +243,14 @@
|
||||
@if($loop->first)
|
||||
<li role="presentation" class="divider"></li>
|
||||
@endif
|
||||
<li><a href="{{ url('health/metric=' . $sensor_menu_entry->sensor_class) }}"><i class="fa fa-{{ $sensor_menu_entry->icon() }} fa-fw fa-lg" aria-hidden="true"></i> {{ $sensor_menu_entry->classDescr() }}</a></li>
|
||||
<li><a href="{{ url('health/metric=' . $sensor_menu_entry['class']) }}"><i class="fa fa-{{ $sensor_menu_entry['icon'] }} fa-fw fa-lg" aria-hidden="true"></i> {{ $sensor_menu_entry['descr'] }}</a></li>
|
||||
@endforeach
|
||||
@endforeach
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
{{-- Wireless --}}
|
||||
@if($wireless_menu->count())
|
||||
@if($wireless_menu->isNotEmpty())
|
||||
<li class="dropdown">
|
||||
<a href="{{ url('wireless') }}" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-wifi fa-fw fa-lg fa-nav-icons hidden-md" aria-hidden="true"></i> <span class="hidden-sm">Wireless</span></a>
|
||||
<ul class="dropdown-menu">
|
||||
@@ -259,13 +261,13 @@
|
||||
</li>
|
||||
@endif
|
||||
{{-- App --}}
|
||||
@if($app_menu->count())
|
||||
@if($app_menu->isNotEmpty())
|
||||
<li class="dropdown">
|
||||
<a href="{{ url('apps') }}" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-tasks fa-fw fa-lg fa-nav-icons hidden-md" aria-hidden="true"></i> <span class="hidden-sm">Apps</span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ url('apps') }}"><i class="fa fa-object-group fa-fw fa-lg" aria-hidden="true"></i> Overview</a></li>
|
||||
@foreach($app_menu as $app_type => $app_instances)
|
||||
@if($app_instances->filter->app_instance->count() > 0)
|
||||
@if($app_instances->filter->app_instance->isNotEmpty())
|
||||
<li class="dropdown-submenu">
|
||||
<a href="{{ url('apps/app=' . $app_type) }}"><i class="fa fa-server fa-fw fa-lg" aria-hidden="true"></i> {{ $app_instances->first()->displayName() }}</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
@@ -324,6 +326,7 @@
|
||||
@endadmin
|
||||
</ul>
|
||||
</li>
|
||||
@includeIf('menu.custom')
|
||||
</ul>
|
||||
|
||||
{{-- User --}}
|
||||
@@ -382,6 +385,15 @@
|
||||
</li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
@endadmin
|
||||
@if (isset($refresh))
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#"><span class="countdown_timer" id="countdown_timer"></span></a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<li><a href="#"><span class="countdown_timer_status" id="countdown_timer_status"></span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
@endif
|
||||
<li><a href="{{ url('about') }}"><i class="fa fa-info-circle fa-fw fa-lg" aria-hidden="true"></i> About {{ \LibreNMS\Config::get('project_name') }}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="{{ url('devices') }}">@lang('Devices')</a></td>
|
||||
<td><a href="{{ url('devices') }}"><span> {{ $devices['count'] }}</span></a></td>
|
||||
<td><a href="{{ url('devices') }}"><span> {{ $devices['total'] }}</span></a></td>
|
||||
<td><a href="{{ url('devices/state=up/format=list_detail') }}"><span class="green"> {{ $devices['up'] }}</span></a></td>
|
||||
<td><a href="{{ url('devices/state=down/format=list_detail') }}"><span class="red"> {{ $devices['down'] }}</span></a></td>
|
||||
<td><a href="{{ url('devices/ignore=1/format=list_detail') }}"><span class="grey"> {{ $devices['ignored'] }}</span></a></td>
|
||||
@@ -27,7 +27,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="{{ url('ports') }}">@lang('Ports')</a></td>
|
||||
<td><a href="{{ url('ports') }}"><span>{{ $ports['count'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports') }}"><span>{{ $ports['total'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports/format=list_detail/state=up') }}"><span class="green"> {{ $ports['up'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports/format=list_detail/state=down') }}"><span class="red"> {{ $ports['down'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports/format=list_detail/ignore=1') }}"><span class="grey"> {{ $ports['ignored'] }}</span></a></td>
|
||||
@@ -39,9 +39,9 @@
|
||||
@if($show_services)
|
||||
<tr>
|
||||
<td><a href="{{ url('services') }}">@lang('Services')</a></td>
|
||||
<td><a href="{{ url('services') }}"><span>{{ $services['count'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/state=ok/view=details') }}"><span class="green">{{ $services['up'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/state=critical/view=details') }}"><span class="red"> {{ $services['down'] }}</span></a></td>
|
||||
<td><a href="{{ url('services') }}"><span>{{ $services['total'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/state=ok/view=details') }}"><span class="green">{{ $services['ok'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/state=critical/view=details') }}"><span class="red"> {{ $services['critical'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/ignore=1/view=details') }}"><span class="grey"> {{ $services['ignored'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/disabled=1/view=details') }}"><span class="black"> {{ $services['disabled'] }}</span></a></td>
|
||||
@if($summary_errors)
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<td><a href="{{ url('devices/format=list_detail/state=up') }}"><span class="green"> {{ $devices['up'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports/format=list_detail/state=up') }}"><span class="green"> {{ $ports['up'] }}</span></a></td>
|
||||
@if($show_services)
|
||||
<td><a href="{{ url('services/view=details/state=ok') }}"><span class="green"> {{ $services['up'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/view=details/state=ok') }}"><span class="green"> {{ $services['ok'] }}</span></a></td>
|
||||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -24,7 +24,7 @@
|
||||
<td><a href="{{ url('devices/format=list_detail/state=down') }}"><span class="red"> {{ $devices['down'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports/format=list_detail/state=down') }}"><span class="red"> {{ $ports['down'] }}</span></a></td>
|
||||
@if($show_services)
|
||||
<td><a href="{{ url('services/view=details/state=critical') }}"><span class="red"> {{ $services['down'] }}</span></a></td>
|
||||
<td><a href="{{ url('services/view=details/state=critical') }}"><span class="red"> {{ $services['critical'] }}</span></a></td>
|
||||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -55,10 +55,10 @@
|
||||
@endif
|
||||
<tr>
|
||||
<th><span class="grey">@lang('Total')</span></th>
|
||||
<td><a href="{{ url('devices') }}"><span> {{ $devices['count'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports') }}"><span> {{ $ports['count'] }}</span></a></td>
|
||||
<td><a href="{{ url('devices') }}"><span> {{ $devices['total'] }}</span></a></td>
|
||||
<td><a href="{{ url('ports') }}"><span> {{ $ports['total'] }}</span></a></td>
|
||||
@if($show_services)
|
||||
<td><a href="{{ url('services') }}"><span> {{ $services['count'] }}</span></a></td>
|
||||
<td><a href="{{ url('services') }}"><span> {{ $services['total'] }}</span></a></td>
|
||||
@endif
|
||||
</tr>
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user