Improve dashboard performance
Dashboard widgets should defer their data requesting using AJAX so they don't kill/lag the whole page request
This commit is contained in:
parent
0f6a120623
commit
659c7098b9
|
|
@ -37,13 +37,19 @@ class Index extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
if ($redirect = $this->checkPermissionRedirect())
|
||||
if ($redirect = $this->checkPermissionRedirect()) {
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
$this->pageTitle = 'backend::lang.dashboard.menu_label';
|
||||
BackendMenu::setContextMainMenu('dashboard');
|
||||
}
|
||||
|
||||
public function index_onInitReportContainer()
|
||||
{
|
||||
return ['#dashReportContainer' => $this->widget->reportContainer->render()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom permissions check that will redirect to the next
|
||||
* available menu item, if permission to this page is denied.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,21 @@
|
|||
<?= $this->makePartial('warnings') ?>
|
||||
|
||||
<?= Form::open() ?>
|
||||
<?= $this->widget->reportContainer->render() ?>
|
||||
<div id="dashReportContainer">
|
||||
|
||||
<!-- Loading -->
|
||||
<div class="loading-indicator-container">
|
||||
<div class="loading-indicator">
|
||||
<span></span>
|
||||
<div>Loading dashboard...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?= Form::close() ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$.request('onInitReportContainer')
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue