Ports by device group (#14175)

* Add devicegroup filterFields

* add Devicegroup to post function

* StyleCI

* Add GUI Element

* Less wordy

Dropped "View" from the link. Made it too wordy for such a small GUI insertion.

* Moved DeviceGroup Ports link to a separate column

I realized how it could be confusing to have links to two different items in the same column, so I separated the Ports out.
This commit is contained in:
electrocret
2022-08-04 18:09:21 -05:00
committed by GitHub
parent 06e699d5e8
commit 1d1b2b1c8b
3 changed files with 12 additions and 0 deletions

View File

@@ -63,6 +63,13 @@ class PortsController extends TableController
'port_descr_type',
'ports.disabled' => 'disabled',
'ports.ignore' => 'ignore',
'devicegroup' => function ($query, $devicegroup) {
return $query->whereHas('device', function ($query) use ($devicegroup) {
return $query->whereHas('groups', function ($query) use ($devicegroup) {
return $query->where('id', $devicegroup);
});
});
},
];
}

View File

@@ -121,6 +121,7 @@ var grid = $("#ports").bootgrid({
ignore: '<?php echo $vars['ignore']; ?>',
deleted: '<?php echo $vars['deleted']; ?>',
errors: '<?php echo $vars['errors']; ?>',
devicegroup: '<?php echo $vars['devicegroup']; ?>',
};
},
url: '<?php echo route('table.ports') ?>'

View File

@@ -24,6 +24,7 @@
<th>{{ __('Description') }}</th>
<th>{{ __('Type') }}</th>
<th>{{ __('Devices') }}</th>
<th>{{ __('Ports') }}</th>
<th>{{ __('Pattern') }}</th>
<th>{{ __('Actions') }}</th>
</tr>
@@ -37,6 +38,9 @@
<td>
<a href="{{ url("/devices/group=$device_group->id") }}">{{ $device_group->devices_count }}</a>
</td>
<td>
<a href="{{ url("/ports/devicegroup=$device_group->id") }}">View</a>
</td>
<td>{{ $device_group->type == 'dynamic' ? $device_group->getParser()->toSql(false) : '' }}</td>
<td>
<button type="button" title="{{ __('Rediscover all Devices of Device Group') }}" class="btn btn-warning btn-sm" aria-label="{{ __('Rediscover Group') }}"