Skip to content

Commit

Permalink
Fix duplicate dashlets (#5245)
Browse files Browse the repository at this point in the history
fixes #5203
  • Loading branch information
nilmerg authored Aug 13, 2024
2 parents c27b43f + 81a3be7 commit 4ea3beb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion library/Icinga/File/Ini/IniWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct(Config $config, $filename, $filemode = 0660, $option
*/
public function render()
{
if (file_exists($this->filename)) {
if ($this->filename !== null && file_exists($this->filename)) {
$oldconfig = Config::fromIni($this->filename);
$content = trim(file_get_contents($this->filename));
} else {
Expand Down
10 changes: 6 additions & 4 deletions library/Icinga/Web/Widget/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,17 @@ protected function loadUserDashboardsFromFile($file, Navigation $dashboardNaviga
if ($dashboardPane !== null) {
$key = $dashboardPane->getLabel();
}
$pane = null;
if ($this->hasPane($key)) {
$panes[$key] = $this->getPane($key);
$pane = $this->getPane($key);
} else {
$panes[$key] = new Pane($key);
$pane = new Pane($key);
$panes[$key] = $pane;
$panes[$key]->setTitle($part->title);
}
$panes[$key]->setUserWidget();
$pane->setUserWidget();
if ((bool) $part->get('disabled', false) === true) {
$panes[$key]->setDisabled();
$pane->setDisabled();
}
} else {
list($paneName, $dashletName) = explode('.', $key, 2);
Expand Down

0 comments on commit 4ea3beb

Please sign in to comment.