Skip to content

Fix Open Site action for internal monitors#3511

Closed
ZeinebMegaadi wants to merge 3 commits intobluewave-labs:developfrom
ZeinebMegaadi:fix/open-site-button-only
Closed

Fix Open Site action for internal monitors#3511
ZeinebMegaadi wants to merge 3 commits intobluewave-labs:developfrom
ZeinebMegaadi:fix/open-site-button-only

Conversation

@ZeinebMegaadi
Copy link
Copy Markdown
Contributor

Describe your changes

Fixed the "Open Site" action in the monitor actions menu to prevent opening internal/private endpoints that are not accessible from the user's browser.

This includes:

  • Hardware monitors (Capture agent targets)
  • Port monitors (non-URL services)
  • HTTP monitors pointing to internal services (e.g. traefik, localhost, internal Docker DNS)

The action is now hidden when the monitor target is not externally accessible.

Write your issue number after "Fixes "

Fixes #3434

Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks.

  • (Do not skip this or your PR will be closed) I deployed the application locally.
  • (Do not skip this or your PR will be closed) I have performed a self-reviewing and testing of my code.
  • I have included the issue # in the PR.
  • I have added i18n support to visible strings (instead of <div>Add</div>, use):
const { t } = useTranslation();
<div>{t('add')}</div>
  • I have not included any files that are not related to my pull request, including package-lock and package-json if dependencies have not changed
  • I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
  • I made sure font sizes, color choices etc are all referenced from the theme. I don't have any hardcoded dimensions.
  • My PR is granular and targeted to one specific feature.
  • There are two database implementations (MongoDB and PostgreSQL TimescaleDB) and I have taken care of them appropriately.
  • I ran npm run format in server and client directories, which automatically formats your code.
  • I took a screenshot or a video and attached to this PR if there is a UI change.
    Open Site button stopped showing for internal links:
Screenshot 2026-04-14 192543

Copy link
Copy Markdown
Collaborator

@ajhollid ajhollid left a comment

Choose a reason for hiding this comment

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

On further thought, I don't think the premise of this change is really correct.

If my client and server are both running on the same machine, which is not an unreasonable setup, I may indeed want to open internal URLs in my browser.

I think the only discriminant for opening URLs in the browser should be to exclude types that don't display anything useful in the browser, like docker monitors or infrastrucutre monitors.

@ZeinebMegaadi
Copy link
Copy Markdown
Contributor Author

That makes sense yeah, thanks for the clarification!
I was trying to prevent cases where the link wouldn’t work from the browser but I agree that internal URLs can still be valid depending on the setup. I’ll update the logic to only hide the action for monitor types that don’t produce a meaningful browser view (like: infrastructure/docker), instead of filtering based on the URL.

@ajhollid
Copy link
Copy Markdown
Collaborator

That makes sense yeah, thanks for the clarification! I was trying to prevent cases where the link wouldn’t work from the browser but I agree that internal URLs can still be valid depending on the setup. I’ll update the logic to only hide the action for monitor types that don’t produce a meaningful browser view (like: infrastructure/docker), instead of filtering based on the URL.

Yeah I understand the intent behind it, but let's keep it flexible since we don't want to assume too much about the user's setup 👍 Sounds like you've got it in hand, we'll get this merged in when the changes are pushed.

Thanks for working on the project!

@ZeinebMegaadi ZeinebMegaadi requested a review from ajhollid April 16, 2026 18:05
@ZeinebMegaadi
Copy link
Copy Markdown
Contributor Author

Is this better?

Copy link
Copy Markdown
Collaborator

@ajhollid ajhollid left a comment

Choose a reason for hiding this comment

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

Change looks good, but is incomplete. Here is the full list of montior types:

export const MonitorTypes = ["http", "ping", "pagespeed", "hardware", "docker", "port", "game", "grpc", "websocket", "unknown"] as const;

Let's figure out which ones should be in the non browser type or not.

import type { ActionMenuItem } from "@/Components/actions-menu";
import type { RootState } from "@/Types/state";

const NON_BROWSER_TYPES = ["hardware", "docker"];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What about other non-browser types like gRPC, Docker, etc? I don't know exactly which ones are not browser-friendly, but at least some of them are not.

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.

Good point. I initially only included hardware and docker, but you're right that other types like gRPC and port-based checks are also not browser-friendly. Also I'm assuming that ping (ICMP) isn’t browser-compatible and game likely uses non-HTTP protocols, but I want to confirm before adding them.

import type { ActionMenuItem } from "@/Components/actions-menu";
import type { RootState } from "@/Types/state";

const NON_BROWSER_TYPES = ["hardware", "docker"];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be types as an Array<MonitorType>. We want type safety everywhere

@ajhollid
Copy link
Copy Markdown
Collaborator

Closing as inactive

@ajhollid ajhollid closed this Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Open site" action is unusable for monitors with internal URLs

2 participants