[PageSpeed]: Added localized strings for frequecies, form error, lighthouse API. Removed configure prop and used monitorId check.

This commit is contained in:
Jesulayomy committed 2025-07-09 15:47:01 -04:00
1 parent db02f68095
commit a71756a6ec
4 files changed
+32 -32

No files matched your search

@@ -1,9 +0,0 @@
.configure-pagespeed button {
height: var(--env-var-height-2);
}
.configure-pagespeed .field,
.configure-pagespeed .section-disabled,
.configure-pagespeed .select-wrapper {
flex: 1;
}
+16 -17
View File
@@ -33,21 +33,9 @@ import {
usePauseMonitor, usePauseMonitor,
} from "../../../Hooks/monitorHooks"; } from "../../../Hooks/monitorHooks";
// Constants const PageSpeedSetup = () => {
const MS_PER_MINUTE = 60000;
const FREQUENCIES = [
{ _id: 3, name: "3 minutes" },
{ _id: 5, name: "5 minutes" },
{ _id: 10, name: "10 minutes" },
{ _id: 20, name: "20 minutes" },
{ _id: 60, name: "1 hour" },
{ _id: 1440, name: "1 day" },
{ _id: 10080, name: "1 week" },
];
const PageSpeedSetup = ({ configure }) => {
const isConfigure = configure;
const { monitorId } = useParams(); const { monitorId } = useParams();
const isConfigure = !!monitorId;
const CRUMBS = [ const CRUMBS = [
{ name: "pagespeed", path: "/pagespeed" }, { name: "pagespeed", path: "/pagespeed" },
...(isConfigure ...(isConfigure
@@ -82,6 +70,17 @@ const PageSpeedSetup = ({ configure }) => {
// Setup // Setup
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
// Constants
const MS_PER_MINUTE = 60000;
const FREQUENCIES = [
{ _id: 3, name: t("time.threeMinutes") },
{ _id: 5, name: t("time.fiveMinutes") },
{ _id: 10, name: t("time.tenMinutes") },
{ _id: 20, name: t("time.twentyMinutes") },
{ _id: 60, name: t("time.oneHour") },
{ _id: 1440, name: t("time.oneDay") },
{ _id: 10080, name: t("time.oneWeek") },
];
const { user } = useSelector((state) => state.auth); const { user } = useSelector((state) => state.auth);
const { statusColor, pagespeedStatusMsg, determineState } = useMonitorUtils(); const { statusColor, pagespeedStatusMsg, determineState } = useMonitorUtils();
@@ -117,7 +116,7 @@ const PageSpeedSetup = ({ configure }) => {
newErrors[err.path[0]] = err.message; newErrors[err.path[0]] = err.message;
}); });
setErrors(newErrors); setErrors(newErrors);
createToast({ body: "Please check the form for errors." }); createToast({ body: t("checkFormError") });
return; return;
} }
@@ -352,7 +351,7 @@ const PageSpeedSetup = ({ configure }) => {
type={"url"} type={"url"}
name="url" name="url"
id="monitor-url" id="monitor-url"
label={isConfigure ? t("url") : "URL to monitor"} label={isConfigure ? t("url") : t("urlMonitor")}
startAdornment={ startAdornment={
!isConfigure ? <HttpAdornment https={https} /> : undefined !isConfigure ? <HttpAdornment https={https} /> : undefined
} }
@@ -396,7 +395,7 @@ const PageSpeedSetup = ({ configure }) => {
<Radio <Radio
id="monitor-checks-http" id="monitor-checks-http"
title="PageSpeed" title="PageSpeed"
desc="Use the Lighthouse PageSpeed API to monitor your website" desc={t("pageSpeedLighthouseAPI")}
size="small" size="small"
value="http" value="http"
checked={monitor.type === "pagespeed"} checked={monitor.type === "pagespeed"}
+1 -1
View File
@@ -106,7 +106,7 @@ const Routes = () => {
/> />
<Route <Route
path="pagespeed/configure/:monitorId" path="pagespeed/configure/:monitorId"
element={<PageSpeedCreate configure={true} />} element={<PageSpeedCreate />}
/> />
<Route <Route
path="infrastructure" path="infrastructure"
+15 -5
View File
@@ -209,7 +209,12 @@
"validationFailed": "Validation failed" "validationFailed": "Validation failed"
}, },
"cancel": "Cancel", "cancel": "Cancel",
"checkFormError": "Please check the form for errors.",
"checkFrequency": "Check frequency", "checkFrequency": "Check frequency",
"checkHooks": {
"failureResolveOne": "Failed to resolve incident.",
"failureResolveAll": "Failed to resolve all incidents."
},
"checkingEvery": "Checking every", "checkingEvery": "Checking every",
"city": "CITY", "city": "CITY",
"common": { "common": {
@@ -499,7 +504,6 @@
"failureAddDemoMonitors": "Failed to add demo monitors", "failureAddDemoMonitors": "Failed to add demo monitors",
"successAddDemoMonitors": "Successfully added demo monitors" "successAddDemoMonitors": "Successfully added demo monitors"
}, },
"monitorState": { "monitorState": {
"active": "Active", "active": "Active",
"paused": "Paused", "paused": "Paused",
@@ -516,10 +520,6 @@
"monitorStatusUp": "Monitor {name} ({url}) is now UP and responding", "monitorStatusUp": "Monitor {name} ({url}) is now UP and responding",
"monitors": "monitors", "monitors": "monitors",
"monitorsToApply": "Monitors to apply maintenance window to", "monitorsToApply": "Monitors to apply maintenance window to",
"checkHooks": {
"failureResolveOne": "Failed to resolve incident.",
"failureResolveAll": "Failed to resolve all incidents."
},
"ms": "ms", "ms": "ms",
"navControls": "Controls", "navControls": "Controls",
"nextWindow": "Next window", "nextWindow": "Next window",
@@ -608,6 +608,7 @@
"pageSpeedDetailsPerformanceReport": "Values are estimated and may vary.", "pageSpeedDetailsPerformanceReport": "Values are estimated and may vary.",
"pageSpeedDetailsPerformanceReportCalculator": "See calculator", "pageSpeedDetailsPerformanceReportCalculator": "See calculator",
"pageSpeedLearnMoreLink": "Click here", "pageSpeedLearnMoreLink": "Click here",
"pageSpeedLighthouseAPI": "Use the Lighthouse PageSpeed API to monitor your website",
"pageSpeedMonitor": "PageSpeed monitor", "pageSpeedMonitor": "PageSpeed monitor",
"pageSpeedWarning": "Warning: You haven't added a Google PageSpeed API key yet. Without it, the PageSpeed monitor won't function.", "pageSpeedWarning": "Warning: You haven't added a Google PageSpeed API key yet. Without it, the PageSpeed monitor won't function.",
"passwordPanel": { "passwordPanel": {
@@ -843,6 +844,15 @@
}, },
"testLocale": "testLocale", "testLocale": "testLocale",
"testNotificationsDisabled": "There are no notifications setup for this monitor. You need to add one by clicking 'Configure' button", "testNotificationsDisabled": "There are no notifications setup for this monitor. You need to add one by clicking 'Configure' button",
"time": {
"threeMinutes": "3 minutes",
"fiveMinutes": "5 minutes",
"tenMinutes": "10 minutes",
"twentyMinutes": "20 minutes",
"oneHour": "1 hour",
"oneDay": "1 day",
"oneWeek": "1 week"
},
"timeZoneInfo": "All dates and times are in GMT+0 time zone.", "timeZoneInfo": "All dates and times are in GMT+0 time zone.",
"timezone": "Timezone", "timezone": "Timezone",
"title": "Title", "title": "Title",