mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-25 18:59:04 +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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
@ -26,7 +26,10 @@ class DashboardHomeList extends ItemListControl
|
||||
public function __construct(DashboardHome $home)
|
||||
{
|
||||
$this->home = $home;
|
||||
$this->home->loadDashboardEntries();
|
||||
if (! $this->home->hasEntries()) {
|
||||
// Just retry to load dashboards
|
||||
$this->home->loadDashboardEntries();
|
||||
}
|
||||
|
||||
$this->getAttributes()
|
||||
->registerAttributeCallback('data-icinga-home', function () {
|
||||
@ -58,11 +61,6 @@ class DashboardHomeList extends ItemListControl
|
||||
return $this->home->isActive();
|
||||
}
|
||||
|
||||
protected function getCollapsibleControlClass(): string
|
||||
{
|
||||
return 'dashboard-list-info';
|
||||
}
|
||||
|
||||
protected function createItemList(): BaseHtmlElement
|
||||
{
|
||||
if (! $this->headerDisabled) {
|
||||
|
@ -37,12 +37,7 @@ class DashboardList extends ItemListControl
|
||||
|
||||
protected function shouldExpandByDefault(): bool
|
||||
{
|
||||
return $this->pane->isActive();
|
||||
}
|
||||
|
||||
protected function getCollapsibleControlClass(): string
|
||||
{
|
||||
return 'dashlets-list-info';
|
||||
return $this->pane->getHome()->isActive() && $this->pane->isActive();
|
||||
}
|
||||
|
||||
protected function createItemList(): BaseHtmlElement
|
||||
|
@ -59,9 +59,9 @@ class DashletListItem extends BaseHtmlElement
|
||||
/**
|
||||
* 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']);
|
||||
|
||||
@ -100,7 +100,7 @@ class DashletListItem extends BaseHtmlElement
|
||||
return $header;
|
||||
}
|
||||
|
||||
protected function assembleSummary()
|
||||
protected function assembleSummary(): BaseHtmlElement
|
||||
{
|
||||
$section = HtmlElement::create('section', ['class' => 'caption']);
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
namespace Icinga\Web\Dashboard\ItemList;
|
||||
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\Contract\FormElement;
|
||||
use ipl\Html\HtmlElement;
|
||||
|
||||
@ -26,7 +27,7 @@ class DashletListMultiSelect extends DashletListItem
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function createLabel(): HtmlElement
|
||||
protected function createLabel(): BaseHtmlElement
|
||||
{
|
||||
$label = HtmlElement::create('label');
|
||||
$label->addHtml($this->checkbox);
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
namespace Icinga\Web\Dashboard\ItemList;
|
||||
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\HtmlElement;
|
||||
use ipl\Html\ValidHtml;
|
||||
|
||||
class EmptyDashlet extends DashletListMultiSelect
|
||||
{
|
||||
protected function assembleHeader(): ValidHtml
|
||||
protected function assembleHeader(): BaseHtmlElement
|
||||
{
|
||||
$header = HtmlElement::create('div', ['class' => 'dashlet-header']);
|
||||
$header->add(t('Custom Url'));
|
||||
@ -17,7 +17,7 @@ class EmptyDashlet extends DashletListMultiSelect
|
||||
return $header;
|
||||
}
|
||||
|
||||
protected function assembleSummary()
|
||||
protected function assembleSummary(): BaseHtmlElement
|
||||
{
|
||||
$section = HtmlElement::create('section', ['class' => 'caption']);
|
||||
$section->add(t('Create a dashlet with custom url and filter'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user