Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 24990: link doesn't redirect to dashboard #26100

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion setup/src/Magento/Setup/Controller/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Zend\View\Model\JsonModel;
use Zend\View\Model\ViewModel;
use Magento\Setup\Model\Cron\Status;
use Magento\Setup\Model\ObjectManagerProvider;

/**
* Class Navigation
Expand All @@ -32,14 +33,20 @@ class Navigation extends AbstractActionController
*/
protected $view;

/**
* @var ObjectManagerProvider $objectManagerProvider
*/
protected $objectManagerProvider;

/**
* @param NavModel $navigation
* @param Status $status
*/
public function __construct(NavModel $navigation, Status $status)
public function __construct(NavModel $navigation, Status $status, ObjectManagerProvider $objectManagerProvider)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use ObjectManagerProvider instead of injecting just UrlInterface?

Copy link
Contributor Author

@Usik2203 Usik2203 Jan 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting such error "An error occurred during execution; please try again later" and status 500 while injecting UrlInterface directly in constructor of controller

{
$this->navigation = $navigation;
$this->status = $status;
$this->objectManagerProvider = $objectManagerProvider;
$this->view = new ViewModel;
$this->view->setVariable('menu', $this->navigation->getMenuItems());
$this->view->setVariable('main', $this->navigation->getMainItems());
Expand Down Expand Up @@ -75,8 +82,12 @@ public function menuAction()
*/
public function sideMenuAction()
{
/** @var \Magento\Backend\Model\UrlInterface $backendUrl */
$backendUrl = $this->objectManagerProvider->get()->get(\Magento\Backend\Model\UrlInterface::class);

$this->view->setTemplate('/magento/setup/navigation/side-menu.phtml');
$this->view->setVariable('isInstaller', $this->navigation->getType() == NavModel::NAV_INSTALLER);
$this->view->setVariable('backendUrl', $backendUrl->getRouteUrl('adminhtml'));
$this->view->setTerminal(true);
return $this->view;
}
Expand Down
8 changes: 5 additions & 3 deletions setup/view/magento/setup/navigation/side-menu.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
ng-show="<?= implode( '&&', $expressions) ?>"
>
<nav class="admin__menu" ng-controller="mainController">
<span class="logo logo-static" data-edition="Community Edition">
<img class="logo-img" src="<?= $this->basePath() ?>/pub/images/logo.svg" alt="Magento Admin Panel">
</span>
<a href="<?= $this->backendUrl ?>" class="logo" data-edition="Community Edition">
<span>
<img class="logo-img" src="<?= $this->basePath() ?>/pub/images/logo.svg" alt="Magento Admin Panel">
</span>
</a>
<ul id="nav" role="menubar">
<li class="item-home level-0" ng-class="{_active: $state.current.name === 'root.home'}">
<a href="" ui-sref="root.home">
Expand Down