Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c633a9ad8d | ||
|
|
923eda1307 | ||
|
|
997342a31c |
No files matched your search
@@ -1 +0,0 @@
|
|||||||
* @ajhollid @mohicody @Br0wnHammer @Owaiseimdad @karenvicent @shanikauwu1
|
|
||||||
@@ -28,8 +28,7 @@ Checkmate has been stress-tested with 1000+ active monitors without any particul
|
|||||||
|
|
||||||
- [📦 Demo](#-demo)
|
- [📦 Demo](#-demo)
|
||||||
- [🔗 User's guide](#-users-guide)
|
- [🔗 User's guide](#-users-guide)
|
||||||
- [🛠️ Installation](#️-installation)
|
- [🛠️ Installation](#️-installation)
|
||||||
- [🚀 Deploying Checkmate with Helm](#-deploying-checkmate-with-helm)
|
|
||||||
- [🏁 Translations](#-translations)
|
- [🏁 Translations](#-translations)
|
||||||
- [🚀 Performance](#-performance)
|
- [🚀 Performance](#-performance)
|
||||||
- [💚 Questions & Ideas](#-questions--ideas)
|
- [💚 Questions & Ideas](#-questions--ideas)
|
||||||
@@ -51,10 +50,7 @@ Usage instructions can be found [here](https://docs.checkmate.so/checkmate-2.1).
|
|||||||
|
|
||||||
## 🛠️ Installation
|
## 🛠️ Installation
|
||||||
|
|
||||||
See installation instructions in [Checkmate documentation portal](https://docs.checkmate.so/checkmate-2.1/users-guide/quickstart).
|
See installation instructions in [Checkmate documentation portal](https://docs.checkmate.so/checkmate-2.1/users-guide/quickstart). Alternatively, you can also use [Coolify](https://coolify.io/), [Elestio](https://elest.io/open-source/checkmate) or [Pikapods](https://www.pikapods.com/) to quickly spin off a Checkmate instance. If you would like to monitor your server infrastructure, you'll need [Capture agent](https://github.com/bluewave-labs/capture). Capture repository also contains the installation instructions.
|
||||||
|
|
||||||
Alternatively, you can also use [Coolify](https://coolify.io/), [Elestio](https://elest.io/open-source/checkmate), [K8s](./charts/helm/checkmate/INSTALLATION.md) or [Pikapods](https://www.pikapods.com/) to quickly spin off a Checkmate instance. If you would like to monitor your server infrastructure, you'll need [Capture agent](https://github.com/bluewave-labs/capture). Capture repository also contains the installation instructions.
|
|
||||||
|
|
||||||
|
|
||||||
## 🏁 Translations
|
## 🏁 Translations
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
.git/
|
|
||||||
.gitignore
|
|
||||||
.bzr/
|
|
||||||
.bzrignore
|
|
||||||
.hg/
|
|
||||||
.hgignore
|
|
||||||
.svn/
|
|
||||||
*.swp
|
|
||||||
*.bak
|
|
||||||
*.tmp
|
|
||||||
*.orig
|
|
||||||
*~
|
|
||||||
.project
|
|
||||||
.idea/
|
|
||||||
*.tmproj
|
|
||||||
.vscode/
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
apiVersion: v2
|
|
||||||
name: checkmate-chart
|
|
||||||
description: A Helm chart for Checkmate App
|
|
||||||
type: application
|
|
||||||
version: 0.1.0
|
|
||||||
appVersion: "2.3"
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# Kubernetes Installation Guide for Checkmate
|
|
||||||
|
|
||||||
This guide walks you through deploying Checkmate on your Kubernetes cluster using Helm.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- A running Kubernetes cluster
|
|
||||||
- Helm CLI installed and configured
|
|
||||||
- `kubectl` configured to access your cluster
|
|
||||||
|
|
||||||
## Steps
|
|
||||||
|
|
||||||
### 1. Clone the repo and navigate to the Helm chart
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/bluewave-labs/checkmate.git
|
|
||||||
cd checkmate/charts/helm/checkmate
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Customize values.yaml
|
|
||||||
Edit `values.yaml` to update:
|
|
||||||
- `client.ingress.host` and `server.ingress.host` with your domain names
|
|
||||||
- `server.protocol` (usually http or https)
|
|
||||||
- Secrets under the `secrets` section (`JWT_SECRET`, email credentials, API keys, etc.) — replace all change_me values
|
|
||||||
|
|
||||||
### 3. Deploy the Helm chart
|
|
||||||
```bash
|
|
||||||
helm install checkmate ./charts/helm/checkmate
|
|
||||||
```
|
|
||||||
This will deploy the client, server, MongoDB, and Redis components.
|
|
||||||
|
|
||||||
### 4. Verify the deployment
|
|
||||||
Check pods and services:
|
|
||||||
```bash
|
|
||||||
kubectl get pods
|
|
||||||
kubectl get svc
|
|
||||||
```
|
|
||||||
|
|
||||||
Once all pods are `Running` and `Ready`, you can access Checkmate via the configured ingress hosts.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{{- if eq .Values.client.ingress.host "change_me" }}
|
|
||||||
{{- fail "client.ingress.host must be overridden and not set to 'change_me'" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if eq .Values.server.ingress.host "change_me" }}
|
|
||||||
{{- fail "server.ingress.host must be overridden and not set to 'change_me'" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- $protocol := .Values.server.protocol }}
|
|
||||||
{{- if not (or (eq $protocol "http") (eq $protocol "https")) }}
|
|
||||||
{{- fail "server.protocol must be either 'http' or 'https'" }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: client
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: client
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: client
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: client
|
|
||||||
image: {{ .Values.client.image }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.client.port }}
|
|
||||||
env:
|
|
||||||
- name: UPTIME_APP_API_BASE_URL
|
|
||||||
value: "{{ .Values.server.protocol }}://{{ .Values.server.ingress.host }}/api/v1"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{{- if .Values.client.ingress.enabled }}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: client-ingress
|
|
||||||
annotations:
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
|
||||||
spec:
|
|
||||||
rules:
|
|
||||||
- host: {{ .Values.client.ingress.host }}
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: client
|
|
||||||
port:
|
|
||||||
number: {{ .Values.client.port }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: client
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: client
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.client.port }}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: mongodb
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: mongodb
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: mongodb
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mongodb
|
|
||||||
image: {{ .Values.mongodb.image }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.mongodb.port }}
|
|
||||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
|
||||||
volumeMounts:
|
|
||||||
- name: mongodb-data
|
|
||||||
mountPath: /data/db
|
|
||||||
volumes:
|
|
||||||
- name: mongodb-data
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: mongodb-pvc
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: mongodb-pvc
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.persistence.mongodbSize }}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: mongodb
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: mongodb
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.mongodb.port }}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: redis
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: redis
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: redis
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: redis
|
|
||||||
image: {{ .Values.redis.image }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.redis.port }}
|
|
||||||
volumeMounts:
|
|
||||||
- name: redis-data
|
|
||||||
mountPath: /data
|
|
||||||
volumes:
|
|
||||||
- name: redis-data
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: redis-pvc
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: redis-pvc
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.persistence.redisSize }}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: redis
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: redis
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.redis.port }}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{{- $secrets := .Values.secrets }}
|
|
||||||
|
|
||||||
{{- if or (not $secrets.JWT_SECRET) (eq $secrets.JWT_SECRET "change_me") }}
|
|
||||||
{{- fail "secrets.JWT_SECRET must be overridden and cannot be 'change_me'" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if or (not $secrets.REFRESH_TOKEN_SECRET) (eq $secrets.REFRESH_TOKEN_SECRET "change_me") }}
|
|
||||||
{{- fail "secrets.REFRESH_TOKEN_SECRET must be overridden and cannot be 'change_me'" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: checkmate-secrets
|
|
||||||
type: Opaque
|
|
||||||
stringData:
|
|
||||||
{{- range $key, $value := := $secrets }}
|
|
||||||
{{ $key }}: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: server
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: server
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: server
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: server
|
|
||||||
image: {{ .Values.server.image }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.server.port }}
|
|
||||||
envFrom:
|
|
||||||
- secretRef:
|
|
||||||
name: checkmate-secrets
|
|
||||||
volumeMounts:
|
|
||||||
- name: docker-sock
|
|
||||||
mountPath: /var/run/docker.sock
|
|
||||||
volumes:
|
|
||||||
- name: docker-sock
|
|
||||||
hostPath:
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
type: Socket
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{{- if .Values.server.ingress.enabled }}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: server-ingress
|
|
||||||
annotations:
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
|
||||||
spec:
|
|
||||||
rules:
|
|
||||||
- host: {{ .Values.server.ingress.host }}
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: server
|
|
||||||
port:
|
|
||||||
number: {{ .Values.server.port }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: server
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: server
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.server.port }}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
client:
|
|
||||||
image: ghcr.io/bluewave-labs/checkmate-client:v2.3
|
|
||||||
port: 80
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
host: change_me
|
|
||||||
|
|
||||||
server:
|
|
||||||
image: ghcr.io/bluewave-labs/checkmate-backend:v2.3
|
|
||||||
port: 52345
|
|
||||||
protocol: change_me
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
host: change_me
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis:7.2
|
|
||||||
port: 6379
|
|
||||||
|
|
||||||
mongodb:
|
|
||||||
image: mongo:7.0
|
|
||||||
port: 27017
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
JWT_SECRET: change_me
|
|
||||||
REFRESH_TOKEN_SECRET: change_me
|
|
||||||
SYSTEM_EMAIL_ADDRESS: test@example.com
|
|
||||||
SYSTEM_EMAIL_PASSWORD: change_me
|
|
||||||
SYSTEM_EMAIL_HOST: smtp.example.com
|
|
||||||
SYSTEM_EMAIL_PORT: "587"
|
|
||||||
PAGESPEED_API_KEY: change_me
|
|
||||||
DB_CONNECTION_STRING: mongodb://mongodb:27017/uptime_db
|
|
||||||
REDIS_HOST: redis
|
|
||||||
REDIS_PORT: "6379"
|
|
||||||
DB_TYPE: MongoDB
|
|
||||||
TOKEN_TTL: 99d
|
|
||||||
REFRESH_TOKEN_TTL: 99d
|
|
||||||
|
|
||||||
persistence:
|
|
||||||
mongodbSize: 5Gi
|
|
||||||
redisSize: 1Gi
|
|
||||||
@@ -88,18 +88,15 @@ const Fallback = ({
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
borderStyle: "dashed",
|
borderStyle: "dashed",
|
||||||
height: {
|
height: {
|
||||||
sm: "55vh",
|
sm: "50vh",
|
||||||
md: "50vh",
|
md: "70vh",
|
||||||
lg: "70vh",
|
lg: "60vh",
|
||||||
xl: "58vh",
|
xl: "55vh",
|
||||||
},
|
},
|
||||||
width: {
|
width: {
|
||||||
sm: "90%",
|
sm: "90%",
|
||||||
md: "70%",
|
md: "50%",
|
||||||
lg: "42%",
|
lg: "40%",
|
||||||
},
|
|
||||||
minHeight: {
|
|
||||||
sm: theme.spacing(280),
|
|
||||||
},
|
},
|
||||||
padding: theme.spacing(10),
|
padding: theme.spacing(10),
|
||||||
}}
|
}}
|
||||||
@@ -147,11 +144,11 @@ const Fallback = ({
|
|||||||
</Stack>
|
</Stack>
|
||||||
{/* TODO - display a different fallback if user is not an admin*/}
|
{/* TODO - display a different fallback if user is not an admin*/}
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="accent"
|
color="accent"
|
||||||
sx={{ alignSelf: "center", mb: "2px" }}
|
sx={{ alignSelf: "center" }}
|
||||||
onClick={() => navigate(link)}
|
onClick={() => navigate(link)}
|
||||||
>
|
>
|
||||||
Let's create your first {title}
|
Let's create your first {title}
|
||||||
@@ -195,7 +192,7 @@ const Fallback = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -205,10 +205,6 @@ const useFetchStatsByMonitorId = ({
|
|||||||
const useFetchMonitorById = ({ monitorId, setMonitor, updateTrigger }) => {
|
const useFetchMonitorById = ({ monitorId, setMonitor, updateTrigger }) => {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof monitorId === "undefined") {
|
|
||||||
setIsLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const fetchMonitor = async () => {
|
const fetchMonitor = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.configure-pagespeed button {
|
||||||
|
height: var(--env-var-height-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.configure-pagespeed .field,
|
||||||
|
.configure-pagespeed .section-disabled,
|
||||||
|
.configure-pagespeed .select-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,351 @@
|
|||||||
|
// Components
|
||||||
|
import { Box, Stack, Tooltip, Typography, Button } from "@mui/material";
|
||||||
|
import ConfigBox from "../../../Components/ConfigBox";
|
||||||
|
import Select from "../../../Components/Inputs/Select";
|
||||||
|
import TextInput from "../../../Components/Inputs/TextInput";
|
||||||
|
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
|
||||||
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
|
import PulseDot from "../../../Components/Animated/PulseDot";
|
||||||
|
import PlayCircleOutlineRoundedIcon from "@mui/icons-material/PlayCircleOutlineRounded";
|
||||||
|
import SkeletonLayout from "./skeleton";
|
||||||
|
import NotificationsConfig from "../../../Components/NotificationConfig";
|
||||||
|
import Dialog from "../../../Components/Dialog";
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import { useParams } from "react-router";
|
||||||
|
import { monitorValidation } from "../../../Validation/validation";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useMonitorUtils } from "../../../Hooks/useMonitorUtils";
|
||||||
|
import { useGetNotificationsByTeamId } from "../../../Hooks/useNotifications";
|
||||||
|
import {
|
||||||
|
useFetchMonitorById,
|
||||||
|
useDeleteMonitor,
|
||||||
|
useUpdateMonitor,
|
||||||
|
usePauseMonitor,
|
||||||
|
} from "../../../Hooks/monitorHooks";
|
||||||
|
const PageSpeedConfigure = () => {
|
||||||
|
// Redux state
|
||||||
|
|
||||||
|
// Local state
|
||||||
|
const [monitor, setMonitor] = useState({});
|
||||||
|
const [errors, setErrors] = useState({});
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [updateTrigger, setUpdateTrigger] = useState(false);
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const MS_PER_MINUTE = 60000;
|
||||||
|
const { monitorId } = useParams();
|
||||||
|
const { statusColor, pagespeedStatusMsg, determineState } = useMonitorUtils();
|
||||||
|
|
||||||
|
const [notifications, notificationsAreLoading, notificationsError] =
|
||||||
|
useGetNotificationsByTeamId();
|
||||||
|
|
||||||
|
const [isLoading] = useFetchMonitorById({ monitorId, setMonitor, updateTrigger });
|
||||||
|
const [deleteMonitor, isDeleting] = useDeleteMonitor();
|
||||||
|
const [updateMonitor, isUpdating] = useUpdateMonitor();
|
||||||
|
const [pauseMonitor, isPausing] = usePauseMonitor();
|
||||||
|
|
||||||
|
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" },
|
||||||
|
];
|
||||||
|
|
||||||
|
// Handlers
|
||||||
|
const triggerUpdate = () => {
|
||||||
|
setUpdateTrigger(!updateTrigger);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChange = (event) => {
|
||||||
|
let { value, name } = event.target;
|
||||||
|
|
||||||
|
if (name === "interval") {
|
||||||
|
value = value * MS_PER_MINUTE;
|
||||||
|
}
|
||||||
|
setMonitor((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[name]: value,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const validation = monitorValidation.validate(
|
||||||
|
{ [name]: value },
|
||||||
|
{ abortEarly: false }
|
||||||
|
);
|
||||||
|
|
||||||
|
setErrors((prev) => {
|
||||||
|
const updatedErrors = { ...prev };
|
||||||
|
|
||||||
|
if (validation.error) updatedErrors[name] = validation.error.details[0].message;
|
||||||
|
else delete updatedErrors[name];
|
||||||
|
return updatedErrors;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePause = async () => {
|
||||||
|
await pauseMonitor({ monitorId, triggerUpdate });
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSubmit = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
await updateMonitor({ monitor, redirect: "/pagespeed" });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRemove = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
await deleteMonitor({ monitor, redirect: "/pagespeed" });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
className="configure-pagespeed"
|
||||||
|
gap={theme.spacing(10)}
|
||||||
|
>
|
||||||
|
{Object.keys(monitor).length === 0 ? (
|
||||||
|
<SkeletonLayout />
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Breadcrumbs
|
||||||
|
list={[
|
||||||
|
{ name: "pagespeed", path: "/pagespeed" },
|
||||||
|
{ name: "details", path: `/pagespeed/${monitorId}` },
|
||||||
|
{ name: "configure", path: `/pagespeed/configure/${monitorId}` },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
component="form"
|
||||||
|
noValidate
|
||||||
|
spellCheck="false"
|
||||||
|
onSubmit={onSubmit}
|
||||||
|
flex={1}
|
||||||
|
gap={theme.spacing(10)}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<Typography
|
||||||
|
component="h1"
|
||||||
|
variant="monitorName"
|
||||||
|
>
|
||||||
|
{monitor.name}
|
||||||
|
</Typography>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
height="fit-content"
|
||||||
|
gap={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Tooltip
|
||||||
|
title={pagespeedStatusMsg[determineState(monitor)]}
|
||||||
|
disableInteractive
|
||||||
|
slotProps={{
|
||||||
|
popper: {
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: "offset",
|
||||||
|
options: {
|
||||||
|
offset: [0, -8],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<PulseDot color={statusColor[determineState(monitor)]} />
|
||||||
|
</Box>
|
||||||
|
</Tooltip>
|
||||||
|
<Typography
|
||||||
|
component="h2"
|
||||||
|
variant="monitorUrl"
|
||||||
|
>
|
||||||
|
{monitor.url?.replace(/^https?:\/\//, "") || "..."}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
position="relative"
|
||||||
|
variant="body2"
|
||||||
|
ml={theme.spacing(6)}
|
||||||
|
mt={theme.spacing(1)}
|
||||||
|
sx={{
|
||||||
|
"&:before": {
|
||||||
|
position: "absolute",
|
||||||
|
content: `""`,
|
||||||
|
width: 4,
|
||||||
|
height: 4,
|
||||||
|
borderRadius: "50%",
|
||||||
|
backgroundColor: theme.palette.primary.contrastTextTertiary,
|
||||||
|
opacity: 0.8,
|
||||||
|
left: -10,
|
||||||
|
top: "50%",
|
||||||
|
transform: "translateY(-50%)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("editing")}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
<Box
|
||||||
|
alignSelf="flex-end"
|
||||||
|
ml="auto"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
onClick={handlePause}
|
||||||
|
loading={isLoading}
|
||||||
|
variant="contained"
|
||||||
|
color="secondary"
|
||||||
|
sx={{
|
||||||
|
pl: theme.spacing(4),
|
||||||
|
pr: theme.spacing(6),
|
||||||
|
"& svg": {
|
||||||
|
mr: theme.spacing(2),
|
||||||
|
"& path": {
|
||||||
|
stroke: theme.palette.primary.contrastTextTertiary,
|
||||||
|
strokeWidth: 0.1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{monitor?.isActive ? (
|
||||||
|
<>
|
||||||
|
<PauseCircleOutlineIcon />
|
||||||
|
{t("pause")}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<PlayCircleOutlineRoundedIcon />
|
||||||
|
{t("resume")}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loading={isLoading}
|
||||||
|
variant="contained"
|
||||||
|
color="error"
|
||||||
|
onClick={() => setIsOpen(true)}
|
||||||
|
sx={{
|
||||||
|
ml: theme.spacing(6),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("remove")}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
<ConfigBox>
|
||||||
|
<Box>
|
||||||
|
<Typography
|
||||||
|
component="h2"
|
||||||
|
variant="h2"
|
||||||
|
>
|
||||||
|
{t("settingsGeneralSettings")}
|
||||||
|
</Typography>
|
||||||
|
<Typography component="p">
|
||||||
|
{t("pageSpeedConfigureSettingsDescription")}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Stack
|
||||||
|
gap={theme.spacing(20)}
|
||||||
|
sx={{
|
||||||
|
".MuiInputBase-root:has(> .Mui-disabled)": {
|
||||||
|
backgroundColor: theme.palette.tertiary.main,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TextInput
|
||||||
|
name="url"
|
||||||
|
type="url"
|
||||||
|
label={t("url")}
|
||||||
|
placeholder="random.website.com"
|
||||||
|
value={monitor?.url || ""}
|
||||||
|
onChange={onChange}
|
||||||
|
error={errors.url ? true : false}
|
||||||
|
helperText={errors.url}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
|
<TextInput
|
||||||
|
name="name"
|
||||||
|
type="text"
|
||||||
|
label={t("monitorDisplayName")}
|
||||||
|
placeholder="Example monitor"
|
||||||
|
isOptional={true}
|
||||||
|
value={monitor?.name || ""}
|
||||||
|
onChange={onChange}
|
||||||
|
error={errors.name ? true : false}
|
||||||
|
helperText={errors.name}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
|
<ConfigBox>
|
||||||
|
<Box>
|
||||||
|
<Typography component="h2">{t("notificationConfig.title")}</Typography>
|
||||||
|
<Typography component="p">
|
||||||
|
{t("notificationConfig.description")}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<NotificationsConfig
|
||||||
|
notifications={notifications}
|
||||||
|
setMonitor={setMonitor}
|
||||||
|
setNotifications={monitor.notifications}
|
||||||
|
/>
|
||||||
|
</ConfigBox>
|
||||||
|
<ConfigBox>
|
||||||
|
<Box>
|
||||||
|
<Typography
|
||||||
|
component="h2"
|
||||||
|
variant="h2"
|
||||||
|
>
|
||||||
|
{t("distributedUptimeCreateAdvancedSettings")}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Stack gap={theme.spacing(20)}>
|
||||||
|
<Select
|
||||||
|
name="interval"
|
||||||
|
label={t("checkFrequency")}
|
||||||
|
items={frequencies}
|
||||||
|
value={monitor?.interval / MS_PER_MINUTE || 3}
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="flex-end"
|
||||||
|
mt="auto"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
loading={isLoading || isDeleting || isUpdating || isPausing}
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
color="accent"
|
||||||
|
sx={{ px: theme.spacing(12) }}
|
||||||
|
>
|
||||||
|
{t("settingsSave")}
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<Dialog
|
||||||
|
open={isOpen}
|
||||||
|
theme={theme}
|
||||||
|
title={t("deleteDialogTitle")}
|
||||||
|
description={t("deleteDialogDescription")}
|
||||||
|
onCancel={() => setIsOpen(false)}
|
||||||
|
confirmationButtonLabel={t("delete")}
|
||||||
|
onConfirm={handleRemove}
|
||||||
|
isLoading={isLoading || isDeleting || isUpdating || isPausing}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PageSpeedConfigure;
|
||||||
File renamed without changes.
@@ -1,20 +1,19 @@
|
|||||||
// Components
|
//Components
|
||||||
import { Box, Stack, Tooltip, Typography, Button, ButtonGroup } from "@mui/material";
|
import Box from "@mui/material/Box";
|
||||||
import ConfigBox from "../../../Components/ConfigBox";
|
import Stack from "@mui/material/Stack";
|
||||||
import Select from "../../../Components/Inputs/Select";
|
import Typography from "@mui/material/Typography";
|
||||||
import TextInput from "../../../Components/Inputs/TextInput";
|
import Button from "@mui/material/Button";
|
||||||
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
|
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
import PulseDot from "../../../Components/Animated/PulseDot";
|
import TextInput from "../../../Components/Inputs/TextInput";
|
||||||
import PlayCircleOutlineRoundedIcon from "@mui/icons-material/PlayCircleOutlineRounded";
|
|
||||||
import SkeletonLayout from "./skeleton";
|
|
||||||
import NotificationsConfig from "../../../Components/NotificationConfig";
|
|
||||||
import Dialog from "../../../Components/Dialog";
|
|
||||||
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
|
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
|
||||||
|
import ConfigBox from "../../../Components/ConfigBox";
|
||||||
import Radio from "../../../Components/Inputs/Radio";
|
import Radio from "../../../Components/Inputs/Radio";
|
||||||
|
import Select from "../../../Components/Inputs/Select";
|
||||||
|
import NotificationsConfig from "../../../Components/NotificationConfig";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useState, useEffect } from "react";
|
import { useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { monitorValidation } from "../../../Validation/validation";
|
import { monitorValidation } from "../../../Validation/validation";
|
||||||
import { parseDomainName } from "../../../Utils/monitorUtils";
|
import { parseDomainName } from "../../../Utils/monitorUtils";
|
||||||
@@ -22,130 +21,79 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useGetNotificationsByTeamId } from "../../../Hooks/useNotifications";
|
import { useGetNotificationsByTeamId } from "../../../Hooks/useNotifications";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { createToast } from "../../../Utils/toastUtils";
|
import { createToast } from "../../../Utils/toastUtils";
|
||||||
|
import { useCreateMonitor } from "../../../Hooks/monitorHooks";
|
||||||
|
|
||||||
import { useParams } from "react-router";
|
const MS_PER_MINUTE = 60000;
|
||||||
import { useMonitorUtils } from "../../../Hooks/useMonitorUtils";
|
|
||||||
import {
|
|
||||||
useCreateMonitor,
|
|
||||||
useFetchMonitorById,
|
|
||||||
useDeleteMonitor,
|
|
||||||
useUpdateMonitor,
|
|
||||||
usePauseMonitor,
|
|
||||||
} from "../../../Hooks/monitorHooks";
|
|
||||||
|
|
||||||
const PageSpeedSetup = () => {
|
const CRUMBS = [
|
||||||
const { monitorId } = useParams();
|
{ name: "pagespeed", path: "/pagespeed" },
|
||||||
const isCreate = typeof monitorId === "undefined";
|
{ name: "create", path: `/pagespeed/create` },
|
||||||
const CRUMBS = [
|
];
|
||||||
{ name: "pagespeed", path: "/pagespeed" },
|
|
||||||
...(isCreate
|
const SELECT_VALUES = [
|
||||||
? [{ name: "create", path: `/pagespeed/create` }]
|
{ _id: 3, name: "3 minutes" },
|
||||||
: [
|
{ _id: 5, name: "5 minutes" },
|
||||||
{ name: "details", path: `/pagespeed/${monitorId}` },
|
{ _id: 10, name: "10 minutes" },
|
||||||
{ name: "configure", path: `/pagespeed/configure/${monitorId}` },
|
{ _id: 20, name: "20 minutes" },
|
||||||
]),
|
{ _id: 60, name: "1 hour" },
|
||||||
];
|
{ _id: 1440, name: "1 day" },
|
||||||
|
{ _id: 10080, name: "1 week" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const CreatePageSpeed = () => {
|
||||||
|
// State
|
||||||
|
const [monitor, setMonitor] = useState({
|
||||||
|
url: "",
|
||||||
|
name: "",
|
||||||
|
type: "pagespeed",
|
||||||
|
notifications: [],
|
||||||
|
interval: 3,
|
||||||
|
});
|
||||||
|
|
||||||
// States
|
|
||||||
const [monitor, setMonitor] = useState(
|
|
||||||
isCreate
|
|
||||||
? {
|
|
||||||
url: "",
|
|
||||||
name: "",
|
|
||||||
type: "pagespeed",
|
|
||||||
notifications: [],
|
|
||||||
interval: 180000,
|
|
||||||
}
|
|
||||||
: {}
|
|
||||||
);
|
|
||||||
const [https, setHttps] = useState(true);
|
const [https, setHttps] = useState(true);
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const { user } = useSelector((state) => state.auth);
|
||||||
const [updateTrigger, setUpdateTrigger] = useState(false);
|
const [notifications, notificationsAreLoading, error] = useGetNotificationsByTeamId();
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
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 { statusColor, pagespeedStatusMsg, determineState } = useMonitorUtils();
|
|
||||||
const [notifications, notificationsAreLoading, notificationsError] =
|
|
||||||
useGetNotificationsByTeamId();
|
|
||||||
|
|
||||||
// Hooks for API actions
|
|
||||||
const [isLoading] = useFetchMonitorById({ monitorId, setMonitor, updateTrigger });
|
|
||||||
const [createMonitor, isCreating] = useCreateMonitor();
|
const [createMonitor, isCreating] = useCreateMonitor();
|
||||||
const [deleteMonitor, isDeleting] = useDeleteMonitor();
|
|
||||||
const [updateMonitor, isUpdating] = useUpdateMonitor();
|
|
||||||
const [pauseMonitor, isPausing] = usePauseMonitor();
|
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
const onSubmit = async (event) => {
|
const onSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (isCreate) {
|
let form = {
|
||||||
let form = {
|
url: `http${https ? "s" : ""}://` + monitor.url,
|
||||||
url: `http${https ? "s" : ""}://` + monitor.url,
|
name: monitor.name === "" ? monitor.url : monitor.name,
|
||||||
name: monitor.name === "" ? monitor.url : monitor.name,
|
type: monitor.type,
|
||||||
type: monitor.type,
|
interval: monitor.interval * MS_PER_MINUTE,
|
||||||
interval: monitor.interval,
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const { error } = monitorValidation.validate(form, { abortEarly: false });
|
const { error } = monitorValidation.validate(form, {
|
||||||
if (error) {
|
abortEarly: false,
|
||||||
const newErrors = {};
|
});
|
||||||
error.details.forEach((err) => {
|
|
||||||
newErrors[err.path[0]] = err.message;
|
|
||||||
});
|
|
||||||
setErrors(newErrors);
|
|
||||||
createToast({ body: t("checkFormError") });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
form = {
|
if (error) {
|
||||||
...form,
|
const newErrors = {};
|
||||||
description: form.name,
|
error.details.forEach((err) => {
|
||||||
notifications: monitor.notifications,
|
newErrors[err.path[0]] = err.message;
|
||||||
};
|
});
|
||||||
await createMonitor({ monitor: form, redirect: "/pagespeed" });
|
setErrors(newErrors);
|
||||||
} else {
|
createToast({ body: "Please check the form for errors." });
|
||||||
const monitorParams = {
|
return;
|
||||||
url: monitor.url,
|
|
||||||
name: monitor.name === "" ? monitor.url : monitor.name,
|
|
||||||
type: monitor.type,
|
|
||||||
interval: monitor.interval,
|
|
||||||
};
|
|
||||||
const { error } = monitorValidation.validate(monitorParams, { abortEarly: false });
|
|
||||||
if (error) {
|
|
||||||
const newErrors = {};
|
|
||||||
error.details.forEach((err) => {
|
|
||||||
newErrors[err.path[0]] = err.message;
|
|
||||||
});
|
|
||||||
setErrors(newErrors);
|
|
||||||
createToast({ body: t("checkFormError") });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await updateMonitor({ monitor, redirect: "/pagespeed" });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form = {
|
||||||
|
...form,
|
||||||
|
description: form.name,
|
||||||
|
notifications: monitor.notifications,
|
||||||
|
};
|
||||||
|
|
||||||
|
await createMonitor({ monitor: form, redirect: "/pagespeed" });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (event) => {
|
const handleChange = (event) => {
|
||||||
let { value, name } = event.target;
|
const { value, name } = event.target;
|
||||||
|
|
||||||
if (name === "interval") {
|
|
||||||
value = value * MS_PER_MINUTE;
|
|
||||||
}
|
|
||||||
|
|
||||||
setMonitor({
|
setMonitor({
|
||||||
...monitor,
|
...monitor,
|
||||||
[name]: value,
|
[name]: value,
|
||||||
@@ -155,6 +103,7 @@ const PageSpeedSetup = () => {
|
|||||||
{ [name]: value },
|
{ [name]: value },
|
||||||
{ abortEarly: false }
|
{ abortEarly: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
setErrors((prev) => ({
|
setErrors((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
...(error ? { [name]: error.details[0].message } : { [name]: undefined }),
|
...(error ? { [name]: error.details[0].message } : { [name]: undefined }),
|
||||||
@@ -162,179 +111,59 @@ const PageSpeedSetup = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleBlur = (event) => {
|
const handleBlur = (event) => {
|
||||||
const { name, value } = event.target;
|
const { name } = event.target;
|
||||||
if (name === "url" && monitor.name === "") {
|
if (name === "url") {
|
||||||
setMonitor((prev) => ({ ...prev, name: parseDomainName(value) }));
|
const { value } = event.target;
|
||||||
|
if (monitor.name !== "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setMonitor((prev) => ({
|
||||||
|
...prev,
|
||||||
|
name: parseDomainName(value),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const triggerUpdate = () => {
|
const { t } = useTranslation();
|
||||||
setUpdateTrigger(!updateTrigger);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlePause = async () => {
|
|
||||||
await pauseMonitor({ monitorId, triggerUpdate });
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRemove = async (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
await deleteMonitor({ monitor, redirect: "/pagespeed" });
|
|
||||||
};
|
|
||||||
|
|
||||||
const isBusy = isLoading || isCreating || isDeleting || isUpdating || isPausing;
|
|
||||||
|
|
||||||
if (Object.keys(monitor).length === 0) {
|
|
||||||
return <SkeletonLayout />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
className="create-monitor"
|
||||||
sx={{
|
sx={{
|
||||||
"& h1": { color: theme.palette.primary.contrastText },
|
"& h1": {
|
||||||
|
color: theme.palette.primary.contrastText,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Breadcrumbs list={CRUMBS} />
|
<Breadcrumbs list={CRUMBS} />
|
||||||
<Stack
|
<Stack
|
||||||
component="form"
|
component="form"
|
||||||
|
className="create-monitor-form"
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
noValidate
|
noValidate
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
gap={theme.spacing(12)}
|
gap={theme.spacing(12)}
|
||||||
mt={theme.spacing(6)}
|
mt={theme.spacing(6)}
|
||||||
>
|
>
|
||||||
<Stack
|
<Typography
|
||||||
direction="row"
|
component="h1"
|
||||||
gap={theme.spacing(2)}
|
variant="h1"
|
||||||
>
|
>
|
||||||
<Box>
|
<Typography
|
||||||
<Typography
|
component="span"
|
||||||
component="h1"
|
fontSize="inherit"
|
||||||
variant="h1"
|
>
|
||||||
>
|
{t("createYour")}{" "}
|
||||||
<Typography
|
</Typography>
|
||||||
component="span"
|
<Typography
|
||||||
fontSize="inherit"
|
component="span"
|
||||||
color={
|
fontSize="inherit"
|
||||||
!isCreate ? theme.palette.primary.contrastTextSecondary : undefined
|
fontWeight="inherit"
|
||||||
}
|
color={theme.palette.primary.contrastTextSecondary}
|
||||||
>
|
>
|
||||||
{!isCreate ? monitor.name : t("createYour") + " "}
|
{t("pageSpeedMonitor")}
|
||||||
</Typography>
|
</Typography>
|
||||||
{isCreate ? (
|
</Typography>
|
||||||
<Typography
|
|
||||||
component="span"
|
|
||||||
fontSize="inherit"
|
|
||||||
fontWeight="inherit"
|
|
||||||
color={theme.palette.primary.contrastTextSecondary}
|
|
||||||
>
|
|
||||||
{t("pageSpeedMonitor")}
|
|
||||||
</Typography>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
{!isCreate && (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
alignItems="center"
|
|
||||||
height="fit-content"
|
|
||||||
gap={theme.spacing(2)}
|
|
||||||
>
|
|
||||||
<Tooltip
|
|
||||||
title={pagespeedStatusMsg[determineState(monitor)]}
|
|
||||||
disableInteractive
|
|
||||||
slotProps={{
|
|
||||||
popper: {
|
|
||||||
modifiers: [
|
|
||||||
{
|
|
||||||
name: "offset",
|
|
||||||
options: { offset: [0, -8] },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box>
|
|
||||||
<PulseDot color={statusColor[determineState(monitor)]} />
|
|
||||||
</Box>
|
|
||||||
</Tooltip>
|
|
||||||
<Typography
|
|
||||||
component="h2"
|
|
||||||
variant="monitorUrl"
|
|
||||||
>
|
|
||||||
{monitor.url?.replace(/^https?:\/\//, "") || "..."}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
position="relative"
|
|
||||||
variant="body2"
|
|
||||||
ml={theme.spacing(6)}
|
|
||||||
mt={theme.spacing(1)}
|
|
||||||
sx={{
|
|
||||||
"&:before": {
|
|
||||||
position: "absolute",
|
|
||||||
content: `""`,
|
|
||||||
width: theme.spacing(2),
|
|
||||||
height: theme.spacing(2),
|
|
||||||
borderRadius: "50%",
|
|
||||||
backgroundColor: theme.palette.primary.contrastTextTertiary,
|
|
||||||
opacity: 0.8,
|
|
||||||
left: theme.spacing(-5),
|
|
||||||
top: "50%",
|
|
||||||
transform: "translateY(-50%)",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("editing")}
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
{!isCreate && (
|
|
||||||
<Box
|
|
||||||
alignSelf="flex-end"
|
|
||||||
ml="auto"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
onClick={handlePause}
|
|
||||||
loading={isBusy}
|
|
||||||
variant="contained"
|
|
||||||
color="secondary"
|
|
||||||
sx={{
|
|
||||||
pl: theme.spacing(4),
|
|
||||||
pr: theme.spacing(6),
|
|
||||||
"& svg": {
|
|
||||||
mr: theme.spacing(2),
|
|
||||||
"& path": {
|
|
||||||
stroke: theme.palette.primary.contrastTextTertiary,
|
|
||||||
strokeWidth: 0.1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{monitor?.isActive ? (
|
|
||||||
<>
|
|
||||||
<PauseCircleOutlineIcon />
|
|
||||||
{t("pause")}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<PlayCircleOutlineRoundedIcon />
|
|
||||||
{t("resume")}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
loading={isBusy}
|
|
||||||
variant="contained"
|
|
||||||
color="error"
|
|
||||||
onClick={() => setIsOpen(true)}
|
|
||||||
sx={{ ml: theme.spacing(6) }}
|
|
||||||
>
|
|
||||||
{t("remove")}
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -343,101 +172,90 @@ const PageSpeedSetup = () => {
|
|||||||
>
|
>
|
||||||
{t("settingsGeneralSettings")}
|
{t("settingsGeneralSettings")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography component="p">
|
<Typography component="p">{t("distributedUptimeCreateSelectURL")}</Typography>
|
||||||
{t("pageSpeedConfigureSettingsDescription")}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
</Box>
|
||||||
<Stack
|
<Stack gap={theme.spacing(15)}>
|
||||||
gap={!isCreate ? theme.spacing(20) : theme.spacing(15)}
|
|
||||||
sx={{
|
|
||||||
".MuiInputBase-root:has(> .Mui-disabled)": {
|
|
||||||
backgroundColor: theme.palette.tertiary.main,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TextInput
|
<TextInput
|
||||||
type={"url"}
|
type={"url"}
|
||||||
name="url"
|
name="url"
|
||||||
id="monitor-url"
|
id="monitor-url"
|
||||||
label={!isCreate ? t("url") : t("urlMonitor")}
|
label="URL to monitor"
|
||||||
startAdornment={isCreate ? <HttpAdornment https={https} /> : undefined}
|
startAdornment={<HttpAdornment https={https} />}
|
||||||
placeholder="random.website.com"
|
placeholder="google.com"
|
||||||
value={monitor.url || ""}
|
value={monitor.url}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={isCreate ? handleBlur : undefined}
|
onBlur={handleBlur}
|
||||||
error={!!errors["url"]}
|
error={errors["url"] ? true : false}
|
||||||
helperText={errors["url"]}
|
helperText={errors["url"]}
|
||||||
disabled={!isCreate}
|
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
type="text"
|
type="text"
|
||||||
id="monitor-name"
|
id="monitor-name"
|
||||||
name="name"
|
name="name"
|
||||||
label={t("monitorDisplayName")}
|
label="Display name"
|
||||||
isOptional={true}
|
isOptional={true}
|
||||||
placeholder="Google"
|
placeholder="Google"
|
||||||
value={monitor.name || ""}
|
value={monitor.name}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={!!errors["name"]}
|
error={errors["name"] ? true : false}
|
||||||
helperText={errors["name"]}
|
helperText={errors["name"]}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</ConfigBox>
|
</ConfigBox>
|
||||||
{isCreate && (
|
<ConfigBox>
|
||||||
<ConfigBox>
|
<Box>
|
||||||
<Box>
|
<Typography
|
||||||
<Typography
|
component="h2"
|
||||||
component="h2"
|
variant="h2"
|
||||||
variant="h2"
|
>
|
||||||
>
|
{t("distributedUptimeCreateChecks")}
|
||||||
{t("distributedUptimeCreateChecks")}
|
</Typography>
|
||||||
</Typography>
|
<Typography component="p">
|
||||||
<Typography component="p">
|
{t("distributedUptimeCreateChecksDescription")}
|
||||||
{t("distributedUptimeCreateChecksDescription")}
|
</Typography>
|
||||||
</Typography>
|
</Box>
|
||||||
</Box>
|
<Stack gap={theme.spacing(12)}>
|
||||||
<Stack gap={theme.spacing(12)}>
|
<Stack gap={theme.spacing(6)}>
|
||||||
<Stack gap={theme.spacing(6)}>
|
<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"}
|
/>
|
||||||
/>
|
<ButtonGroup sx={{ ml: "32px" }}>
|
||||||
<ButtonGroup sx={{ ml: "32px" }}>
|
<Button
|
||||||
<Button
|
variant="group"
|
||||||
variant="group"
|
filled={https.toString()}
|
||||||
filled={https.toString()}
|
onClick={() => setHttps(true)}
|
||||||
onClick={() => setHttps(true)}
|
>
|
||||||
>
|
{t("https")}
|
||||||
{t("https")}
|
</Button>
|
||||||
</Button>
|
<Button
|
||||||
<Button
|
variant="group" // Why does this work?
|
||||||
variant="group" // Why does this work?
|
filled={(!https).toString()} // There's nothing in the docs about this either
|
||||||
filled={(!https).toString()} // There's nothing in the docs about this either
|
onClick={() => setHttps(false)}
|
||||||
onClick={() => setHttps(false)}
|
>
|
||||||
>
|
{t("http")}
|
||||||
{t("http")}
|
</Button>
|
||||||
</Button>
|
</ButtonGroup>
|
||||||
</ButtonGroup>
|
|
||||||
</Stack>
|
|
||||||
{errors["type"] ? (
|
|
||||||
<Box>
|
|
||||||
<Typography
|
|
||||||
component="p"
|
|
||||||
color={theme.palette.error.contrastText}
|
|
||||||
>
|
|
||||||
{errors["type"]}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</ConfigBox>
|
{errors["type"] ? (
|
||||||
)}
|
<Box className="error-container">
|
||||||
|
<Typography
|
||||||
|
component="p"
|
||||||
|
className="input-error"
|
||||||
|
color={theme.palette.error.contrastText}
|
||||||
|
>
|
||||||
|
{errors["type"]}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -451,7 +269,6 @@ const PageSpeedSetup = () => {
|
|||||||
<NotificationsConfig
|
<NotificationsConfig
|
||||||
notifications={notifications}
|
notifications={notifications}
|
||||||
setMonitor={setMonitor}
|
setMonitor={setMonitor}
|
||||||
setNotifications={isCreate ? undefined : monitor.notifications}
|
|
||||||
/>
|
/>
|
||||||
</ConfigBox>
|
</ConfigBox>
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
@@ -463,47 +280,33 @@ const PageSpeedSetup = () => {
|
|||||||
{t("distributedUptimeCreateAdvancedSettings")}
|
{t("distributedUptimeCreateAdvancedSettings")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Stack gap={theme.spacing(isCreate ? 12 : 20)}>
|
<Stack gap={theme.spacing(12)}>
|
||||||
<Select
|
<Select
|
||||||
id="monitor-interval"
|
id="monitor-interval"
|
||||||
name="interval"
|
name="interval"
|
||||||
label={t("checkFrequency")}
|
label="Check frequency"
|
||||||
value={monitor?.interval / MS_PER_MINUTE || 3}
|
value={monitor.interval || 3}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
items={FREQUENCIES}
|
items={SELECT_VALUES}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</ConfigBox>
|
</ConfigBox>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
justifyContent="flex-end"
|
justifyContent="flex-end"
|
||||||
mt={isCreate ? undefined : "auto"}
|
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="accent"
|
color="accent"
|
||||||
loading={isBusy}
|
|
||||||
disabled={!Object.values(errors).every((value) => value === undefined)}
|
disabled={!Object.values(errors).every((value) => value === undefined)}
|
||||||
sx={isCreate ? undefined : { px: theme.spacing(12) }}
|
loading={isCreating}
|
||||||
>
|
>
|
||||||
{isCreate ? t("createMonitor") : t("settingsSave")}
|
{t("createMonitor")}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
{!isCreate && (
|
|
||||||
<Dialog
|
|
||||||
open={isOpen}
|
|
||||||
theme={theme}
|
|
||||||
title={t("deleteDialogTitle")}
|
|
||||||
description={t("deleteDialogDescription")}
|
|
||||||
onCancel={() => setIsOpen(false)}
|
|
||||||
confirmationButtonLabel={t("delete")}
|
|
||||||
onConfirm={handleRemove}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
export default CreatePageSpeed;
|
||||||
export default PageSpeedSetup;
|
|
||||||
@@ -21,7 +21,7 @@ import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
|||||||
import { Stack, Box, Button, Typography } from "@mui/material";
|
import { Stack, Box, Button, Typography } from "@mui/material";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useState, useCallback, useEffect } from "react";
|
import { useState, useCallback } from "react";
|
||||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@@ -146,12 +146,6 @@ const UptimeMonitors = () => {
|
|||||||
monitorUpdateTrigger,
|
monitorUpdateTrigger,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isSearching) {
|
|
||||||
setPage(undefined);
|
|
||||||
}
|
|
||||||
}, [isSearching]);
|
|
||||||
|
|
||||||
const isLoading = monitorsWithSummaryIsLoading || monitorsWithChecksIsLoading;
|
const isLoading = monitorsWithSummaryIsLoading || monitorsWithChecksIsLoading;
|
||||||
if (networkError) {
|
if (networkError) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ import UptimeConfigure from "../Pages/Uptime/Configure";
|
|||||||
|
|
||||||
// PageSpeed
|
// PageSpeed
|
||||||
import PageSpeed from "../Pages/PageSpeed/Monitors";
|
import PageSpeed from "../Pages/PageSpeed/Monitors";
|
||||||
import PageSpeedDetails from "../Pages/PageSpeed/Details";
|
|
||||||
import PageSpeedCreate from "../Pages/PageSpeed/Create";
|
import PageSpeedCreate from "../Pages/PageSpeed/Create";
|
||||||
|
import PageSpeedDetails from "../Pages/PageSpeed/Details";
|
||||||
|
import PageSpeedConfigure from "../Pages/PageSpeed/Configure";
|
||||||
|
|
||||||
// Infrastructure
|
// Infrastructure
|
||||||
import Infrastructure from "../Pages/Infrastructure/Monitors";
|
import Infrastructure from "../Pages/Infrastructure/Monitors";
|
||||||
@@ -106,7 +107,7 @@ const Routes = () => {
|
|||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="pagespeed/configure/:monitorId"
|
path="pagespeed/configure/:monitorId"
|
||||||
element={<PageSpeedCreate />}
|
element={<PageSpeedConfigure />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="infrastructure"
|
path="infrastructure"
|
||||||
|
|||||||
@@ -209,12 +209,7 @@
|
|||||||
"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": {
|
||||||
@@ -510,6 +505,7 @@
|
|||||||
"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",
|
||||||
@@ -526,6 +522,10 @@
|
|||||||
"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",
|
||||||
@@ -614,7 +614,6 @@
|
|||||||
"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": {
|
||||||
@@ -850,15 +849,6 @@
|
|||||||
},
|
},
|
||||||
"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",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { execSync } from "child_process";
|
|||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const env = loadEnv(mode, process.cwd(), "");
|
const env = loadEnv(mode, process.cwd(), "");
|
||||||
let version = 2.3;
|
let version = 2.2;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: "/",
|
base: "/",
|
||||||
|
|||||||
@@ -20,18 +20,17 @@ class CheckRoutes {
|
|||||||
isAllowed(["admin", "superadmin"]),
|
isAllowed(["admin", "superadmin"]),
|
||||||
this.checkController.deleteChecksByTeamId
|
this.checkController.deleteChecksByTeamId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
|
||||||
|
|
||||||
this.router.put(
|
this.router.put(
|
||||||
"/check/:checkId",
|
"/check/:checkId",
|
||||||
verifyTeamAccess(Check, "checkId"),
|
verifyTeamAccess(Check, "checkId"),
|
||||||
this.checkController.ackCheck
|
this.checkController.ackCheck
|
||||||
);
|
);
|
||||||
this.router.put(
|
|
||||||
"/team/ttl",
|
|
||||||
isAllowed(["admin", "superadmin"]),
|
|
||||||
this.checkController.updateChecksTTL
|
|
||||||
);
|
|
||||||
|
|
||||||
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
|
this.router.put("/:path/:monitorId?", this.checkController.ackAllChecks);
|
||||||
|
|
||||||
this.router.post(
|
this.router.post(
|
||||||
"/:monitorId",
|
"/:monitorId",
|
||||||
verifyOwnership(Monitor, "monitorId"),
|
verifyOwnership(Monitor, "monitorId"),
|
||||||
@@ -42,7 +41,12 @@ class CheckRoutes {
|
|||||||
verifyOwnership(Monitor, "monitorId"),
|
verifyOwnership(Monitor, "monitorId"),
|
||||||
this.checkController.deleteChecks
|
this.checkController.deleteChecks
|
||||||
);
|
);
|
||||||
this.router.put("/:path/:monitorId?", this.checkController.ackAllChecks);
|
|
||||||
|
this.router.put(
|
||||||
|
"/team/ttl",
|
||||||
|
isAllowed(["admin", "superadmin"]),
|
||||||
|
this.checkController.updateChecksTTL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRouter() {
|
getRouter() {
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
const SERVICE_NAME = "NotificationService";
|
|
||||||
|
|
||||||
class NotificationService {
|
class NotificationService {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
emailService,
|
emailService,
|
||||||
db,
|
db,
|
||||||
|
|||||||
Reference in new issue
Block a user