Open dmason30 opened 1 year ago
The cards component doesn't have access to the dashboard name and changing this on patch releases may cause massive breaking changes, especially for 3rd party packages. We can only look into this for Laravel Nova 5.
Thought that might be the case 👍 Thanks for looking into it!
Revisiting this, I'm not sure how it's a breaking change?
Mainly because we will need to change this logic:
This can be done for built-in metrics but any existing 3rd party metrics wouldn't have this logic available until they update their code.
Assuming we leave the original endpoint, we could update internal metrics to use a new one depending on where they come from (dashboards, resource index, resource detail, lens), yeah?
But also, I'm sort of the opinion that custom metrics shouldn't use internal Nova API endpoints...
Description:
I have just started adding multiple dashboards in nova and realised that the
DashboardMetricController
route loops all metrics across all dashboards on every request.In our case this is an issue as we are adding a dashboard that shows cards based on a query, see example below:
However, if we, for example, have another dashboard
CustomerDashboard
whenever any metric requests are run for that dashboard then it will also call theAffiliateDashboard::cards()
method and run the above query unnecessarily.We do intend to cache the above query but I have deliberately kept the example simple.
Suggested changes
Change the route definition to accept the dashboard uri key, obviously, this will require some changes in the metric vue components :
Then change the code that loops though metrics to filter based on dashboard uri key: