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

[Dashboard Navigation] Drilldown on link click #164196

Conversation

Heenawter
Copy link
Contributor

@Heenawter Heenawter commented Aug 17, 2023

Closes #154381

Summary

This PR adds functionality to the link embeddable so that

  1. dashboard to dashboard links will now navigate between dashboards, taking the context (filters, time range, queries, etc.) as the user navigates (assuming the appropriate settings are applied) and
  2. URL links will now navigate to internal and/or external URLs as expected

Dashboard Links

Screen.Recording.2023-08-28.at.11.15.37.AM.mov

Note
In the above video, all links were configured to include queries, filter pills, and the selected time range in the passed context. It is possible to disable these settings, if necessary.

Link settings

We want dashboard drilldowns and dashboard links to work more-or-less the same way, which means that they should have identical settings - therefore, in order to share the same settings between dashboard drilldowns + dashboard links, I created the DashboardDrilldownOptionsComponent:

image

I put this new component into presentation_util so that it could easily be shared and used in the respective editing experiences.

Testing

  • When testing, special attention should be paid to the different link settings - ensure that all settings are respected.
  • Ensure that ctrl + click, shift + click, and meta + click work as expected, regardless of whether the Open in new tab setting is true or false - specifically, we should use the URL to pass the filters/queries/time range whenever a dashboard is being opened in a new tab.

URL Links

Screen.Recording.2023-08-28.at.11.33.49.AM.mov

Link settings

Similar to the dashboard links, we want the
image

Testing

When testing, it is important to ensure that the new URL validation works as expected. For this, there are technically two types of invalid links:

  1. links that do not fit the expected format; for example, we do not accept any links that start with something other than http, https, or mailto.
  2. links that are disallowed due to the externalUrl.policy

Testing number one should be simple; however, in order to test the second type of invalid links, you need to modify your kibana.dev.yml to include something like the following:

externalUrl.policy:
  - allow: false
    host: danger.example.com
  - allow: true
    host: example.com
    protocol: https

Refer to http://www.elastic.co/guide/en/kibana/current/url-drilldown-settings-kb.html for more information.

Also, much like with the dashboard links, it is important to ensure that ctrl + click, shift + click, and meta + click work as expected, regardless of whether the Open in new tab setting is true or false.

Checklist

For maintainers

@Heenawter Heenawter added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:large Large Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Aug 17, 2023
@Heenawter Heenawter self-assigned this Aug 17, 2023
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from c1242f1 to ff2f699 Compare August 17, 2023 15:37
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from ff2f699 to c367b7b Compare August 17, 2023 15:39
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from a134f3d to f7e8309 Compare August 17, 2023 17:42
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from cb1f664 to ec4b98e Compare August 17, 2023 19:57
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from b9c8302 to 3953b4f Compare August 17, 2023 21:35
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch 6 times, most recently from 5f5e21f to 4c862e4 Compare August 21, 2023 21:27
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from 4c862e4 to 4712e57 Compare August 21, 2023 21:56
@Heenawter Heenawter added the ci:cloud-deploy Create or update a Cloud deployment label Aug 22, 2023
@Heenawter Heenawter force-pushed the nav-link-drilldown_2023-08-16 branch from ca0ba7c to 185f507 Compare August 23, 2023 15:46
@Heenawter
Copy link
Contributor Author

/oblt-deploy

@Heenawter Heenawter removed the ci:cloud-deploy Create or update a Cloud deployment label Aug 23, 2023
@Heenawter Heenawter requested review from a team as code owners August 30, 2023 19:39
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@botelastic botelastic bot added the Feature:Drilldowns Embeddable panel Drilldowns label Aug 30, 2023
}}
initialSelection={externalLinkDestination}
onDestinationPicked={(url) => setDestination(url, url)}
setDestinationError={setDestinationError}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only external links currently have validation - you cannot select an invalid dashboard and, even if you are editing an existing link where the selected destination dashboard was deleted, we simply treat this as "no selection" rather than "invalid selection" . After all, the panel editor already tells the user that the dashboard was deleted - IMO, we don't need to duplicate this information in the link editor:

image

import { NavEmbeddableStrings } from '../navigation_embeddable_strings';
import { EuiFormRow } from '@elastic/eui';

export const NavigationEmbeddableLinkDestination = ({
Copy link
Contributor Author

@Heenawter Heenawter Aug 30, 2023

Choose a reason for hiding this comment

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

I separated this out into a new component for two reasons:

  1. It cleans up the logic of NavigationEmbeddableLinkEditor a little bit
  2. It makes it easier to remember selections even when the link types change, like so:
Before After
Aug-30-2023 17-31-14 Aug-30-2023 17-30-41

I opted to do this because the link options remembered their previous selections (which I figured was important, since we don't want users to accidentally lose their settings), so it felt inconsistent that the destination wouldn't be remembered.

Comment on lines 89 to 92
tooltipTitle: Boolean(dashboardDescription) ? linkLabel : undefined,
tooltipMessage: dashboardDescription || linkLabel,
};
}, [error, dashboardTitle, dashboardDescription]);
}, [error, linkLabel, dashboardDescription]);
Copy link
Contributor Author

@Heenawter Heenawter Aug 31, 2023

Choose a reason for hiding this comment

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

Figured I might as well quickly make this change per the offline tooltip description, since it's such a tiny change - previously, we were always showing the saved object title in the tooltip; now, we default to the custom label, if provided. This means that the link label and the tooltip will always display the same value

if (allowedUrl === null) {
throw new DisallowedUrlError();
}
const validatedUrl = urlDrilldownValidateUrl(url);
Copy link
Member

@nickpeihl nickpeihl Aug 31, 2023

Choose a reason for hiding this comment

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

Are these the only protocols we will support (http, https, mailto)? I may need to update my content management schemas accordingly. https://github.com/elastic/kibana/pull/164330/files#diff-e2bc370404a35f02472741df329913c28531da5e3ef140b2067bb4ba69ccc465R40

Heenawter and others added 3 commits August 31, 2023 11:24
…bstract_dashboard_drilldown/components/dashboard_drilldown_config/dashboard_drilldown_config.tsx

Co-authored-by: Nick Peihl <[email protected]>
…bstract_dashboard_drilldown/components/dashboard_drilldown_config/dashboard_drilldown_config.tsx

Co-authored-by: Nick Peihl <[email protected]>
const destination = useMemo(() => {
return linkOptions.encodeUrl ? encodeURI(link.destination) : link.destination;
}, [linkOptions, link.destination]);

return (
<EuiListGroupItem
Copy link
Member

Choose a reason for hiding this comment

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

I think we still need to validate the URL again here against the externalUrl policy. It is possible for someone to create an external link to https://example.com. But later the Kibana admin decides to set an external policy against that domain. In that case, the link should probably be disabled with a warning about the external link policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh, very good point 👍 Will do

Copy link
Contributor Author

@Heenawter Heenawter Aug 31, 2023

Choose a reason for hiding this comment

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

Done in 3ca397b!

Screen.Recording.2023-08-31.at.4.12.38.PM.mov

Copy link
Contributor

@andreadelrio andreadelrio 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 job!

Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

lgtm! code review and tested dashboard and external links with all options.

…link/dashboard_link_component.tsx


Always show tooltips on Dashboard Links
@nickpeihl nickpeihl merged commit 84b7b17 into elastic:navigation-embeddable Sep 5, 2023
1 check passed
@kibana-ci
Copy link
Collaborator

kibana-ci commented Sep 5, 2023

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] x-pack/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts / alerting api integration security and spaces enabled - Group 2 Connectors CasesWebhook CasesWebhook - Action Creation 400s for all required fields when missing should respond with a 400 Bad Request when creating a casesWebhook action with no createIncidentUrl
  • [job] [logs] Jest Integration Tests #1 / checking migration metadata changes on all registered SO types detecting migration related changes in registered types
  • [job] [logs] FTR Configs #37 / Controls Range Slider Control create and edit edits title and size of an existing control and retains existing range selection
  • [job] [logs] FTR Configs #37 / Controls Range Slider Control create and edit edits title and size of an existing control and retains existing range selection
  • [job] [logs] FTR Configs #44 / Options list control Dashboard options list creation and editing Options List Control creation and editing experience renames an existing control and retains selection
  • [job] [logs] FTR Configs #44 / Options list control Dashboard options list creation and editing Options List Control creation and editing experience renames an existing control and retains selection
  • [job] [logs] Jest Integration Tests #5 / SO type registrations does not remove types from registrations without updating excludeOnUpgradeQuery

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [26cc51e]

History

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

cc @Heenawter

@Heenawter Heenawter deleted the nav-link-drilldown_2023-08-16 branch September 17, 2023 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:cloud-deploy Create or update a Cloud deployment Feature:Drilldowns Embeddable panel Drilldowns impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:large Large Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants