Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

#6176
Merged
JamesNK merged 5 commits into
mainmicrosoft/aspire:mainfrom
jamesnk/gridvalue-hrefmicrosoft/aspire:jamesnk/gridvalue-hrefCopy head branch name to clipboard
Oct 23, 2024
Merged

Automatically convert URLs in values into links in the dashboard#6176
JamesNK merged 5 commits into
mainmicrosoft/aspire:mainfrom
jamesnk/gridvalue-hrefmicrosoft/aspire:jamesnk/gridvalue-hrefCopy head branch name to clipboard

Conversation

@JamesNK

@JamesNK JamesNK commented Oct 8, 2024

Copy link
Copy Markdown
Member

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

JamesNK commented Oct 8, 2024

Copy link
Copy Markdown
Member Author

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

JamesNK commented Oct 21, 2024

Copy link
Copy Markdown
Member Author

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.

Comment thread src/Aspire.Dashboard/Components/Controls/GridValue.razor.cs
@drewnoakes

Copy link
Copy Markdown
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
Comment thread src/Aspire.Dashboard/Components/Controls/GridValue.razor Outdated
// [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
Copy Markdown
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
Copy Markdown
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
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.