Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate StateBadge class again #828

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.