Remove some unnecessary classes

This commit is contained in:
Yonas Habteab 2022-04-06 16:46:22 +02:00
parent 85a53764f6
commit e5f501dae3
2 changed files with 0 additions and 116 deletions

View File

@ -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);
}
}

View File

@ -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;
}
}