Skip to content

[ResponseOps][Reporting] Scheduled report flyout UI#222135

Merged
umbopepato merged 30 commits intoelastic:scheduled-reports-uifrom
umbopepato:216321-scheduled-reports-flyout
Jun 23, 2025
Merged

[ResponseOps][Reporting] Scheduled report flyout UI#222135
umbopepato merged 30 commits intoelastic:scheduled-reports-uifrom
umbopepato:216321-scheduled-reports-flyout

Conversation

@umbopepato
Copy link
Member

@umbopepato umbopepato commented May 31, 2025

Summary

Important

This PR is targeting the scheduled-reports-ui feature branch, where the backend changes from the scheduled-reports branch are temporarily integrated while waiting for #221028 to be merged (see the squashed [TMP] ... commit message).

Implements the flyout UI for the creation and read-only viewing of scheduled reports (exports).

image

Known issues

Screenshots

Health API error:
Screenshot 2025-05-31 at 10 48 40

Health API loading state:
Screenshot 2025-05-31 at 10 49 04

Health API success with some missing prerequisites:
Screenshot 2025-06-17 at 16 59 57

Form validation:
image

Success toast:
image

Failure toast:
image

Print format toggle:
image

Missing notifications email connector callout:
image

References

Closes #216321
Stacked on #220535

@umbopepato umbopepato force-pushed the 216321-scheduled-reports-flyout branch from 4dd68c2 to 0d3db10 Compare May 31, 2025 18:56
@umbopepato umbopepato force-pushed the 216321-scheduled-reports-flyout branch from f11a696 to a296181 Compare June 17, 2025 16:10
@umbopepato umbopepato changed the base branch from main to scheduled-reports-ui June 17, 2025 16:10
@umbopepato umbopepato force-pushed the 216321-scheduled-reports-flyout branch from a296181 to 51e811c Compare June 17, 2025 16:48
@umbopepato umbopepato changed the title [ResponseOps][Reporting] Draft scheduled report flyout UI [ResponseOps][Reporting] Scheduled report flyout UI Jun 17, 2025
@umbopepato umbopepato force-pushed the scheduled-reports-ui branch from d5b5d9a to 8abc15d Compare June 18, 2025 08:02
@umbopepato umbopepato force-pushed the 216321-scheduled-reports-flyout branch from 51e811c to 4d63748 Compare June 18, 2025 08:25
@umbopepato umbopepato added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// labels Jun 18, 2025
@umbopepato umbopepato marked this pull request as ready for review June 18, 2025 10:58
@umbopepato umbopepato requested review from a team as code owners June 18, 2025 10:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@ymao1 ymao1 added ci:cloud-deploy Create or update a Cloud deployment ci:cloud-persist-deployment Persist cloud deployment indefinitely labels Jun 18, 2025
Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments from verification:

License

  • running with a basic license, I can see the Schedule Reports button in Discover. scheduled reporting is not available in basic even though single CSV exports is. We should hide the button
  • same comment about basic license and Schedule Report button in Lens. We allow CSV exports through lens but should not allow scheduling reports
  • export button for Dashboard correctly hidden for basic license 👍

Email notifications

  • email option correctly disabled when notifications are not properly configured 👍
  • email only allows setting to option. do we want to allow setting cc and bcc addresses?
  • if I click Schedule without filling in an email address, I get a validation error in the to field and an error toast is shown. The schedule button is disabled and shows a loading spinner. Filling out the to field does not reenable the schedule button.

Security or API keys turned off

  • when ES security is false or API keys are disabled, we show the Schedule export button but open a flyout that just shows an error. The Schedule button on the flyout is still enabled and an error toast shows up if you click it. Do we want to just show a disabled Schedule export button in the dropdown and skip opening the flyout altogether?

Scheduling

  • seems to me that the now date is set when the flyout is opened, not when the request is made, so let's say you open the flyout at 8:00, mess around with the options and don't click the schedule button until 8:03. The schedule will be set to recur (daily/weekly/monthly) at 8:00.
  • could we show the HH:MM time when scheduling? right now it says Repeats every Wednesday. Could we have it say Repeats every Wednesday at 08:00?

@umbopepato
Copy link
Member Author

umbopepato commented Jun 18, 2025

Thanks for taking a look Ying! I still haven't had time to update the description and add comments but itm about these points:

License

  • running with a basic license, I can see the Schedule Reports button in Discover. scheduled reporting is not available in basic even though single CSV exports is. We should hide the button
  • same comment about basic license and Schedule Report button in Lens. We allow CSV exports through lens but should not allow scheduling reports
  • export button for Dashboard correctly hidden for basic license 👍

I thought the prerequisiteCheck was removed by the new share plugin extension point, it turns out it's not (I was just trying to add it in the wrong place)! I added back the license check, which according to the conversation on licensing you had with Tia on Slack seems like it's license.type !== 'basic'? If it's more nuanced let me know and I can update it.

Email notifications

  • email only allows setting to option. do we want to allow setting cc and bcc addresses?

I know the notification object of the schedule API has more options but the mockups only show a To field so I concentrated on that one. @tiamliu and @joana-cps probably wanted to start from a simple configuration and add the other recipient fields in the future?

  • if I click Schedule without filling in an email address, I get a validation error in the to field and an error toast is shown. The schedule button is disabled and shows a loading spinner. Filling out the to field does not reenable the schedule button.

My bad! I removed an intermediate component level last minute to remove a hack to adapt to the new share API and missed a form.validate() call. Fixed!

Security or API keys turned off

  • when ES security is false or API keys are disabled, we show the Schedule export button but open a flyout that just shows an error. The Schedule button on the flyout is still enabled and an error toast shows up if you click it. Do we want to just show a disabled Schedule export button in the dropdown and skip opening the flyout altogether?

This is a bit tricky since the health API call would need to be moved outside or React (and thus React Query) and in a check function that is not async... Let me see what I can do.
Edit: done ✅

Scheduling

  • seems to me that the now date is set when the flyout is opened, not when the request is made, so let's say you open the flyout at 8:00, mess around with the options and don't click the schedule button until 8:03. The schedule will be set to recur (daily/weekly/monthly) at 8:00.

This is something we discussed in a meeting last Friday with @tiamliu. If I remember correctly the point was not confusing the user with a preview that doesn't correspond to the actual time used for scheduling (I have to pass a start date right away to the recurrence form, and all suggestions will be based on that date, but then the real schedule would be based on a different time - when executing the request - that the user doesn't have visibility on). I know it's not ideal and I'm open to all possibilities.

  • could we show the HH:MM time when scheduling? right now it says Repeats every Wednesday. Could we have it say Repeats every Wednesday at 08:00?

Sure, I'll extend the preview generator.
Edit: done ✅

@umbopepato umbopepato requested a review from a team as a code owner June 18, 2025 16:42
@umbopepato umbopepato force-pushed the 216321-scheduled-reports-flyout branch 2 times, most recently from 4b7a882 to 623c801 Compare June 19, 2025 06:40
@umbopepato umbopepato requested review from a team as code owners June 19, 2025 06:40
@umbopepato umbopepato force-pushed the scheduled-reports-ui branch from 8abc15d to 4805aee Compare June 19, 2025 13:37
@umbopepato umbopepato requested review from a team as code owners June 19, 2025 13:37
customFrequency?: RecurrenceFrequency;
byweekday?: Record<string, boolean>;
bymonth?: string;
bymonthweekday?: string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are needed to be able to view previously created scheduled reports since they (still) don't have a start date, which was used to compute all this information

* A collapsible version of EuiDescribedFormGroup. Use the `narrow` prop
* to obtain a vertical layout suitable for smaller forms
*/
export const ResponsiveFormGroup = ({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EuiDescribedFormGroup seemed the perfect component for the groups with titles, but it doesn't have a column version, so I added one here. If we ever need to expand this form in a standalone page, we could use narrow = false and get an expanded UX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I did it this way

, which should be responsive by default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's nice! We could propose Eui to integrate your solution in the original one 🙂

onClose,
}: ScheduledReportFlyoutProps) => {
return (
<EuiFlyout size="m" maxWidth={500} paddingSize="l" ownFocus={true} onClose={onClose}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this layer because the export menu controls the rendering of the outer flyout layer, but we have to open it too in the Reports page

iconType="error"
color="danger"
>
<p>{i18n.UNMET_REPORTING_PREREQUISITES_MESSAGE}</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add more info for easier debug?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a temporary text, but I moved the prerequisites check before registering the schedule export button altogether so you shouldn't be able to open it and see this error at all. I kept it just for extra safety, I'll ask docs to have a look and suggest a better message

onClose();
}
} catch (e) {
// Keep the flyout open in case of schedule error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also console.error(e) to make it easier to debug?

[JOB_STATUS.WARNINGS, JOB_STATUS.FAILED].some((status) => job.status === status)
);
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no tests for these new functions, but they seem complex enough to have some

import { getInvalidEmailAddress, getNotAllowedEmailAddress } from '../translations';
import type { ScheduledReport } from '../../types';

export const getEmailsValidator =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also might need to test this

);
}

import('./management/integrations/scheduled_report_share_integration').then(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason for this being imported dynamically? just curious

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When imported statically it broke the page load bundle size limit for reporting, see
https://buildkite.com/elastic/kibana-pull-request/builds/309752/summary/annotations?jid=01978228-643a-4d7d-810e-4cd9e2596513

Copy link

@joana-cps joana-cps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-06-20 at 13 08 50

The Reporting page link should point to the reporting page with the exports tab selected. Currently, it is pointing to the schedules tab, and we are not listing the reports there.

Can you also make it open in a new browser tab?

Copy link

@joana-cps joana-cps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-06-20 at 13 03 51

It feels weird to see the Exports sections in the View schedule information read-only flyout, especially when we display the callout about the email connector.
Should we hide this section altogether if 'Send by email' is off?

Copy link

@joana-cps joana-cps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-06-20 at 13 21 12

The Daily behaviour is strange. If we display the days of the week, they should all be selected by default when the user selects Daily. Otherwise, even though I select Daily only friday is selected and a report is exported as "Repeats every Friday at xxx".

Copy link

@joana-cps joana-cps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-06-20 at 15 50 51 Screenshot 2025-06-20 at 15 50 42

Inconsistent icon for CSV export. Since the documents icon will be deprecated, let's use tableDensityExpanded for CSV and document for PDF.

@umbopepato
Copy link
Member Author

Screenshot 2025-06-20 at 13 08 50 The `Reporting page` link should point to the reporting page with the exports tab selected. Currently, it is pointing to the schedules tab, and we are not listing the reports there.

Can you also make it open in a new browser tab?

This is because in this PR I don't have the other tab, this can be done when integrating the flyout with the list page

@joana-cps
Copy link

Email notifications

  • email only allows setting to option. do we want to allow setting cc and bcc addresses?

I know the notification object of the schedule API has more options but the mockups only show a To field so I concentrated on that one. @tiamliu and @joana-cps probably wanted to start from a simple configuration and add the other recipient fields in the future?

Yes, it was a decision made in the first design review to keep it simple in the first version.

@umbopepato
Copy link
Member Author

Screenshot 2025-06-20 at 13 21 12 The `Daily` behaviour is strange. If we display the days of the week, they should all be selected by default when the user selects `Daily`. Otherwise, even though I select `Daily` only friday is selected and a report is exported as "Repeats every Friday at xxx".

Good point! That part of the form is also shared with MWs though so let's maybe track this as a separate improvement?

if (!license) {
return false;
}
return license.type !== 'basic';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added an allowlist for licenses here: f5f9d9d Not sure if you can reuse.

Copy link
Member Author

@umbopepato umbopepato Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't import the list from there since it's marked as server code so I moved it to the common folder, hope it's fine 🙂

@eokoneyo
Copy link
Contributor

eokoneyo commented Jun 23, 2025

Screenshot 2025-06-20 at 15 50 51 Screenshot 2025-06-20 at 15 50 42
Inconsistent icon for CSV export. Since the documents icon will be deprecated, let's use tableDensityExpanded for CSV and document for PDF.

I have a PR for this here (the CSV part at least)

@elasticmachine
Copy link
Contributor

elasticmachine commented Jun 23, 2025

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
reporting 163 200 +37

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/reporting-common 97 98 +1
@kbn/reporting-public 103 106 +3
share 87 90 +3
total +7

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
alerting 92.0KB 93.7KB +1.6KB
fleet 1.8MB 1.8MB +52.0B
reporting 110.7KB 142.2KB +31.5KB
total +33.2KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
share 15 21 +6

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
reporting 50.8KB 52.9KB +2.1KB
share 51.7KB 51.7KB +26.0B
total +2.1KB
Unknown metric groups

API count

id before after diff
@kbn/reporting-common 107 108 +1
@kbn/reporting-public 110 113 +3
share 153 156 +3
total +7

async chunk count

id before after diff
reporting 4 6 +2

ESLint disabled in files

id before after diff
reporting 0 1 +1

ESLint disabled line counts

id before after diff
reporting 5 6 +1

Total ESLint disabled count

id before after diff
reporting 5 7 +2

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:cloud-deploy Create or update a Cloud deployment ci:cloud-persist-deployment Persist cloud deployment indefinitely release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Response Ops][Reporting] Allow scheduling recurring reports from UI

7 participants