When loading the dashboard, there is a noticeable slowness since recent changes. I think there is aneasy way to make the dashboard fast again.
explanation: when loading dashboard, the following http requests are made:
The requests 2) and 3) should be streamlined and included in the output of the first one module=Dashboard&action=embeddedIndex
This way, the dashboard should be fast again :-)
I'll have a look at that.
(1) In trunk when loading /piwik/ there is still an extra http request:
This can be seen
For performance improvement the request getAvailableWidgets could be included in the response of embeddedIndex.
(2) Also, another way to slightly improve perf: the JS that is inlined in embeddedIndex could be put instead in a JS file so that it's loaded only once in the big minified JS rather than on each dashboard load.
(3) A small UX feedback which maybe is related: after the response from getAvailableWidgets currently comes back, I can see the [Widgets&dashboard] menu moving to the right a few pixels. Instead it should be at the right position from the start so that there is no "pixel" jumping when the content loads.
(In ) refs #3065 moved js code from template to additional js file
well, it would be quite easy to include the seperate request for the widgets. But that would mean we would have to transfer that data whenever the user switches to a dashboard. that would be useless, as we need that data only once.
What I propose is that the request to Dashboard controller returns directly the Menu data, Widget data for the dashboard loaded by default, and layout of dashboard loaded by default.
Then when clicking on another dashboard the http request would return layout, widgets available for this dashboard in the same http request.
Maybe these requests still need to be made when a widget is added/ a dashboard renamed/removed. Could we then just trigger in these functions the requests above to update the json data?
Streamlining these 2 json objects in the main request to the embed dashboard will speed up embed dashboard speed quite a lot and is experienced by all users as the first thing in piwik.
(In ) refs #3065 include available widgets in embeddedIndex, so no additional request is required
now index.php?module=Dashboard&action=getAvailableWidgets is not requested anymore. the allDashboards request ist not required to render the page, it only updates the dashboard list in the menu, which is allready available before.
It seems the widgets are not recorded anymore: when I add a widget to dashboard 2 it adds it to dashboard 1 as well.
It can be improved a bit more as per previous, but definitely the main things have been fixed and it is not a blocker for release anymore. Thanks Stefan!!
I had another look at this issue and I don't think that can be improved that mutch.
Requests for widgets are already queued before the getAllDashboards request.