Skip to content

Commit

Permalink
Deprecate StateBadge class again
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab authored and nilmerg committed Aug 29, 2023
1 parent aaf3a7b commit 423c9a8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 95 deletions.
2 changes: 1 addition & 1 deletion library/Icingadb/Common/StateBadges.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Icinga\Module\Icingadb\Common;

use Icinga\Module\Icingadb\Widget\StateBadge;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Stdlib\BaseFilter;
use ipl\Stdlib\Filter;
use ipl\Web\Filter\QueryString;
use ipl\Web\Url;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\StateBadge;

abstract class StateBadges extends BaseHtmlElement
{
Expand Down
2 changes: 1 addition & 1 deletion library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Exception;
use Icinga\Application\Logger;
use Icinga\Module\Icingadb\Common\Database;
use Icinga\Module\Icingadb\Widget\StateBadge;
use Icinga\Web\Navigation\NavigationItem;
use Icinga\Web\Navigation\Renderer\NavigationItemRenderer;
use ipl\Html\HtmlDocument;
use ipl\Html\HtmlString;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\StateBadge;

abstract class ProblemsBadge extends NavigationItemRenderer
{
Expand Down
43 changes: 2 additions & 41 deletions library/Icingadb/Widget/StateBadge.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,7 @@

namespace Icinga\Module\Icingadb\Widget;

use ipl\Html\BaseHtmlElement;

class StateBadge extends BaseHtmlElement
/** @deprecated Use {@see \ipl\Web\Widget\StateBadge} instead */
class StateBadge extends \ipl\Web\Widget\StateBadge
{
protected $defaultAttributes = ['class' => 'state-badge'];

/** @var mixed Badge content */
protected $content;

/** @var bool Whether the state is handled */
protected $isHandled;

/** @var string Textual representation of a state */
protected $state;

/**
* Create a new state badge
*
* @param mixed $content Content of the badge
* @param string $state Textual representation of a state
* @param bool $isHandled True if state is handled
*/
public function __construct($content, string $state, bool $isHandled = false)
{
$this->content = $content;
$this->isHandled = $isHandled;
$this->state = $state;
}

protected function assemble()
{
$this->setTag('span');

$class = "state-{$this->state}";
if ($this->isHandled) {
$class .= ' handled';
}

$this->addAttributes(['class' => $class]);

$this->add($this->content);
}
}
52 changes: 0 additions & 52 deletions public/css/widget/state-badge.less

This file was deleted.

0 comments on commit 423c9a8

Please sign in to comment.