diff --git a/application/views/scripts/process/show.phtml b/application/views/scripts/process/show.phtml index 4ee8336..5c1bedc 100644 --- a/application/views/scripts/process/show.phtml +++ b/application/views/scripts/process/show.phtml @@ -57,7 +57,7 @@ use Icinga\Module\Businessprocess\BusinessProcess; -
+
bp->renderHtml($this) ?> bpconfig->isLocked()): ?> bp instanceof BusinessProcess): /* do not render when showing subtree */ ?> diff --git a/library/Businessprocess/BusinessProcess.php b/library/Businessprocess/BusinessProcess.php index c852e83..af90113 100644 --- a/library/Businessprocess/BusinessProcess.php +++ b/library/Businessprocess/BusinessProcess.php @@ -171,6 +171,11 @@ class BusinessProcess return $this->name; } + public function getHtmlId() + { + return 'businessprocess-' . preg_replace('/[\r\n\t\s]/', '_', $this->getName()); + } + public function setTitle($title) { $this->title = $title; diff --git a/public/js/module.js b/public/js/module.js index a612aa3..09372dd 100644 --- a/public/js/module.js +++ b/public/js/module.js @@ -134,20 +134,20 @@ }, fixOpenedBps: function(event) { - var $container = $(event.currentTarget); - var container_id = $container.attr('id'); + var $bpDiv = $(event.currentTarget).find('div.bp'); + var bpName = $bpDiv.attr('id'); - if (typeof this.idCache[container_id] === 'undefined') { + if (typeof this.idCache[bpName] === 'undefined') { return; } - var $procs = $('table.process', $container); - $.each(this.idCache[$container.attr('id')], function(idx, id) { + var $procs = $bpDiv.find('table.process'); + + $.each(this.idCache[bpName], function(idx, id) { var $el = $('#' + id); $procs = $procs.not($el); $el.parents('table.process').each(function (idx, el) { $procs = $procs.not($(el)); - }); }); @@ -160,9 +160,11 @@ * Only get the deepest nodes to keep requests as small as possible */ rememberOpenedBps: function (event) { - var $container = $(event.currentTarget); var ids = []; - $('table.process', $container) + var $bpDiv = $(event.currentTarget).find('div.bp'); + var $bpName = $bpDiv.attr('id'); + + $bpDiv.find('table.process') .not('table.process.collapsed') .not('table.process.collapsed table.process') .each(function (key, el) { @@ -172,7 +174,7 @@ return; } - this.idCache[$container.attr('id')] = ids; + this.idCache[$bpName] = ids; } };