Skip to content

Commit

Permalink
Controller: Set redirectUrl to grid action when rendering `Host/Servi…
Browse files Browse the repository at this point in the history
…cegroups` & switching to minimal
  • Loading branch information
yhabteab committed Sep 17, 2021
1 parent 6c37353 commit ff67a76
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions library/Icingadb/Web/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,16 @@ function (ViewModeSwitcher $viewModeSwitcher) use ($user, $preferredModes, $pagi
$viewMode = $viewModeSwitcher->getValue($viewModeSwitcher->getViewModeParam());
$requestUrl = Url::fromRequest();

if ($viewMode === 'minimal' && $requestUrl->getPath() === 'icingadb/hostgroups') {
$requestUrl = Url::fromPath('icingadb/hostgroups/grid')->setParams($requestUrl->getParams());
} elseif ($viewMode !== 'minimal' && $requestUrl->getPath() === 'icingadb/hostgroups/grid') {
$requestUrl = Url::fromPath('icingadb/hostgroups')->setParams($requestUrl->getParams());
} elseif ($viewMode === 'minimal' && $requestUrl->getPath() === 'icingadb/servicegroups') {
$requestUrl = Url::fromPath('icingadb/servicegroups/grid')->setParams($requestUrl->getParams());
} elseif ($viewMode !== 'minimal' && $requestUrl->getPath() === 'icingadb/servicegroups/grid') {
$requestUrl = Url::fromPath('icingadb/servicegroups')->setParams($requestUrl->getParams());
}

$preferredModes[$requestUrl->getPath()] = $viewMode;
$user->setAdditional('icingadb.view_modes', $preferredModes);

Expand Down

0 comments on commit ff67a76

Please sign in to comment.