Skip to content

Commit aabbc4f

Browse files
committed
Fix debugTable creation in iframe mode
1 parent 677fada commit aabbc4f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public function getPreviewHtml(Model $object, $report = false)
472472
// Add a data table with runtime information and configuration for debugging purposes
473473
if (Url::fromRequest()->hasParam('grafanaDebug') && $this->permission->hasPermission('grafana/debug') && $report === false) {
474474
$returnHtml->addHtml(HtmlElement::create('h2', null, 'Performance Graph Debug'));
475-
$returnHtml->add($this->createDebugTable());
475+
$returnHtml->add($this->createDebugTable($previewHtml));
476476
}
477477

478478
$htmlForObject = HtmlElement::create("div", ["class" => "icinga-module module-grafana"]);
@@ -486,15 +486,12 @@ public function getPreviewHtml(Model $object, $report = false)
486486
/**
487487
* createDebugTable creates a data table with runtime information and configuration for debugging purposes
488488
*/
489-
private function createDebugTable()
489+
private function createDebugTable($previewHtml)
490490
{
491-
if ($this->accessMode === 'indirectproxy') {
492-
$usedUrl = $this->pngUrl;
493-
} else {
494-
$usedUrl = preg_replace('/.*?src\s*=\s*[\'\"](.*?)[\'\"].*/', "$1", $previewHtml);
495-
}
491+
$usedUrl = $this->pngUrl;
496492

497493
if ($this->accessMode === 'iframe') {
494+
$usedUrl = preg_replace('/.*?src\s*=\s*[\'\"](.*?)[\'\"].*/', "$1", $previewHtml);
498495
$this->height = '100%';
499496
}
500497

0 commit comments

Comments
 (0)