Skip to content
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

[Alerting] Use rule.url to generate kibanaFooterLink for email connectors #160196

Merged
merged 2 commits into from
Jun 29, 2023

Conversation

ersin-erdal
Copy link
Contributor

@ersin-erdal ersin-erdal commented Jun 21, 2023

Resolves: #151355

This PR intends to use rule.url (provided by the rule type) in the email connector's footer link rather than the hardcoded path.

@ersin-erdal ersin-erdal added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.10.0 labels Jun 21, 2023
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #6 / InfraOps App Logs UI Logs Source Configuration Allows indices configuration records telemetry for logs

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 416 420 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 497 501 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ersin-erdal ersin-erdal marked this pull request as ready for review June 22, 2023 07:55
@ersin-erdal ersin-erdal requested a review from a team as a code owner June 22, 2023 07:55
@elasticmachine
Copy link
Contributor

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

try {
path = new URL(ruleUrl).pathname;
} catch (e) {
path = '';
Copy link
Contributor

Choose a reason for hiding this comment

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

In the email connector:

return i18n.translate('xpack.stackConnectors.email.customViewInKibanaMessage', {
defaultMessage: 'This message was sent by Elastic. [{kibanaFooterLinkText}]({link}).',
values: {
kibanaFooterLinkText: kibanaFooterLink.text,
link: `${publicBaseUrl}${kibanaFooterLink.path === '/' ? '' : kibanaFooterLink.path}`,
},
});
}

it does this check link: ${publicBaseUrl}${kibanaFooterLink.path === '/' ? '' : kibanaFooterLink.path}

so should we set path to / in this error scenario?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes i saw it but "/" becomes "" anyway, and if we use it somewhere else without checking the trailing "/" the full URL becomes broken.

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.

LGTM

@ersin-erdal ersin-erdal merged commit e9ad380 into elastic:main Jun 29, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 29, 2023
@ersin-erdal ersin-erdal deleted the 151355-kibana-footer-link branch June 29, 2023 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make email footer link from alerting rules match {{rule.url}}
5 participants