Skip to content

Commit 8ca93fa

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

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It now uses the check interval to determine how long a graph's image is cached.
1717
- PHP 8.2 and PHP 8.3 Support
1818
- Support strict CSP
1919
- Dark/Light Theme depending on user's settings (removed the `theme` configuration option)
20-
- Debug information can be requested via the `debugGrafana` URL parameter (removed the `debug` configuration option)
20+
- Debug information can be requested via the `grafanaDebug` URL parameter (removed the `debug` configuration option)
2121

2222
**Fixes**
2323
- Use of special characters in custom variables now works

doc/03-module-configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ ssl_verifypeer = "0"
4040
ssl_verifyhost = "0"
4141
```
4242

43+
Hint: to display debug information for graphs you can use the URL parameter `&grafanaDebug`. This requires the `grafana/debug` permission.
44+
4345
## Available Options
4446

4547
|Setting | Short description|

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)