Skip to content

Export Dashboard to Scheduled Reports#24019

Merged
chippison merged 85 commits into5.x-devfrom
dev-19806
Mar 15, 2026
Merged

Export Dashboard to Scheduled Reports#24019
chippison merged 85 commits into5.x-devfrom
dev-19806

Conversation

@chippison
Copy link
Copy Markdown
Contributor

@chippison chippison commented Jan 28, 2026

Description

DEV-19806

We want to add in a functionality to export the current dashboard into a Scheduled Report. This will attempt to map dashboard widgets with reports available to be scheduled.

This will not be a perfect 1-1 relationship between dashboard widget and scheduled reports and there will be some widgets that will not be mapped to a report. The user will be informed/notified about the missing dashboard widgets in an infoobox that will show everytime we export a dashboard.

This will cover 3 JIRA issues:
https://innocraft.atlassian.net/browse/DEV-19804
https://innocraft.atlassian.net/browse/DEV-19805
https://innocraft.atlassian.net/browse/DEV-19806

Acceptance Criteria:

  • A new link is added under the Dashboard selector menu, in the section “Manage this dashboard”
    • The link label is: “Export this dashboard”
    • The link is positioned as the first item in the section, above “Reset dashboard”
    • The link is visible to all users, including:
      • View users
      • Users without write permissions
      • Anonymous users (eg. demo environments)
  • Clicking the link
    • Works for authenticated users with at least View access
    • Redirects unauthenticated users to the login flow as per existing behaviour
  • Clicking “Export this dashboard” redirects the user to Create and Schedule a report
  • Matomo (in the Dashboard plugin controller) will automatically map:
    • Dashboard widgets → report list.
  • Widgets without a corresponding report are excluded from the export configuration
    • Example: “About Matomo” widgets
  • When the user lands on the Create and Schedule a report page via this dashboard link:
    • A new info box is displayed at the top of the page
    • This info box is only shown when coming from a dashboard export action
    • Proposed text in the JIRA issue DEV-19806
  • Report configuration defaults
    • Report description
      • Automatically pre-filled
      • Editable by the user
      • Proposed text in the JIRA issue DEV-19806
    • Report selection
      • All reports that match widgets from the dashboard are pre-selected
      • Reports that do not match a widget remain unselected

Checklist

  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules

Review

@chippison chippison added this to the 5.7.0 milestone Jan 28, 2026
Comment thread plugins/Dashboard/vue/src/DashboardSettings/DashboardSettings.vue
@chippison chippison modified the milestones: 5.7.0, 5.8.0 Jan 29, 2026
Comment thread plugins/Dashboard/vue/src/DashboardSettings/DashboardSettings.vue
@chippison chippison marked this pull request as ready for review January 29, 2026 00:37
@chippison chippison requested a review from a team January 29, 2026 00:37
@chippison chippison force-pushed the dev-19806 branch 4 times, most recently from fe3958b to d9a9b52 Compare February 16, 2026 01:20
@tzi
Copy link
Copy Markdown
Contributor

tzi commented Feb 23, 2026

I added all widgets I tried to export them. There is 2 that wasn’t in the preset and not in the infobox message:
Screenshot 2026-02-23 at 16 41 43

It is:

  • Widget Goals > Overview should certainly be Reports > Goals > Goals Overview
  • Widget Acquisition > Referrers should certainly be Reports Acquisition > Referrers Overview

@tzi
Copy link
Copy Markdown
Contributor

tzi commented Feb 23, 2026

The current segment is not preselected when pressing "Export this dashboard"

  1. I select a segment
  2. Press "Export this dashboard"
  3. The "Choose a segment" is always "All Websites".

It's feedback, it could be out of scope.

@tzi
Copy link
Copy Markdown
Contributor

tzi commented Feb 23, 2026

After pressing "Export this dashboard", if I press "Cancel" instead of "Create Report" I got 2 weird behaviour:

  • Go back to "Personal Scheduled Reports" list instead of my Dashboard (minor)
  • I still have the infobox
Screenshot 2026-02-23 at 16 50 51

Comment thread plugins/ScheduledReports/API.php Outdated
@tzi
Copy link
Copy Markdown
Contributor

tzi commented Feb 23, 2026

Codex feedbacks: there is a high‑risk regression in a core API method unrelated to the feature (see below), which makes the branch unsafe to merge as-is.

Medium-risk issues

  • applyDashboardExportMapping sets selectedReports but does not populate selectedReportsOrder. The save path falls back to object key order, which may not reflect the dashboard widget order. This might be acceptable but it’s a behavioral change that could surprise users who expect export order to match the dashboard. See plugins/ScheduledReports/vue/src/ManageScheduledReport/ManageScheduledReport.vue.
  • Mapping heuristics are value-only for parameters (findReportIdByWidgetParameters) and can mis-map if a widget has multiple params where a value coincidentally matches another report key. Consider including parameter keys in the lookup or tightening heuristics. See plugins/ScheduledReports/WidgetReportMapper.php.

Low-risk / polish

  • getWidgetReportMap returns dashboardName even when layout is empty; the UI treats it as invalid and shows a generic error. A more specific message for “empty dashboard” could improve clarity. See plugins/ScheduledReports/API.php and plugins/ScheduledReports/vue/src/ManageScheduledReport/ManageScheduledReport.vue.

@chippison
Copy link
Copy Markdown
Contributor Author

I added all widgets I tried to export them. There is 2 that wasn’t in the preset and not in the infobox message:
It is:

  • Widget Goals > Overview should certainly be Reports > Goals > Goals Overview
  • Widget Acquisition > Referrers should certainly be Reports Acquisition > Referrers Overview

I think this was correct, the Goals Overview was already named in the infobox. It was just called 'Overview' though. I have made a fix so that it calls it 'Goals Overview'. It did not map the Scheduled Reports > Goals Overview to the widget since they also show different values from the widget, so technically they are not the same reports.

Also Widget Acquistion > Referrers is already mapped. It took 'Acquisition > All Channels' (not sure why they are not named the same, but the values they show certainly are the same). The Acquisition > Referrers Overview in Scheduled reports do not show the same values as the widget. Its the 'Acquisition > All Channels' that show the same values as the Widget.

@chippison
Copy link
Copy Markdown
Contributor Author

The current segment is not preselected when pressing "Export this dashboard"

  1. I select a segment
  2. Press "Export this dashboard"
  3. The "Choose a segment" is always "All Websites".

It's feedback, it could be out of scope.

This was an easy fix so added it in 👍

@chippison
Copy link
Copy Markdown
Contributor Author

After pressing "Export this dashboard", if I press "Cancel" instead of "Create Report" I got 2 weird behaviour:

  • Go back to "Personal Scheduled Reports" list instead of my Dashboard (minor)
  • I still have the infobox

I removed the infobox when cancel is clicked. I just did not return back to the Dashboard as this seems like a weird behaviour since we were just 'canceling' the creation of the scheduled report.

@chippison
Copy link
Copy Markdown
Contributor Author

Codex feedbacks: there is a high‑risk regression in a core API method unrelated to the feature (see below), which makes the branch unsafe to merge as-is.

Medium-risk issues

  • applyDashboardExportMapping sets selectedReports but does not populate selectedReportsOrder. The save path falls back to object key order, which may not reflect the dashboard widget order. This might be acceptable but it’s a behavioral change that could surprise users who expect export order to match the dashboard. See plugins/ScheduledReports/vue/src/ManageScheduledReport/ManageScheduledReport.vue.
  • Mapping heuristics are value-only for parameters (findReportIdByWidgetParameters) and can mis-map if a widget has multiple params where a value coincidentally matches another report key. Consider including parameter keys in the lookup or tightening heuristics. See plugins/ScheduledReports/WidgetReportMapper.php.

Low-risk / polish

  • getWidgetReportMap returns dashboardName even when layout is empty; the UI treats it as invalid and shows a generic error. A more specific message for “empty dashboard” could improve clarity. See plugins/ScheduledReports/API.php and plugins/ScheduledReports/vue/src/ManageScheduledReport/ManageScheduledReport.vue.

fixed this

@tzi
Copy link
Copy Markdown
Contributor

tzi commented Feb 24, 2026

Thanks for all the fixes!

I think this was correct, the Goals Overview was already named in the infobox. It was just called 'Overview' though. I have made a fix so that it calls it 'Goals Overview'.

Nice 👍

Also Widget Acquistion > Referrers is already mapped. It took 'Acquisition > All Channels' (not sure why they are not named the same, but the values they show certainly are the same). The Acquisition > Referrers Overview in Scheduled reports do not show the same values as the widget. Its the 'Acquisition > All Channels' that show the same values as the Widget.

It seems like a weird behaviour for the users. Could we do something about it?

@tzi
Copy link
Copy Markdown
Contributor

tzi commented Feb 25, 2026

You should push build vue files to this PR

@chippison chippison force-pushed the dev-19806 branch 3 times, most recently from b4c7a2b to c65cdf2 Compare February 26, 2026 08:24
Comment thread plugins/ScheduledReports/tests/UI/ScheduledReports_spec.js
…remove idDashboard from the URL w/o refresh and its no longer used and only causes issues w/ codex reviews
@chippison chippison force-pushed the dev-19806 branch 2 times, most recently from c4de96b to fc9216d Compare March 13, 2026 04:28
@chippison
Copy link
Copy Markdown
Contributor Author

chippison commented Mar 13, 2026

There is also a couple of issues codex found that I did not really fix:

  • Wrong error message

    • basically the export treats both invalid dashboard and zero exportable widgets and just shows a generic "invalid dashboard" message
    • I think its no longer worth separating them and adding new translations for this
  • Anonymous users lose export context

    • this is a intentional thing
    • we wanted the anonymous user to be redirected to the login page as per the spec
    • the spec also says the export link to be shown for all users (including anonymous ones)
    • after login, they can just click on the export button again if needed.

@chippison chippison merged commit b566fa6 into 5.x-dev Mar 15, 2026
50 of 51 checks passed
@chippison chippison deleted the dev-19806 branch March 15, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants