More Widget fixes (#9559)

* limit worldmap to active devices, use scope in availability map

* Linkable totals and better option description for disabled/ignored.

* fix disabled / ignore enabled display

* better? links

* style improvements.  Not important enough to bump version

* fix top interfaces query
This commit is contained in:
Tony Murray
2018-12-17 16:45:17 -06:00
committed by GitHub
parent 220bc2040c
commit 5d20686d34
6 changed files with 16 additions and 11 deletions

View File

@@ -102,9 +102,9 @@ class AvailabilityMapController extends WidgetController
}
if (!$settings['show_disabled_and_ignored']) {
$device_query->where('disabled', 0)->where('ignore', 0);
$device_query->isActive();
}
$devices = $device_query->select('devices.device_id', 'hostname', 'sysName', 'status', 'uptime')->get();
$devices = $device_query->select('devices.device_id', 'hostname', 'sysName', 'status', 'uptime', 'disabled', 'ignore')->get();
// process status
$uptime_warn = Config::get('uptime_warning', 84600);

View File

@@ -52,7 +52,8 @@ class TopInterfacesController extends WidgetController
}])
->select('port_id', 'device_id', 'ifName', 'ifDescr', 'ifAlias')
->groupBy('port_id', 'device_id', 'ifName', 'ifDescr', 'ifAlias')
->where('poll_time', '>', Carbon::now()->subMinutes($data['time_interval']))
->where('poll_time', '>', Carbon::now()->subMinutes($data['time_interval'])->timestamp)
->has('device')
->orderByRaw('SUM(ifInOctets_rate + ifOutOctets_rate) DESC')
->limit($data['interface_count']);

View File

@@ -58,7 +58,7 @@ class WorldMapController extends WidgetController
$devices = Device::hasAccess($request->user())
->with('location')
->where('disabled', 0)
->isActive()
->whereIn('status', $status)
->get()
->filter(function ($device) use ($status) {

View File

@@ -1917,6 +1917,7 @@ label {
overflow-y: auto;
width: 100%;
height: calc(100% - 38px);
cursor: auto;
}
.device-availability, .service-availability {
@@ -2007,7 +2008,6 @@ label {
.widget-availability {
float:left;
margin:2px;
curosr: pointer;
}
.widget-availability-fixed {
@@ -2021,6 +2021,10 @@ label {
margin-bottom: 10px;
}
.widget-availability-host a:hover {
text-decoration: none;
}
.widget-availability-service {
float:right;
margin-bottom: 10px;

View File

@@ -2,12 +2,12 @@
<div class="widget-availability-host">
<span>@lang('Total hosts')</span>
@if($show_disabled_and_ignored)
<span class="label label-default label-font-border label-border">@lang('ignored'): {{ $device_totals['ignored'] }}</span>
<span class="label blackbg label-font-border label-border">@lang('disabled'): {{ $device_totals['disabled'] }}</span>
<a href="{{ url('devices/ignore=1') }}"><span class="label label-default label-font-border label-border">@lang('ignored'): {{ $device_totals['ignored'] }}</span></a>
<a href="{{ url('devices/disabled=1') }}"><span class="label blackbg label-font-border label-border">@lang('disabled'): {{ $device_totals['disabled'] }}</span></a>
@endif
<span class="label label-success label-font-border label-border">@lang('up'): {{ $device_totals['up'] }}</span>
<a href="{{ url('devices/state=up') }}"><span class="label label-success label-font-border label-border">@lang('up'): {{ $device_totals['up'] }}</span></a>
<span class="label label-warning label-font-border label-border">@lang('warn'): {{ $device_totals['warn'] }}</span>
<span class="label label-danger label-font-border label-border">@lang('down'): {{ $device_totals['down'] }}</span>
<a href="{{ url('devices/state=down') }}"><span class="label label-danger label-font-border label-border">@lang('down'): {{ $device_totals['down'] }}</span></a>
</div>
@endif

View File

@@ -30,8 +30,8 @@
<div class="form-group">
<label for="show_disabled_and_ignored-{{ $id }}" class="control-label">@lang('Disabled/ignored')</label>
<select class="form-control" name="show_disabled_and_ignored" id="show_disabled_and_ignored-{{ $id }}">
<option value="1" @if($show_disabled_and_ignored) selected @endif>@lang('yes')</option>
<option value="0" @unless($show_disabled_and_ignored) selected @endunless>@lang('no')</option>
<option value="1" @if($show_disabled_and_ignored) selected @endif>@lang('Show')</option>
<option value="0" @unless($show_disabled_and_ignored) selected @endunless>@lang('Hide')</option>
</select>
</div>