Initialize panels early to make sure that scripts can be loaded

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-06-23 15:38:07 +02:00
parent f7c04b0415
commit 66ce9ede91
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

View file

@ -59,16 +59,15 @@ class DashboardController extends Controller {
$this->eventDispatcher->dispatchTyped(new IRegisterPanelEvent($this->dashboardManager));
$dashboardManager = $this->dashboardManager;
$this->inititalStateService->provideLazyInitialState('dashboard', 'panels', function () use ($dashboardManager) {
return array_map(function (IPanel $panel) {
return [
'id' => $panel->getId(),
'title' => $panel->getTitle(),
'iconClass' => $panel->getIconClass(),
'url' => $panel->getUrl()
];
}, $dashboardManager->getPanels());
});
$panels = array_map(function (IPanel $panel) {
return [
'id' => $panel->getId(),
'title' => $panel->getTitle(),
'iconClass' => $panel->getIconClass(),
'url' => $panel->getUrl()
];
}, $dashboardManager->getPanels());
$this->inititalStateService->provideInitialState('dashboard', 'panels', $panels);
if (class_exists(LoadViewer::class)) {
$this->eventDispatcher->dispatchTyped(new LoadViewer());