mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-26 03:09:10 +02:00
Remove some unused interfaces/attrs
This commit is contained in:
parent
0a94adcaca
commit
85a53764f6
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */
|
||||
|
||||
namespace Icinga\Web\Dashboard\Common;
|
||||
|
||||
interface OverridingWidget
|
||||
{
|
||||
/**
|
||||
* Set whether this widget overrides another widget
|
||||
*
|
||||
* @param bool $override
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function override(bool $override);
|
||||
|
||||
/**
|
||||
* Get whether this widget overrides another widget
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOverriding();
|
||||
}
|
@ -122,14 +122,12 @@ class DashboardHome extends BaseDashboard implements Sortable
|
||||
}
|
||||
|
||||
$pane = $pane instanceof Pane ? $pane : $this->getEntry($pane);
|
||||
if (! $pane->isOverriding()) {
|
||||
$pane->removeEntries();
|
||||
$pane->removeEntries();
|
||||
|
||||
Dashboard::getConn()->delete(Pane::TABLE, [
|
||||
'id = ?' => $pane->getUuid(),
|
||||
'home_id = ?' => $this->getUuid()
|
||||
]);
|
||||
}
|
||||
Dashboard::getConn()->delete(Pane::TABLE, [
|
||||
'id = ?' => $pane->getUuid(),
|
||||
'home_id = ?' => $this->getUuid()
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -192,44 +190,42 @@ class DashboardHome extends BaseDashboard implements Sortable
|
||||
/** @var Pane $pane */
|
||||
foreach ($panes as $pane) {
|
||||
$uuid = Dashboard::getSHA1($user->getUsername() . $this->getName() . $pane->getName());
|
||||
if (! $pane->isOverriding()) {
|
||||
if (! $this->hasEntry($pane->getName()) && (! $origin || ! $origin->hasEntry($pane->getName()))) {
|
||||
$conn->insert(Pane::TABLE, [
|
||||
'id' => $uuid,
|
||||
'home_id' => $this->getUuid(),
|
||||
'name' => $pane->getName(),
|
||||
'label' => $pane->getTitle(),
|
||||
'username' => $user->getUsername(),
|
||||
'priority' => $order++
|
||||
]);
|
||||
} elseif (! $this->hasEntry($pane->getName()) || ! $origin || ! $origin->hasEntry($pane->getName())) {
|
||||
if (! $this->hasEntry($pane->getName()) && (! $origin || ! $origin->hasEntry($pane->getName()))) {
|
||||
$conn->insert(Pane::TABLE, [
|
||||
'id' => $uuid,
|
||||
'home_id' => $this->getUuid(),
|
||||
'name' => $pane->getName(),
|
||||
'label' => $pane->getTitle(),
|
||||
'username' => $user->getUsername(),
|
||||
'priority' => $order++
|
||||
]);
|
||||
} elseif (! $this->hasEntry($pane->getName()) || ! $origin || ! $origin->hasEntry($pane->getName())) {
|
||||
$filterCondition = [
|
||||
'id = ?' => $pane->getUuid(),
|
||||
'home_id = ?' => $this->getUuid()
|
||||
];
|
||||
|
||||
if ($origin && $origin->hasEntry($pane->getName())) {
|
||||
$filterCondition = [
|
||||
'id = ?' => $pane->getUuid(),
|
||||
'home_id = ?' => $this->getUuid()
|
||||
'id = ?' => $origin->getEntry($pane->getName())->getUuid(),
|
||||
'home_id = ?' => $origin->getUuid()
|
||||
];
|
||||
|
||||
if ($origin && $origin->hasEntry($pane->getName())) {
|
||||
$filterCondition = [
|
||||
'id = ?' => $origin->getEntry($pane->getName())->getUuid(),
|
||||
'home_id = ?' => $origin->getUuid()
|
||||
];
|
||||
}
|
||||
|
||||
$conn->update(Pane::TABLE, [
|
||||
'id' => $uuid,
|
||||
'home_id' => $this->getUuid(),
|
||||
'label' => $pane->getTitle(),
|
||||
'priority' => $pane->getPriority()
|
||||
], $filterCondition);
|
||||
} else {
|
||||
// Failed to move the pane! Should have been handled already by the caller
|
||||
break;
|
||||
}
|
||||
|
||||
$pane->setHome($this);
|
||||
$pane->setUuid($uuid);
|
||||
$conn->update(Pane::TABLE, [
|
||||
'id' => $uuid,
|
||||
'home_id' => $this->getUuid(),
|
||||
'label' => $pane->getTitle(),
|
||||
'priority' => $pane->getPriority()
|
||||
], $filterCondition);
|
||||
} else {
|
||||
// Failed to move the pane! Should have been handled already by the caller
|
||||
break;
|
||||
}
|
||||
|
||||
$pane->setHome($this);
|
||||
$pane->setUuid($uuid);
|
||||
|
||||
if ($manageRecursive) {
|
||||
// Those dashboard panes are usually system defaults and go up when
|
||||
// the user is clicking on the "Use System Defaults" button
|
||||
|
@ -9,7 +9,6 @@ use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Model;
|
||||
use Icinga\Web\Dashboard\Common\DashboardControls;
|
||||
use Icinga\Web\Dashboard\Common\OverridingWidget;
|
||||
use Icinga\Web\Dashboard\Common\Sortable;
|
||||
use ipl\Stdlib\Filter;
|
||||
use ipl\Web\Url;
|
||||
@ -19,26 +18,12 @@ use function ipl\Stdlib\get_php_type;
|
||||
/**
|
||||
* A pane, displaying different Dashboard dashlets
|
||||
*/
|
||||
class Pane extends BaseDashboard implements Sortable, OverridingWidget
|
||||
class Pane extends BaseDashboard implements Sortable
|
||||
{
|
||||
use DashboardControls;
|
||||
|
||||
const TABLE = 'dashboard';
|
||||
|
||||
/**
|
||||
* Whether this widget overrides another widget
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $override;
|
||||
|
||||
/**
|
||||
* Number of users who have subscribed to this pane if (public)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $acceptance;
|
||||
|
||||
/**
|
||||
* A dashboard home this pane is a part of
|
||||
*
|
||||
@ -46,40 +31,6 @@ class Pane extends BaseDashboard implements Sortable, OverridingWidget
|
||||
*/
|
||||
protected $home;
|
||||
|
||||
public function override(bool $override)
|
||||
{
|
||||
$this->override = $override;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isOverriding()
|
||||
{
|
||||
return $this->override;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of users who have subscribed to this pane if (public)
|
||||
*
|
||||
* @param int $acceptance
|
||||
*/
|
||||
public function setAcceptance($acceptance)
|
||||
{
|
||||
$this->acceptance = $acceptance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of users who have subscribed to this pane if (public)
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAcceptance()
|
||||
{
|
||||
return $this->acceptance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dashboard home this pane is a part of
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user