Merge pull request #2473 from deepanshu2711/fix/floating-strings-2470

fix(ui): shorten URL label and resize notification button (#2470)
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-06-19 07:23:25 +08:00
commit 28718680fa
3 files changed
+13 -3

No files matched your search

@@ -68,6 +68,9 @@ const MonitorDetailsControlHeader = ({
onClick={() => { onClick={() => {
testAllNotifications({ monitorId: monitor?._id }); testAllNotifications({ monitorId: monitor?._id });
}} }}
sx={{
whiteSpace: "nowrap",
}}
> >
{t("sendTestNotifications")} {t("sendTestNotifications")}
</Button> </Button>
@@ -8,6 +8,7 @@ import { formatDurationRounded } from "../../Utils/timeUtils";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useMonitorUtils } from "../../Hooks/useMonitorUtils"; import { useMonitorUtils } from "../../Hooks/useMonitorUtils";
import { formatMonitorUrl } from "../../Utils/utils";
/** /**
* Status component displays the status information of a monitor. * Status component displays the status information of a monitor.
* It includes the monitor's name, URL, and check interval. * It includes the monitor's name, URL, and check interval.
@@ -33,9 +34,7 @@ const Status = ({ monitor }) => {
gap={theme.spacing(4)} gap={theme.spacing(4)}
> >
<PulseDot color={statusColor[determineState(monitor)]} /> <PulseDot color={statusColor[determineState(monitor)]} />
<Typography variant="monitorUrl"> <Typography variant="monitorUrl">{formatMonitorUrl(monitor?.url)}</Typography>
{monitor?.url?.replace(/^https?:\/\//, "") || "..."}
</Typography>
<Dot /> <Dot />
<Typography> <Typography>
Checking every {formatDurationRounded(monitor?.interval)}. Checking every {formatDurationRounded(monitor?.interval)}.
+8
View File
@@ -5,3 +5,11 @@ export const safelyParseFloat = (value) => {
} }
return parsedValue; return parsedValue;
}; };
export const formatMonitorUrl = (url, maxLength = 55) => {
if (!url) return "";
const strippedUrl = url.replace(/^https?:\/\//, "");
return strippedUrl.length > maxLength
? `${strippedUrl.slice(0, maxLength)}…`
: strippedUrl;
};