[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,
} from "../../../Hooks/monitorHooks";
// Constants
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 PageSpeedSetup = () => {
const { monitorId } = useParams();
const isConfigure = !!monitorId;
const CRUMBS = [
{ name: "pagespeed", path: "/pagespeed" },
...(isConfigure
@@ -82,6 +70,17 @@ const PageSpeedSetup = ({ configure }) => {
// Setup
const { t } = useTranslation();
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 { statusColor, pagespeedStatusMsg, determineState } = useMonitorUtils();
@@ -117,7 +116,7 @@ const PageSpeedSetup = ({ configure }) => {
newErrors[err.path[0]] = err.message;
});
setErrors(newErrors);
createToast({ body: "Please check the form for errors." });
createToast({ body: t("checkFormError") });
return;
}
@@ -352,7 +351,7 @@ const PageSpeedSetup = ({ configure }) => {
type={"url"}
name="url"
id="monitor-url"
label={isConfigure ? t("url") : "URL to monitor"}
label={isConfigure ? t("url") : t("urlMonitor")}
startAdornment={
!isConfigure ? <HttpAdornment https={https} /> : undefined
}
@@ -396,7 +395,7 @@ const PageSpeedSetup = ({ configure }) => {
<Radio
id="monitor-checks-http"
title="PageSpeed"
desc="Use the Lighthouse PageSpeed API to monitor your website"
desc={t("pageSpeedLighthouseAPI")}
size="small"
value="http"
checked={monitor.type === "pagespeed"}
+1 -1
View File
@@ -106,7 +106,7 @@ const Routes = () => {
/>
<Route
path="pagespeed/configure/:monitorId"
element={<PageSpeedCreate configure={true} />}
element={<PageSpeedCreate />}
/>
<Route
path="infrastructure"
+15 -5
View File
@@ -209,7 +209,12 @@
"validationFailed": "Validation failed"
},
"cancel": "Cancel",
"checkFormError": "Please check the form for errors.",
"checkFrequency": "Check frequency",
"checkHooks": {
"failureResolveOne": "Failed to resolve incident.",
"failureResolveAll": "Failed to resolve all incidents."
},
"checkingEvery": "Checking every",
"city": "CITY",
"common": {
@@ -499,7 +504,6 @@
"failureAddDemoMonitors": "Failed to add demo monitors",
"successAddDemoMonitors": "Successfully added demo monitors"
},
"monitorState": {
"active": "Active",
"paused": "Paused",
@@ -516,10 +520,6 @@
"monitorStatusUp": "Monitor {name} ({url}) is now UP and responding",
"monitors": "monitors",
"monitorsToApply": "Monitors to apply maintenance window to",
"checkHooks": {
"failureResolveOne": "Failed to resolve incident.",
"failureResolveAll": "Failed to resolve all incidents."
},
"ms": "ms",
"navControls": "Controls",
"nextWindow": "Next window",
@@ -608,6 +608,7 @@
"pageSpeedDetailsPerformanceReport": "Values are estimated and may vary.",
"pageSpeedDetailsPerformanceReportCalculator": "See calculator",
"pageSpeedLearnMoreLink": "Click here",
"pageSpeedLighthouseAPI": "Use the Lighthouse PageSpeed API to monitor your website",
"pageSpeedMonitor": "PageSpeed monitor",
"pageSpeedWarning": "Warning: You haven't added a Google PageSpeed API key yet. Without it, the PageSpeed monitor won't function.",
"passwordPanel": {
@@ -843,6 +844,15 @@
},
"testLocale": "testLocale",
"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.",
"timezone": "Timezone",
"title": "Title",