@diosmosis opened this Pull Request on June 25th 2018 Member

This PR is not done but is ready for an initial review.

Changes:

  • Added new single-metric-value widget (angular based).
  • Add query param filter_last_period_evolution that adds _past/_evolution metrics to any report. (not documented)
  • Found an issue in compileAngularComponents(). The method uses the scope for an element, but in some cases compileAngularComponents() 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.
  • Added Report:: getMetricDocumentationForReport() to access metric documentation for a report. Don't need it if an API.getProcessedReport, but that doesn't show the columns from filter_last_period_evolution.
  • Added a compileAngularComponents() call to widget preview.
  • Noticed when adding a widget it's reloaded several times (and all widgets w/ the same 'unique ID' are reloaded). Removed the extra reloads.

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

image

image

@mattab commented on June 26th 2018 Member

Feedback:

  • It's usable and looks very nice to have only one widget with the metric picker :+1:
  • If we move the Sparklines rendering to client side, maybe we should aim to also convert the sparklines twig code to angular, as to avoid having the sparklines logic duplicated. Maybe this would be best done directly in this PR rather than later?
  • some of the metadata is not displayed yet (percentage sign for rate metrics, currency for revenue metrics),
  • sometimes the metric is shown empty for some (instead of zero)
  • is the isReusable flag needed? (the current/desired behavior is to allow adding the same widget multiple times for all widgets)
  • left a code comment re: maybe missing escaping
@diosmosis commented on June 26th 2018 Member

is the isReusable flag needed?

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.

@diosmosis commented on July 3rd 2018 Member

sometimes the metric is shown empty for some (instead of zero)

Do you remember which metric? Not currently able to reproduce.

@diosmosis commented on July 3rd 2018 Member

some of the metadata is not displayed yet (percentage sign for rate metrics, currency for revenue metrics),

Some of this is hard to fix. Processed metrics (like percents) I could display via format_metrics=1, but normal metrics like revenue are not currently formatted in API output. I will add a fix in another PR.

Powered by GitHub Issue Mirror