default port group in Settings (#13175)

* default port group in Settings

* .

* wrap query with try catch

* update config schema

* change to select2

* .

* .

* inject no default port group choice

* Paginator

* .
This commit is contained in:
SourceDoctor
2021-09-03 15:58:09 +02:00
committed by GitHub
parent 4f50c3c05d
commit ada7bae84c
5 changed files with 39 additions and 13 deletions

View File

@@ -38,6 +38,19 @@ class PortGroupController extends SelectController
return PortGroup::hasAccess($request->user())->select(['id', 'name']);
}
protected function formatResponse($paginator)
{
// prepend the default group, unless filtered out
if ($this->includeGeneral()) {
$general = new PortGroup;
$general->id = 0;
$general->name = 'no default Port Group';
$paginator->prepend($general);
}
return parent::formatResponse($paginator);
}
/**
* @param PortGroup $port_group
*/