8000 Automatically convert URLs in values into links in the dashboard by JamesNK · Pull Request #6176 · dotnet/aspire · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Automatically convert URLs in values into links in the dashboard #6176

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

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

JamesNK
Copy link
Member
@JamesNK JamesNK commented Oct 8, 2024

Description

Automatically convert URLs in values and properties into links:

image

GridValue is used in many places:

  • Resource properties, structured logs properties, span propertries
  • Env vars
  • Message on structured logs grid

There is a limitation: it doesn't work together with highlighting. Highlighting is only supported over plain text, not HTML. That means links are disabled when you begin searching with a filter and you go back to the current experience.

Getting these two features to work together properly is quite tricky. Will require building up a model of the text and transforming it when applying different operations (adding in links, adding in highlights)

Addresses #6175
Fixes #4845

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
      • Link to aspire-docs issue:
    • No

@JamesNK
Copy link
Member Author
JamesNK commented Oct 8, 2024

This is an impactful change with some risk. Post 9.0 feature.

@davidfowl davidfowl added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 8, 2024
@JamesNK JamesNK force-pushed the jamesnk/gridvalue-href branch from 3ed51d8 to cd1c9b4 Compare October 21, 2024 01:23
@JamesNK JamesNK removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 21, 2024
@JamesNK JamesNK force-pushed the jamesnk/gridvalue-href branch from 641956c to e33c702 Compare October 21, 2024 05:01
@JamesNK
Copy link
Member Author
JamesNK commented Oct 21, 2024

Please take another look. I came back to his and did some more testing and noticed that content wasn't properly HTML encoded. Required a change in order of operations when parsing logs and content.

@drewnoakes
Copy link
Member

Please hold off on merging this for a day as I'm looking at #6230 today for 9.0 and will want to backport it. There's overlap here which would make that backport difficult/risky.

@JamesNK JamesNK added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 22, 2024
@JamesNK JamesNK force-pushed the jamesnk/gridvalue-href branch from e33c702 to 409cf35 Compare October 22, 2024 08:28
@JamesNK JamesNK removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 22, 2024
// https?:// - http:// or https://
// [-A-Za-z0-9+&@#/%?=~_|$!:,.;]* - Any character in the list, matched zero or more times.
// [A-Za-z0-9+&@#/%=~_|$] - Any character in the list, matched exactly once
[GeneratedRegex("\\bhttps?://[-A-Za-z0-9+&@#/%?=~_|$!:,.;]*[A-Za-z0-9+&@#/%=~_|$]")]
private static partial Regex GenerateUrlRegEx();
[GeneratedRegex("(?<=m|\\b)https?://[-A-Za-z0-9+&@#/%?=~_|$!:,.;]*[A-Za-z0-9+&@#/%=~_|$]")]
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we don't use captured groups here, so we could add RegexOptions.ExplicitCapture to allocate less when matching, now that we've added a group.

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked at this regex more and I removed the group. I added flags to ignore case and culture.

@JamesNK JamesNK enabled auto-merge (squash) October 23, 2024 00:56
@JamesNK JamesNK merged commit 513275d into main Oct 23, 2024
9 checks passed
@JamesNK JamesNK deleted the jamesnk/gridvalue-href branch October 23, 2024 03:22
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard does not display URLs stored as env variables as links
4 participants
BB6
0