Skip to content

[Logs+] Replace infra public usages of link-to routes#158362

Merged
mohamedhamed-ahmed merged 7 commits intoelastic:mainfrom
mohamedhamed-ahmed:157985-replace-infra-link-to-routes-with-the-appropriate-locator
May 30, 2023
Merged

[Logs+] Replace infra public usages of link-to routes#158362
mohamedhamed-ahmed merged 7 commits intoelastic:mainfrom
mohamedhamed-ahmed:157985-replace-infra-link-to-routes-with-the-appropriate-locator

Conversation

@mohamedhamed-ahmed
Copy link
Copy Markdown
Contributor

@mohamedhamed-ahmed mohamedhamed-ahmed commented May 24, 2023

part of #157985

📝 Summary

After implementing infra locators to allow navigation to the logs UI we need to replace all usages of the old link-to routes so that we have strongly typed navigation to the logs UI.

This PR focuses on replacing link-to usages in the Infra Public plugin.

✅ Testing

A)

  1. Navigate to Observability -> Infrastructure -> Inventory
  2. Choose any of the Host from the waffle
  3. Click logs tab
  4. Click open in logs link

B)

  1. Navigate to Observability -> Infrastructure -> Inventory
  2. Switch to table view
  3. Click any of the Host from the table
  4. Click Host Logs
Screen.Recording.2023-05-24.at.18.04.37.mov

import { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public';
import type { LogsLocatorDependencies, LogsLocatorParams } from './logs_locator';

const DISCOVER_LOGS_LOCATOR_ID = 'DISCOVER_LOGS_LOCATOR';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we don't need a new locator id since its either serverless or not, and so we will always use 1 locator id.

import { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public';
import type { NodeLogsLocatorDependencies, NodeLogsLocatorParams } from './node_logs_locator';

const DISCOVER_NODE_LOGS_LOCATOR_ID = 'DISCOVER_NODE_LOGS_LOCATOR';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we don't need a new locator id since its either serverless or not, and so we will always use 1 locator id.

@mohamedhamed-ahmed mohamedhamed-ahmed added Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v8.9.0 labels May 24, 2023
@mohamedhamed-ahmed mohamedhamed-ahmed marked this pull request as ready for review May 24, 2023 17:19
@mohamedhamed-ahmed mohamedhamed-ahmed requested a review from a team as a code owner May 24, 2023 17:19
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@Kerry350 Kerry350 self-requested a review May 26, 2023 10:03
Copy link
Copy Markdown
Contributor

@Kerry350 Kerry350 left a comment

Choose a reason for hiding this comment

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

The two examples in the description work as expected 👍

Just two small questions (one inline):

Under common/formatters/alert_link.ts there is a /app/logs/link-to/default/logs URL in use, should this be updated? (I appreciate the PR says public only, and that the consumer here would be outside of infra).

Otherwise LGTM 👍

size={'xs'}
flush={'both'}
iconType={'popout'}
href={locators.nodeLogsLocator.getRedirectUrl({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this need to be called on each render? (I wonder if this comes with a slight performance hit due to the Base64 encoding).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you are right, updated it to useMemo 👍

Kerry350

This comment was marked as duplicate.

@mohamedhamed-ahmed
Copy link
Copy Markdown
Contributor Author

Under common/formatters/alert_link.ts there is a /app/logs/link-to/default/logs URL in use, should this be updated? (I appreciate the PR says public only, and that the consumer here would be outside of infra).

Absolutely 👍 this is coming with the next PR as its a bigger refactoring and is affecting both Public and Server

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
infra 2.0MB 2.0MB -234.0B

Page load bundle

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

id before after diff
infra 104.3KB 104.3KB -18.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 401 405 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 481 485 +4
total +6

History

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

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 release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants