mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-23 18:07:42 +02:00
Remove some unnecessary classes
This commit is contained in:
parent
85a53764f6
commit
e5f501dae3
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */
|
||||
|
||||
namespace Icinga\Model;
|
||||
|
||||
use ipl\Orm\Model;
|
||||
use ipl\Orm\Relations;
|
||||
use ipl\Sql\Expression;
|
||||
|
||||
class DashboardOverride extends Model
|
||||
{
|
||||
public function getTableName()
|
||||
{
|
||||
return 'dashboard_override';
|
||||
}
|
||||
|
||||
public function getKeyName()
|
||||
{
|
||||
return 'dashboard_id';
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'label',
|
||||
'username',
|
||||
'disabled',
|
||||
'priority',
|
||||
'acceptance' => new Expression('0')
|
||||
];
|
||||
}
|
||||
|
||||
public function getMetaData()
|
||||
{
|
||||
return ['priority' => t('Dashboard Priority Order')];
|
||||
}
|
||||
|
||||
public function getSearchColumns()
|
||||
{
|
||||
return ['name'];
|
||||
}
|
||||
|
||||
public function getDefaultSort()
|
||||
{
|
||||
return 'dashboard.name';
|
||||
}
|
||||
|
||||
public function createRelations(Relations $relations)
|
||||
{
|
||||
$relations->belongsTo('dashboard', Pane::class);
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */
|
||||
|
||||
namespace Icinga\Web;
|
||||
|
||||
use Icinga\Model\Home;
|
||||
use Icinga\Web\Dashboard\Dashboard;
|
||||
use Icinga\Web\Dashboard\DashboardHome;
|
||||
use Icinga\Web\Navigation\DashboardHomeItem;
|
||||
use ipl\Stdlib\Filter;
|
||||
|
||||
/**
|
||||
* Entrypoint of the dashboard homes
|
||||
*/
|
||||
class HomeMenu extends Menu
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->initHome();
|
||||
}
|
||||
|
||||
public function initHome()
|
||||
{
|
||||
$user = Dashboard::getUser();
|
||||
$dashboardItem = $this->getItem('dashboard');
|
||||
|
||||
$homes = Home::on(Dashboard::getConn());
|
||||
$homes->filter(Filter::equal('username', $user->getUsername()));
|
||||
|
||||
foreach ($homes as $home) {
|
||||
$dashboardHome = new DashboardHomeItem($home->name, [
|
||||
'uuid' => $home->id,
|
||||
'label' => t($home->label),
|
||||
'priority' => $home->priority,
|
||||
'type' => $home->type,
|
||||
]);
|
||||
|
||||
$dashboardItem->addChild($dashboardHome);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load dashboard homes form the navigation menu
|
||||
*
|
||||
* @return DashboardHome[]
|
||||
*/
|
||||
public function loadHomes()
|
||||
{
|
||||
$homes = [];
|
||||
foreach ($this->getItem('dashboard')->getChildren() as $child) {
|
||||
if (! $child instanceof DashboardHomeItem) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$homes[$child->getName()] = DashboardHome::create($child);
|
||||
}
|
||||
|
||||
return $homes;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user