Merge pull request #3574 from bluewave-labs/fix/open-site-action-internal-url

fix(client): hide Open site action when URL is not browser-openable
This commit is contained in:
Alexander Holliday authored and GitHub committed 2026-04-24 09:51:01 -07:00
commit 6e89be2ac5
2 files changed
+14 -13

No files matched your search

@@ -80,14 +80,6 @@ export const InfraMonitorsTable = ({
const getActions = (monitor: Monitor): ActionMenuItem[] => {
return [
{
id: 1,
label: t("pages.common.monitors.actions.openSite"),
action: () => {
window.open(monitor.url, "_blank", "noreferrer");
},
closeMenu: true,
},
{
id: 2,
label: t("pages.common.monitors.actions.details"),
@@ -71,16 +71,24 @@ export const MonitorTable = ({
refetch();
};
const isBrowserOpenable = (monitor: Monitor): boolean => {
if (monitor.type !== "http" && monitor.type !== "pagespeed") return false;
return /^https?:\/\//i.test(monitor.url ?? "");
};
const getActions = (monitor: Monitor): ActionMenuItem[] => {
return [
{
const actions: ActionMenuItem[] = [];
if (isBrowserOpenable(monitor)) {
actions.push({
id: 1,
label: t("pages.common.monitors.actions.openSite"),
action: () => {
window.open(monitor.url, "_blank", "noreferrer");
},
closeMenu: true,
},
});
}
actions.push(
{
id: 2,
label: t("pages.common.monitors.actions.details"),
@@ -130,8 +138,9 @@ export const MonitorTable = ({
),
action: () => setSelectedMonitor(monitor),
closeMenu: true,
},
];
}
);
return actions;
};
const getHeaders = (chartType: string) => {