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

[Actions] Taking space id into account when creating email footer link #100734

Merged
merged 5 commits into from
May 28, 2021

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented May 26, 2021

Resolves #99300

Summary

Passing in spaceId to the function that creates the footer link. If spaceId is not default, prepends /s/${spaceId} to the footer link.

To Verify

Create a rule in the default space and in another space. Add an email action to both rules. Verify that the email received has a footer link that correctly resolves to the rule details page, including space id if required.

Checklist

Delete any items that are not applicable to this PR.

@ymao1 ymao1 self-assigned this May 27, 2021
@ymao1 ymao1 added Feature:Actions release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.14.0 v8.0.0 labels May 27, 2021
@ymao1 ymao1 marked this pull request as ready for review May 27, 2021 14:20
@ymao1 ymao1 requested a review from a team as a code owner May 27, 2021 14:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@chrisronline chrisronline self-requested a review May 27, 2021 14:28
Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

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

LGTM! Great work! I left one question but it's minor

actionTypeId,
actionParams,
}: InjectActionParamsOpts) {
// Inject kibanaFooterLink if action type is email. This is used by the email action type
// to inject a "View alert in Kibana" with a URL in the email's footer.
if (actionTypeId === '.email') {
const spacePrefix = spaceId.length > 0 && spaceId !== 'default' ? `/s/${spaceId}` : '';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the spaceId.length > 0 check necessary? Is it possible to not be in a space, or in a space without a name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's not possible? I wanted to cover all my bases am happy to remove.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd defer to your judgment here, but I wasn't sure if it was possible or not

Copy link
Contributor

Choose a reason for hiding this comment

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

The only thing I can think of is testing the behaviour when the spaces plugin is disabled xpack.spaces.enabled: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call @mikecote. spaceId is undefined in this scenario 😅 . Updated to handle that here 64414fc

@mikecote mikecote self-requested a review May 28, 2021 13:29
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

Changes LGTM! I see there were also some conversations about customers forgetting to include Space ID when using {{kibanaBaseUrl}} (#99300 (comment)), should we open a follow-up issue for that scenario?

text: i18n.translate('xpack.alerting.injectActionParams.email.kibanaFooterLinkText', {
defaultMessage: 'View alert in Kibana',
defaultMessage: 'View rule in Kibana',
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@ymao1
Copy link
Contributor Author

ymao1 commented May 28, 2021

@mikecote Created issue here: #100890

@ymao1
Copy link
Contributor Author

ymao1 commented May 28, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

cc @ymao1

@ymao1 ymao1 added the auto-backport Deprecated - use backport:version if exact versions are needed label May 28, 2021
@ymao1 ymao1 merged commit b4e8cfe into elastic:master May 28, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request May 28, 2021
elastic#100734)

* Taking space id into account when creating email footer link

* Handling undefined space when spaces is disabled

* Handling undefined space when spaces is disabled

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request May 28, 2021
#100734) (#100913)

* Taking space id into account when creating email footer link

* Handling undefined space when spaces is disabled

* Handling undefined space when spaces is disabled

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: ymao1 <[email protected]>
gmmorris added a commit to gmmorris/kibana that referenced this pull request May 28, 2021
* master: (77 commits)
  [RAC][Security Solution] Register Security Detection Rules with Rule Registry (elastic#96015)
  [Enterprise Search] Log warning for Kibana/EntSearch version mismatches (elastic#100809)
  updating the saved objects test to include more saved object types (elastic#100828)
  [ML] Fix categorization job view examples link when datafeed uses multiple indices (elastic#100789)
  Fixing ES archive mapping failure (elastic#100835)
  Fix bug with Observability > APM header navigation (elastic#100845)
  [Security Solution][Endpoint] Add event filters summary card to the fleet endpoint tab (elastic#100668)
  [Actions] Taking space id into account when creating email footer link (elastic#100734)
  Ensure comments on parameters in arrow functions are captured in the docs and ci metrics. (elastic#100823)
  [Security Solution] Improve find rule and find rule status route performance (elastic#99678)
  [DOCS] Adds video to introduction (elastic#100906)
  [Fleet] Improve combo box for fleet settings (elastic#100603)
  [Security Solution][Endpoint] Endpoint generator and data loader support for Host Isolation (elastic#100813)
  [DOCS] Adds Lens video (elastic#100898)
  [TSVB] [Table tab] Fix "Math" aggregation (elastic#100765)
  chore(NA): moving @kbn/io-ts-utils into bazel (elastic#100810)
  [Alerting] Adding feature flag for enabling/disabling rule import and export (elastic#100718)
  [TSVB] Fix Upgrading from 7.12.1 to 7.13.0 breaks TSVB (elastic#100864)
  [Lens] Adds dynamic table cell coloring (elastic#95217)
  [Security Solution][Endpoint] Do not display searchbar in security-trusted apps if there are no items (elastic#100853)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Actions release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Email alerts link do not contain space id
5 participants