mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-26 11:19:14 +02:00
Adjust param description & extract home properties from a homeitem properly
This commit is contained in:
parent
2913a4fd44
commit
0a94adcaca
@ -253,7 +253,7 @@ abstract class BaseDashboard implements DashboardEntry
|
||||
{
|
||||
}
|
||||
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $updateChildEntries = false)
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $manageRecursive = false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -105,13 +105,14 @@ interface DashboardEntry
|
||||
* move pane(s)|dashlet(s) from another to this widget you have to also provide the origin from which the
|
||||
* given entry(ies) originated
|
||||
*
|
||||
* @param BaseDashboard|BaseDashboard[] $entry
|
||||
* @param ?BaseDashboard $origin
|
||||
* @param bool $updateChildEntries
|
||||
* @param BaseDashboard|BaseDashboard[] $entry The actual dashboard entry to be managed
|
||||
* @param ?BaseDashboard $origin The original widget from which the given entry originates
|
||||
* @param bool $manageRecursive Whether the given entry should be managed recursively e.g if the given entry
|
||||
* is a Pane type, all its dashlets can be managed recursively
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $updateChildEntries = false);
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $manageRecursive = false);
|
||||
|
||||
/**
|
||||
* Load all the assigned entries to this widget
|
||||
|
@ -156,7 +156,7 @@ trait DashboardManager
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $updateChildEntries = false)
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $manageRecursive = false)
|
||||
{
|
||||
$conn = self::getConn();
|
||||
$homes = is_array($entry) ? $entry : [$entry];
|
||||
|
@ -38,6 +38,11 @@ class DashboardHome extends BaseDashboard implements Sortable
|
||||
*/
|
||||
protected $type = Dashboard::SYSTEM;
|
||||
|
||||
/**
|
||||
* A flag whether this home has been activated
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $active;
|
||||
|
||||
/**
|
||||
@ -49,7 +54,14 @@ class DashboardHome extends BaseDashboard implements Sortable
|
||||
*/
|
||||
public static function create(DashboardHomeItem $homeItem)
|
||||
{
|
||||
return new self($homeItem->getName(), $homeItem->getAttributes());
|
||||
$self = new self($homeItem->getName());
|
||||
$self
|
||||
->setTitle($homeItem->getLabel())
|
||||
->setPriority($homeItem->getPriority())
|
||||
->setType($homeItem->getAttribute('type'))
|
||||
->setUuid($homeItem->getAttribute('uuid'));
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,7 +172,7 @@ class DashboardHome extends BaseDashboard implements Sortable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $updateChildEntries = false)
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $manageRecursive = false)
|
||||
{
|
||||
$user = Dashboard::getUser();
|
||||
$conn = Dashboard::getConn();
|
||||
@ -218,7 +230,7 @@ class DashboardHome extends BaseDashboard implements Sortable
|
||||
$pane->setUuid($uuid);
|
||||
}
|
||||
|
||||
if ($updateChildEntries) {
|
||||
if ($manageRecursive) {
|
||||
// Those dashboard panes are usually system defaults and go up when
|
||||
// the user is clicking on the "Use System Defaults" button
|
||||
$dashlets = $pane->getEntries();
|
||||
|
@ -187,7 +187,7 @@ class Pane extends BaseDashboard implements Sortable, OverridingWidget
|
||||
$newDashlet = new Dashlet($dashlet->name, $dashlet->url, $this);
|
||||
$newDashlet->fromArray([
|
||||
'uuid' => $dashlet->id,
|
||||
'title' => t($dashlet->label),
|
||||
'title' => $dashlet->label,
|
||||
'priority' => $dashlet->priority,
|
||||
'pane' => $this,
|
||||
'description' => $dashlet->module_dashlet->description
|
||||
@ -199,7 +199,7 @@ class Pane extends BaseDashboard implements Sortable, OverridingWidget
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $updateChildEntries = false)
|
||||
public function manageEntry($entry, BaseDashboard $origin = null, $manageRecursive = false)
|
||||
{
|
||||
if ($origin && ! $origin instanceof Pane) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
|
@ -55,10 +55,7 @@ class HomeMenu extends Menu
|
||||
continue;
|
||||
}
|
||||
|
||||
$home = DashboardHome::create($child);
|
||||
$home->setTitle($child->getLabel());
|
||||
|
||||
$homes[$child->getName()] = $home;
|
||||
$homes[$child->getName()] = DashboardHome::create($child);
|
||||
}
|
||||
|
||||
return $homes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user