pagespeed key alert
This commit is contained in:
1 parent
1819df5117
commit
90e9b41973
3 files changed
+29
-21
No files matched your search
@@ -12,13 +12,11 @@ import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
import type { StackProps } from "@mui/material/Stack";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Link as RouterLink } from "react-router-dom";
|
||||
import { Typography } from "@mui/material";
|
||||
|
||||
export const PageSpeedKeyPriorityFallback = () => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<BaseFallback>
|
||||
<Alert
|
||||
@@ -26,23 +24,23 @@ export const PageSpeedKeyPriorityFallback = () => {
|
||||
sx={{
|
||||
width: "100%",
|
||||
maxWidth: 600,
|
||||
backgroundColor: theme.palette.warning.light,
|
||||
color: theme.palette.warning.contrastText,
|
||||
"& .MuiAlert-icon": {
|
||||
color: theme.palette.warning.contrastText,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{t("pageSpeedWarning")}{" "}
|
||||
<Link
|
||||
component={RouterLink}
|
||||
to="/settings"
|
||||
color="inherit"
|
||||
fontWeight="inherit"
|
||||
>
|
||||
{t("pageSpeedLearnMoreLink")}
|
||||
</Link>{" "}
|
||||
{t("pageSpeedAddApiKey")}
|
||||
<Typography>
|
||||
<Trans
|
||||
i18nKey="common.alerts.pageSpeedApiKey.content"
|
||||
components={{
|
||||
settingsLink: (
|
||||
<Link
|
||||
component={RouterLink}
|
||||
to="/settings"
|
||||
color="inherit"
|
||||
fontWeight="inherit"
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Typography>
|
||||
</Alert>
|
||||
</BaseFallback>
|
||||
);
|
||||
@@ -178,8 +176,8 @@ export const MonitorBasePageWithStates = ({
|
||||
if (priorityFallback) {
|
||||
return (
|
||||
<BasePage
|
||||
loading={false}
|
||||
error={false}
|
||||
loading={loading}
|
||||
error={error}
|
||||
{...props}
|
||||
>
|
||||
{priorityFallback}
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
UpStatusBox,
|
||||
DownStatusBox,
|
||||
PausedStatusBox,
|
||||
PageSpeedKeyPriorityFallback,
|
||||
} from "@/Components/v2/design-elements";
|
||||
import { Dialog } from "@/Components/v2/inputs";
|
||||
import { HeaderCreate } from "@/Components/v2/common";
|
||||
@@ -52,6 +53,9 @@ const PageSpeedMonitorsPage = () => {
|
||||
|
||||
const isLoading = monitorsIsLoading || settingsIsLoading;
|
||||
|
||||
const showApiKeyWarning =
|
||||
isAdmin && settingsData && !settingsData.pagespeedKeySet;
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!selectedMonitor) return;
|
||||
await deleteFn(`/monitors/${selectedMonitor.id}`);
|
||||
@@ -70,6 +74,7 @@ const PageSpeedMonitorsPage = () => {
|
||||
items={monitors || []}
|
||||
page="pageSpeed"
|
||||
actionLink="/pagespeed/create"
|
||||
priorityFallback={showApiKeyWarning ? <PageSpeedKeyPriorityFallback /> : undefined}
|
||||
>
|
||||
<HeaderCreate
|
||||
path="/pagespeed/create"
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm"
|
||||
},
|
||||
"alerts": {
|
||||
"pageSpeedApiKey": {
|
||||
"content": "Warning: You haven't added a Google PageSpeed API key yet. Visit <settingsLink>Settings</settingsLink> to add one. Without it, the PageSpeed monitor won't function."
|
||||
}
|
||||
},
|
||||
"dialogs": {
|
||||
"delete": {
|
||||
"description": "This action cannot be undone.",
|
||||
|
||||
Reference in new issue
Block a user