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
Add reusable widget to display single metric w/ sparkline & evolution percent (+ other changes) #13101
Conversation
…ot grey out the widget in the dashboard manager, even if the widget is used in the dashboard.
…evolution parameter.
…reloads when multiple widgets of the same type are shown.
@@ -0,0 +1,5 @@ | |||
<{{ componentName }} | |||
{% for key, value in componentParameters %} | |||
{{ key }}="{{ value|e('html') }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the componentName and key should be escaped here to be safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 might be automatic w/ twig? can't remember, but will double check
Feedback:
|
It's used to display the 'Metric' widget w/ black text instead of grey text. Not required, I guess, but I think it's slightly better UX. |
…ne sparkline angular component and get rid of need for "past-period" argument to single metric view.
Do you remember which metric? Not currently able to reproduce. |
Some of this is hard to fix. Processed metrics (like percents) I could display via |
@mattab fixed the revenue issue w/ a hacky fix. Needs review, will be adding tests now. |
@tsteur FYI I changed the strategy here to calculate the evolution data on in the component so the new parameter isn't required. There's less backend changes now, the changes that exist are mostly fixes for issues I found. |
should be fine @diosmosis 👍 |
@diosmosis Looks good overall, a awesome new feature 👍 Feedback:
|
The series picker doesn't let you pick more than a metric (ie, you can't pick a metric + an idGoal). I'll put another select for goals when a goal metric is displayed.
This widget just uses the |
was hoping we could simply list all the metrics in the list of metrics, ie if the goal name is |
@mattab I can probably hack something in like that, but it would create a very large series picker. |
It will be OK to have a large picker as long as it's not buggy. in the future, we'll improve the metric picker so it looks like the custom reports metric picker. |
@mattab added goal metrics, deserves more tests since it's a hacky change. (did not modify the API) |
@mattab approved on slack, merging after fixing build |
… percent (+ other changes) (matomo-org#13101) * Add empty metric for single metric view. * Add new isReusable property to widget metadata & if set to true, do not grey out the widget in the dashboard manager, even if the widget is used in the dashboard. * Initial working version of single metric view. * Get single metric view widget to work and look correctly (no series picker). * Add series picker to single metric widget and add filter_last_period_evolution parameter. * Persist metric change through dashboard widget parameter saving. * Loading state for single metric view. * Make new evolution param work on processed reports + tweak component implementation. * Tweak CSS and make sure angular components are compiled in widget preview. * Make component work with widget preview and avoid unnecessary widget reloads when multiple widgets of the same type are shown. * Generalize JS lastN range period computing and use to create standalone sparkline angular component and get rid of need for "past-period" argument to single metric view. * Add format_metrics: "1" to API.get method. * Add escaping to _angularComponent.twig. * hacky fix for formatting revenue columns * Format past data values & allow evolution to be calculated for processed metrics. * filter evolution changes * Fix issue in subtable recursion for processed metric computation & metric formatting + add new processed metric compute hooks to fix bug in evolution calculation on subtables. * remove isReusable property. * attempting to change strategy * simpler solution that does not require backend changes * remove unneeded code + fix issue w/ formatted metrics * remove some more unneeded code * write UI test * add new screenshots * Add all goals to single metric view picker. * move category * fix test * fixing more tests * Fixing some UI tests. * Update more screenshots. * update two more screenshots
This PR is not done but is ready for an initial review.
Changes:
_past
/_evolution
metrics to any report. (not documented)compileAngularComponents()
. The method uses the scope for an element, but in some casescompileAngularComponents()
is called again on the same element (like when reloading a widget). This means that the scope is re-used when compiling a widget again, which in turn means its not possible to destroy angular components/directives. In the dashboard I forced the creation of a new scope, not sure if it's the best way to fix.Report:: getMetricDocumentationForReport()
to access metric documentation for a report. Don't need it if an API.getProcessedReport, but that doesn't show the columns fromfilter_last_period_evolution
.compileAngularComponents()
call to widget preview.Note: if you'd rather the widget be rendered server side, let me know, just trying to use angular for all new work.
Fixes #12358
CC @mattab / @tsteur for additional changes made + angular related fixes