mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-26 03:09:10 +02:00
Remove unused method from ItemListControl & try to load dashboards in HomeList only when it's empty
This commit is contained in:
parent
79dd4f37ff
commit
56bfe76a84
@ -30,13 +30,6 @@ abstract class ItemListControl extends BaseHtmlElement
|
|||||||
*/
|
*/
|
||||||
abstract protected function shouldExpandByDefault(): bool;
|
abstract protected function shouldExpandByDefault(): bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a class name for the collapsible control
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
abstract protected function getCollapsibleControlClass(): string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an action link to be added at the end of the list
|
* Create an action link to be added at the end of the list
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,10 @@ class DashboardHomeList extends ItemListControl
|
|||||||
public function __construct(DashboardHome $home)
|
public function __construct(DashboardHome $home)
|
||||||
{
|
{
|
||||||
$this->home = $home;
|
$this->home = $home;
|
||||||
$this->home->loadDashboardEntries();
|
if (! $this->home->hasEntries()) {
|
||||||
|
// Just retry to load dashboards
|
||||||
|
$this->home->loadDashboardEntries();
|
||||||
|
}
|
||||||
|
|
||||||
$this->getAttributes()
|
$this->getAttributes()
|
||||||
->registerAttributeCallback('data-icinga-home', function () {
|
->registerAttributeCallback('data-icinga-home', function () {
|
||||||
@ -58,11 +61,6 @@ class DashboardHomeList extends ItemListControl
|
|||||||
return $this->home->isActive();
|
return $this->home->isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCollapsibleControlClass(): string
|
|
||||||
{
|
|
||||||
return 'dashboard-list-info';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function createItemList(): BaseHtmlElement
|
protected function createItemList(): BaseHtmlElement
|
||||||
{
|
{
|
||||||
if (! $this->headerDisabled) {
|
if (! $this->headerDisabled) {
|
||||||
|
@ -37,12 +37,7 @@ class DashboardList extends ItemListControl
|
|||||||
|
|
||||||
protected function shouldExpandByDefault(): bool
|
protected function shouldExpandByDefault(): bool
|
||||||
{
|
{
|
||||||
return $this->pane->isActive();
|
return $this->pane->getHome()->isActive() && $this->pane->isActive();
|
||||||
}
|
|
||||||
|
|
||||||
protected function getCollapsibleControlClass(): string
|
|
||||||
{
|
|
||||||
return 'dashlets-list-info';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createItemList(): BaseHtmlElement
|
protected function createItemList(): BaseHtmlElement
|
||||||
|
@ -59,9 +59,9 @@ class DashletListItem extends BaseHtmlElement
|
|||||||
/**
|
/**
|
||||||
* Assemble header of this dashlet item
|
* Assemble header of this dashlet item
|
||||||
*
|
*
|
||||||
* @return ValidHtml
|
* @return BaseHtmlElement
|
||||||
*/
|
*/
|
||||||
protected function assembleHeader(): ValidHtml
|
protected function assembleHeader(): BaseHtmlElement
|
||||||
{
|
{
|
||||||
$header = HtmlElement::create('div', ['class' => 'dashlet-header']);
|
$header = HtmlElement::create('div', ['class' => 'dashlet-header']);
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class DashletListItem extends BaseHtmlElement
|
|||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assembleSummary()
|
protected function assembleSummary(): BaseHtmlElement
|
||||||
{
|
{
|
||||||
$section = HtmlElement::create('section', ['class' => 'caption']);
|
$section = HtmlElement::create('section', ['class' => 'caption']);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Web\Dashboard\ItemList;
|
namespace Icinga\Web\Dashboard\ItemList;
|
||||||
|
|
||||||
|
use ipl\Html\BaseHtmlElement;
|
||||||
use ipl\Html\Contract\FormElement;
|
use ipl\Html\Contract\FormElement;
|
||||||
use ipl\Html\HtmlElement;
|
use ipl\Html\HtmlElement;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ class DashletListMultiSelect extends DashletListItem
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createLabel(): HtmlElement
|
protected function createLabel(): BaseHtmlElement
|
||||||
{
|
{
|
||||||
$label = HtmlElement::create('label');
|
$label = HtmlElement::create('label');
|
||||||
$label->addHtml($this->checkbox);
|
$label->addHtml($this->checkbox);
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
namespace Icinga\Web\Dashboard\ItemList;
|
namespace Icinga\Web\Dashboard\ItemList;
|
||||||
|
|
||||||
|
use ipl\Html\BaseHtmlElement;
|
||||||
use ipl\Html\HtmlElement;
|
use ipl\Html\HtmlElement;
|
||||||
use ipl\Html\ValidHtml;
|
|
||||||
|
|
||||||
class EmptyDashlet extends DashletListMultiSelect
|
class EmptyDashlet extends DashletListMultiSelect
|
||||||
{
|
{
|
||||||
protected function assembleHeader(): ValidHtml
|
protected function assembleHeader(): BaseHtmlElement
|
||||||
{
|
{
|
||||||
$header = HtmlElement::create('div', ['class' => 'dashlet-header']);
|
$header = HtmlElement::create('div', ['class' => 'dashlet-header']);
|
||||||
$header->add(t('Custom Url'));
|
$header->add(t('Custom Url'));
|
||||||
@ -17,7 +17,7 @@ class EmptyDashlet extends DashletListMultiSelect
|
|||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assembleSummary()
|
protected function assembleSummary(): BaseHtmlElement
|
||||||
{
|
{
|
||||||
$section = HtmlElement::create('section', ['class' => 'caption']);
|
$section = HtmlElement::create('section', ['class' => 'caption']);
|
||||||
$section->add(t('Create a dashlet with custom url and filter'));
|
$section->add(t('Create a dashlet with custom url and filter'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user