mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-15 00:43:23 -05:00
NodeTile: Hash ids the same way as in the tree view
This commit is contained in:
parent
e36e918d32
commit
1529ec4602
3 changed files with 11 additions and 13 deletions
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Icinga\Module\Businessprocess\Renderer;
|
||||
|
||||
use Icinga\Date\DateFormatter;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Module\Businessprocess\BpNode;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
|
|
@ -11,7 +10,6 @@ use Icinga\Module\Businessprocess\Web\Url;
|
|||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Html\HtmlDocument;
|
||||
use ipl\Html\HtmlString;
|
||||
|
||||
abstract class Renderer extends HtmlDocument
|
||||
{
|
||||
|
|
@ -187,6 +185,16 @@ abstract class Renderer extends HtmlDocument
|
|||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node $node
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
public function getId(Node $node, $path)
|
||||
{
|
||||
return md5(implode(';', $path) . $node->getName());
|
||||
}
|
||||
|
||||
public function setPath(array $path)
|
||||
{
|
||||
$this->path = $path;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class NodeTile extends BaseHtmlElement
|
|||
|
||||
$attributes = $this->getAttributes();
|
||||
$attributes->add('class', $renderer->getNodeClasses($node));
|
||||
$attributes->add('id', 'bp-' . $node->getName());
|
||||
$attributes->add('id', $renderer->getId($node, $this->path));
|
||||
if (! $renderer->isLocked()) {
|
||||
$attributes->add('data-node-name', $node->getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,16 +86,6 @@ class TreeRenderer extends Renderer
|
|||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node $node
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
protected function getId(Node $node, $path)
|
||||
{
|
||||
return md5(implode(';', $path) . $node->getName());
|
||||
}
|
||||
|
||||
protected function getStateClassNames(Node $node)
|
||||
{
|
||||
$state = strtolower($node->getStateName());
|
||||
|
|
|
|||
Loading…
Reference in a new issue