Merge remote-tracking branch 'upstream/develop' into feat/be/webhook-integrations
This commit is contained in:
commit
01e73fe5b8
55 files changed
+1367
-291
No files matched your search
Generated
+94
-24
@@ -16,12 +16,13 @@
|
|||||||
"@mui/lab": "6.0.0-beta.26",
|
"@mui/lab": "6.0.0-beta.26",
|
||||||
"@mui/material": "6.4.3",
|
"@mui/material": "6.4.3",
|
||||||
"@mui/x-charts": "^7.5.1",
|
"@mui/x-charts": "^7.5.1",
|
||||||
"@mui/x-data-grid": "7.25.0",
|
"@mui/x-data-grid": "7.26.0",
|
||||||
"@mui/x-date-pickers": "7.25.0",
|
"@mui/x-date-pickers": "7.26.0",
|
||||||
"@reduxjs/toolkit": "2.5.1",
|
"@reduxjs/toolkit": "2.5.1",
|
||||||
"axios": "^1.7.4",
|
"axios": "^1.7.4",
|
||||||
"dayjs": "1.11.13",
|
"dayjs": "1.11.13",
|
||||||
"flag-icons": "7.3.2",
|
"flag-icons": "7.3.2",
|
||||||
|
"i18next": "^24.2.2",
|
||||||
"immutability-helper": "^3.1.1",
|
"immutability-helper": "^3.1.1",
|
||||||
"joi": "17.13.3",
|
"joi": "17.13.3",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-i18next": "^15.4.0",
|
||||||
"react-redux": "9.2.0",
|
"react-redux": "9.2.0",
|
||||||
"react-router": "^6.23.0",
|
"react-router": "^6.23.0",
|
||||||
"react-router-dom": "^6.23.1",
|
"react-router-dom": "^6.23.1",
|
||||||
@@ -1500,15 +1502,15 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@mui/x-charts": {
|
"node_modules/@mui/x-charts": {
|
||||||
"version": "7.25.0",
|
"version": "7.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.25.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.26.0.tgz",
|
||||||
"integrity": "sha512-+DhnojHrVTt8RsTgq8AztzdFpW1kzOgiBdo0Pkl0DyxVdaKELC5QaetFwim9nIxT2zmU/RmiBcOU+qbqmQpFNA==",
|
"integrity": "sha512-fla1pbMuyHhbWeDo6j5Vz8FHULdPnqACqQrXeLXo9p5kuJpcT9m28DQ1E3YmQ6xGD9NuaxiZdOaITT9PA2zMFQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.25.7",
|
"@babel/runtime": "^7.25.7",
|
||||||
"@mui/utils": "^5.16.6 || ^6.0.0",
|
"@mui/utils": "^5.16.6 || ^6.0.0",
|
||||||
"@mui/x-charts-vendor": "7.20.0",
|
"@mui/x-charts-vendor": "7.20.0",
|
||||||
"@mui/x-internals": "7.25.0",
|
"@mui/x-internals": "7.26.0",
|
||||||
"@react-spring/rafz": "^9.7.5",
|
"@react-spring/rafz": "^9.7.5",
|
||||||
"@react-spring/web": "^9.7.5",
|
"@react-spring/web": "^9.7.5",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
@@ -1558,17 +1560,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/x-data-grid": {
|
"node_modules/@mui/x-data-grid": {
|
||||||
"version": "7.25.0",
|
"version": "7.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/x-data-grid/-/x-data-grid-7.25.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/x-data-grid/-/x-data-grid-7.26.0.tgz",
|
||||||
"integrity": "sha512-e9ZLbCgnDiADFiDyXo91ucZFHEMkKBNpwpkaTq5KohzefJfMpMQjTEbJeueSfBG2G1Q1Am2TPeBqrNeReIA7RQ==",
|
"integrity": "sha512-9RNQeT2OL6jBOCE0MSUH11ol3fV5Zs9MkGxUIAGXcy/Fui0rZRNFO1yLmWDZU5yvskiNmUZJHWV/qXh++ZFarA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.25.7",
|
"@babel/runtime": "^7.25.7",
|
||||||
"@mui/utils": "^5.16.6 || ^6.0.0",
|
"@mui/utils": "^5.16.6 || ^6.0.0",
|
||||||
"@mui/x-internals": "7.25.0",
|
"@mui/x-internals": "7.26.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"reselect": "^5.1.1"
|
"reselect": "^5.1.1",
|
||||||
|
"use-sync-external-store": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
@@ -1595,14 +1598,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/x-date-pickers": {
|
"node_modules/@mui/x-date-pickers": {
|
||||||
"version": "7.25.0",
|
"version": "7.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/x-date-pickers/-/x-date-pickers-7.25.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/x-date-pickers/-/x-date-pickers-7.26.0.tgz",
|
||||||
"integrity": "sha512-t62OSFAKwj7KYQ8KcwTuKj6OgDuLQPSe4QUJcKDzD9rEhRIJVRUw2x27gBSdcls4l0PTrba19TghvDxCZprriw==",
|
"integrity": "sha512-bhSDce1b5MBYYlCdHQJBThe10LGTE3D/u53TDQ41+IRj+iiNCun8jivw3DxKhmoBxlB+hVdkcltpTtIGlPjQZQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.25.7",
|
"@babel/runtime": "^7.25.7",
|
||||||
"@mui/utils": "^5.16.6 || ^6.0.0",
|
"@mui/utils": "^5.16.6 || ^6.0.0",
|
||||||
"@mui/x-internals": "7.25.0",
|
"@mui/x-internals": "7.26.0",
|
||||||
"@types/react-transition-group": "^4.4.11",
|
"@types/react-transition-group": "^4.4.11",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
@@ -1661,9 +1664,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/x-internals": {
|
"node_modules/@mui/x-internals": {
|
||||||
"version": "7.25.0",
|
"version": "7.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.25.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.26.0.tgz",
|
||||||
"integrity": "sha512-tBUN54YznAkmtCIRAOl35Kgl0MjFDIjUbzIrbWRgVSIR3QJ8bXnVSkiRBi+P91SZEl9+ZW0rDj+osq7xFJV0kg==",
|
"integrity": "sha512-VxTCYQcZ02d3190pdvys2TDg9pgbvewAVakEopiOgReKAUhLdRlgGJHcOA/eAuGLyK1YIo26A6Ow6ZKlSRLwMg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.25.7",
|
"@babel/runtime": "^7.25.7",
|
||||||
@@ -3823,9 +3826,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-react-refresh": {
|
"node_modules/eslint-plugin-react-refresh": {
|
||||||
"version": "0.4.18",
|
"version": "0.4.19",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.18.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.19.tgz",
|
||||||
"integrity": "sha512-IRGEoFn3OKalm3hjfolEWGqoF/jPqeEYFp+C8B0WMzwGwBMvlRDQd06kghDhF0C61uJ6WfSDhEZE/sAQjduKgw==",
|
"integrity": "sha512-eyy8pcr/YxSYjBoqIFSrlbn9i/xvxUFa8CjzAYo9cFjgGXqq1hyjihcpZvxRLalpaWmueWR81xn7vuKmAFijDQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -4493,6 +4496,44 @@
|
|||||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
|
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/html-parse-stringify": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",
|
||||||
|
"dependencies": {
|
||||||
|
"void-elements": "3.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/i18next": {
|
||||||
|
"version": "24.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.2.tgz",
|
||||||
|
"integrity": "sha512-NE6i86lBCKRYZa5TaUDkU5S4HFgLIEJRLr3Whf2psgaxBleQ2LC1YW1Vc+SCgkAW7VEzndT6al6+CzegSUHcTQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://locize.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://locize.com/i18next.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.23.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"typescript": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ieee754": {
|
"node_modules/ieee754": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
@@ -5740,9 +5781,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "3.4.2",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz",
|
||||||
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
|
"integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -5888,6 +5929,27 @@
|
|||||||
"react": "^18.3.1"
|
"react": "^18.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-i18next": {
|
||||||
|
"version": "15.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.4.0.tgz",
|
||||||
|
"integrity": "sha512-Py6UkX3zV08RTvL6ZANRoBh9sL/ne6rQq79XlkHEdd82cZr2H9usbWpUNVadJntIZP2pu3M2rL1CN+5rQYfYFw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.25.0",
|
||||||
|
"html-parse-stringify": "^3.0.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"i18next": ">= 23.2.3",
|
||||||
|
"react": ">= 16.8.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-native": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "18.3.1",
|
"version": "18.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
||||||
@@ -6936,6 +6998,14 @@
|
|||||||
"vite": ">=2.6.0"
|
"vite": ">=2.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/void-elements": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vt-pbf": {
|
"node_modules/vt-pbf": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz",
|
||||||
|
|||||||
+4
-2
@@ -19,12 +19,13 @@
|
|||||||
"@mui/lab": "6.0.0-beta.26",
|
"@mui/lab": "6.0.0-beta.26",
|
||||||
"@mui/material": "6.4.3",
|
"@mui/material": "6.4.3",
|
||||||
"@mui/x-charts": "^7.5.1",
|
"@mui/x-charts": "^7.5.1",
|
||||||
"@mui/x-data-grid": "7.25.0",
|
"@mui/x-data-grid": "7.26.0",
|
||||||
"@mui/x-date-pickers": "7.25.0",
|
"@mui/x-date-pickers": "7.26.0",
|
||||||
"@reduxjs/toolkit": "2.5.1",
|
"@reduxjs/toolkit": "2.5.1",
|
||||||
"axios": "^1.7.4",
|
"axios": "^1.7.4",
|
||||||
"dayjs": "1.11.13",
|
"dayjs": "1.11.13",
|
||||||
"flag-icons": "7.3.2",
|
"flag-icons": "7.3.2",
|
||||||
|
"i18next": "^24.2.2",
|
||||||
"immutability-helper": "^3.1.1",
|
"immutability-helper": "^3.1.1",
|
||||||
"joi": "17.13.3",
|
"joi": "17.13.3",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-i18next": "^15.4.0",
|
||||||
"react-redux": "9.2.0",
|
"react-redux": "9.2.0",
|
||||||
"react-router": "^6.23.0",
|
"react-router": "^6.23.0",
|
||||||
"react-router-dom": "^6.23.1",
|
"react-router-dom": "^6.23.1",
|
||||||
|
|||||||
@@ -73,9 +73,12 @@ const CustomToolTip = ({ active, payload, label, dateRange }) => {
|
|||||||
component="span"
|
component="span"
|
||||||
sx={{ opacity: 0.8 }}
|
sx={{ opacity: 0.8 }}
|
||||||
>
|
>
|
||||||
Response Time
|
Response time:
|
||||||
</Typography>{" "}
|
</Typography>
|
||||||
<Typography component="span">
|
<Typography
|
||||||
|
ml={theme.spacing(4)}
|
||||||
|
component="span"
|
||||||
|
>
|
||||||
{Math.floor(responseTime)}
|
{Math.floor(responseTime)}
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ const Image = ({
|
|||||||
alt,
|
alt,
|
||||||
width = "auto",
|
width = "auto",
|
||||||
height = "auto",
|
height = "auto",
|
||||||
|
minWidth = "auto",
|
||||||
|
minHeight = "auto",
|
||||||
maxWidth = "auto",
|
maxWidth = "auto",
|
||||||
maxHeight = "auto",
|
maxHeight = "auto",
|
||||||
base64,
|
base64,
|
||||||
|
placeholder,
|
||||||
sx,
|
sx,
|
||||||
}) => {
|
}) => {
|
||||||
if (shouldRender === false) {
|
if (shouldRender === false) {
|
||||||
@@ -28,11 +31,21 @@ const Image = ({
|
|||||||
src = `data:image/png;base64,${base64}`;
|
src = `data:image/png;base64,${base64}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof src === "undefined" &&
|
||||||
|
typeof base64 === "undefined" &&
|
||||||
|
typeof placeholder !== "undefined"
|
||||||
|
) {
|
||||||
|
src = placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
component="img"
|
component="img"
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
|
minWidth={minWidth}
|
||||||
|
minHeight={minHeight}
|
||||||
maxWidth={maxWidth}
|
maxWidth={maxWidth}
|
||||||
maxHeight={maxHeight}
|
maxHeight={maxHeight}
|
||||||
width={width}
|
width={width}
|
||||||
@@ -48,6 +61,8 @@ Image.propTypes = {
|
|||||||
alt: PropTypes.string.isRequired,
|
alt: PropTypes.string.isRequired,
|
||||||
width: PropTypes.string,
|
width: PropTypes.string,
|
||||||
height: PropTypes.string,
|
height: PropTypes.string,
|
||||||
|
minWidth: PropTypes.string,
|
||||||
|
minHeight: PropTypes.string,
|
||||||
maxWidth: PropTypes.string,
|
maxWidth: PropTypes.string,
|
||||||
maxHeight: PropTypes.string,
|
maxHeight: PropTypes.string,
|
||||||
base64: PropTypes.string,
|
base64: PropTypes.string,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ const ImageField = ({ id, src, loading, onChange, error, isRound = true, maxSize
|
|||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
fontSize="inherit"
|
fontSize="inherit"
|
||||||
color={theme.palette.primary.main}
|
color="info"
|
||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
>
|
>
|
||||||
Click to upload
|
Click to upload
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Box, MenuItem, Select, Stack } from "@mui/material";
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import "flag-icons/css/flag-icons.min.css";
|
||||||
|
|
||||||
|
const LanguageSelector = () => {
|
||||||
|
const { i18n } = useTranslation();
|
||||||
|
const theme = useTheme();
|
||||||
|
const [language, setLanguage] = useState(i18n.language || "gb");
|
||||||
|
|
||||||
|
const handleChange = (event) => {
|
||||||
|
const newLang = event.target.value;
|
||||||
|
setLanguage(newLang);
|
||||||
|
i18n.changeLanguage(newLang);
|
||||||
|
};
|
||||||
|
|
||||||
|
// i18n instance'ından mevcut dilleri al
|
||||||
|
const languages = Object.keys(i18n.options.resources || {});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
value={language}
|
||||||
|
onChange={handleChange}
|
||||||
|
size="small"
|
||||||
|
sx={{
|
||||||
|
height: 28,
|
||||||
|
width: 64,
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
color: theme.palette.primary.contrastText,
|
||||||
|
borderRadius: theme.shape.borderRadius,
|
||||||
|
fontSize: 10,
|
||||||
|
"& .MuiOutlinedInput-notchedOutline": {
|
||||||
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
|
borderRadius: theme.shape.borderRadius,
|
||||||
|
},
|
||||||
|
"&:hover .MuiOutlinedInput-notchedOutline": {
|
||||||
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
|
},
|
||||||
|
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
||||||
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
|
},
|
||||||
|
"& .MuiSvgIcon-root": {
|
||||||
|
color: theme.palette.primary.contrastText,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
right: 4,
|
||||||
|
top: "calc(50% - 8px)",
|
||||||
|
},
|
||||||
|
"& .MuiSelect-select": {
|
||||||
|
padding: "2px 20px 2px 8px",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
fontSize: 10,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
MenuProps={{
|
||||||
|
PaperProps: {
|
||||||
|
sx: {
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
borderRadius: theme.shape.borderRadius,
|
||||||
|
marginTop: 1,
|
||||||
|
width: 64,
|
||||||
|
"& .MuiMenuItem-root": {
|
||||||
|
padding: "2px 8px",
|
||||||
|
minHeight: 28,
|
||||||
|
fontSize: 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
anchorOrigin: {
|
||||||
|
vertical: "bottom",
|
||||||
|
horizontal: "left",
|
||||||
|
},
|
||||||
|
transformOrigin: {
|
||||||
|
vertical: "top",
|
||||||
|
horizontal: "left",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{languages.map((lang) => {
|
||||||
|
const flag = lang ? `fi fi-${lang}` : null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
key={lang}
|
||||||
|
value={lang}
|
||||||
|
sx={{
|
||||||
|
color: theme.palette.primary.contrastText,
|
||||||
|
"&:hover": {
|
||||||
|
backgroundColor: theme.palette.primary.lowContrast,
|
||||||
|
},
|
||||||
|
"&.Mui-selected": {
|
||||||
|
backgroundColor: theme.palette.primary.lowContrast,
|
||||||
|
"&:hover": {
|
||||||
|
backgroundColor: theme.palette.primary.lowContrast,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
alignItems="center"
|
||||||
|
ml={0.5}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
width: 16,
|
||||||
|
height: 12,
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
"& img": {
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
objectFit: "cover",
|
||||||
|
borderRadius: 0.5,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{flag && <span className={flag} />}
|
||||||
|
</Box>
|
||||||
|
<Box
|
||||||
|
component="span"
|
||||||
|
sx={{ textTransform: "uppercase", fontSize: 10 }}
|
||||||
|
>
|
||||||
|
{lang}
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Select>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LanguageSelector;
|
||||||
@@ -3,7 +3,12 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import SkeletonLayout from "./skeleton";
|
import SkeletonLayout from "./skeleton";
|
||||||
|
|
||||||
const CreateMonitorHeader = ({ isAdmin, shouldRender = true, path }) => {
|
const CreateMonitorHeader = ({
|
||||||
|
isAdmin,
|
||||||
|
label = "Create new",
|
||||||
|
shouldRender = true,
|
||||||
|
path,
|
||||||
|
}) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
if (!isAdmin) return null;
|
if (!isAdmin) return null;
|
||||||
if (!shouldRender) return <SkeletonLayout />;
|
if (!shouldRender) return <SkeletonLayout />;
|
||||||
@@ -18,7 +23,7 @@ const CreateMonitorHeader = ({ isAdmin, shouldRender = true, path }) => {
|
|||||||
color="accent"
|
color="accent"
|
||||||
onClick={() => navigate(path)}
|
onClick={() => navigate(path)}
|
||||||
>
|
>
|
||||||
Create new
|
{label}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
@@ -30,4 +35,5 @@ CreateMonitorHeader.propTypes = {
|
|||||||
isAdmin: PropTypes.bool.isRequired,
|
isAdmin: PropTypes.bool.isRequired,
|
||||||
shouldRender: PropTypes.bool,
|
shouldRender: PropTypes.bool,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
label: PropTypes.string,
|
||||||
};
|
};
|
||||||
@@ -22,10 +22,7 @@ const useMonitorUtils = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: monitor._id,
|
...monitor,
|
||||||
name: monitor.name,
|
|
||||||
url: monitor.url,
|
|
||||||
title: monitor.name,
|
|
||||||
percentage: uptimePercentage,
|
percentage: uptimePercentage,
|
||||||
percentageColor,
|
percentageColor,
|
||||||
monitor: monitor,
|
monitor: monitor,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Box, Button, Stack, Typography } from "@mui/material";
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the email step of the login process which includes an email field.
|
* Renders the email step of the login process which includes an email field.
|
||||||
@@ -18,6 +19,7 @@ import PropTypes from "prop-types";
|
|||||||
const EmailStep = ({ form, errors, onSubmit, onChange }) => {
|
const EmailStep = ({ form, errors, onSubmit, onChange }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
@@ -33,8 +35,8 @@ const EmailStep = ({ form, errors, onSubmit, onChange }) => {
|
|||||||
position="relative"
|
position="relative"
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Log In</Typography>
|
<Typography component="h1">{t("authLoginTitle")}</Typography>
|
||||||
<Typography>Enter your email address</Typography>
|
<Typography>{t("authLoginEnterEmail")}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
textAlign="left"
|
textAlign="left"
|
||||||
@@ -48,7 +50,7 @@ const EmailStep = ({ form, errors, onSubmit, onChange }) => {
|
|||||||
<TextInput
|
<TextInput
|
||||||
type="email"
|
type="email"
|
||||||
id="login-email-input"
|
id="login-email-input"
|
||||||
label="Email"
|
label={t("email")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="jordan.ellis@domain.com"
|
placeholder="jordan.ellis@domain.com"
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
@@ -77,7 +79,7 @@ const EmailStep = ({ form, errors, onSubmit, onChange }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
{t("continue")}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Box, Typography, useTheme } from "@mui/material";
|
import { Box, Typography, useTheme } from "@mui/material";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const ForgotPasswordLabel = ({ email, errorEmail }) => {
|
const ForgotPasswordLabel = ({ email, errorEmail }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleNavigate = () => {
|
const handleNavigate = () => {
|
||||||
if (email !== "" && !errorEmail) {
|
if (email !== "" && !errorEmail) {
|
||||||
@@ -20,7 +22,7 @@ const ForgotPasswordLabel = ({ email, errorEmail }) => {
|
|||||||
display="inline-block"
|
display="inline-block"
|
||||||
color={theme.palette.primary.main}
|
color={theme.palette.primary.main}
|
||||||
>
|
>
|
||||||
Forgot password?
|
{t("authForgotPasswordTitle")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
@@ -29,15 +31,15 @@ const ForgotPasswordLabel = ({ email, errorEmail }) => {
|
|||||||
sx={{ userSelect: "none" }}
|
sx={{ userSelect: "none" }}
|
||||||
onClick={handleNavigate}
|
onClick={handleNavigate}
|
||||||
>
|
>
|
||||||
Reset password
|
{t("authForgotPasswordResetPassword")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
ForgotPasswordLabel.proptype = {
|
ForgotPasswordLabel.propTypes = {
|
||||||
email: PropTypes.string.isRequired,
|
email: PropTypes.string.isRequired,
|
||||||
emailError: PropTypes.string.isRequired,
|
errorEmail: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ForgotPasswordLabel;
|
export default ForgotPasswordLabel;
|
||||||
@@ -7,7 +7,7 @@ import TextInput from "../../../../Components/Inputs/TextInput";
|
|||||||
import { PasswordEndAdornment } from "../../../../Components/Inputs/TextInput/Adornments";
|
import { PasswordEndAdornment } from "../../../../Components/Inputs/TextInput/Adornments";
|
||||||
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
/**
|
/**
|
||||||
* Renders the password step of the login process, including a password input field.
|
* Renders the password step of the login process, including a password input field.
|
||||||
*
|
*
|
||||||
@@ -23,6 +23,7 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
const authState = useSelector((state) => state.auth);
|
const authState = useSelector((state) => state.auth);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
@@ -38,8 +39,8 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
textAlign="center"
|
textAlign="center"
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Log In</Typography>
|
<Typography component="h1">{t("authLoginTitle")}</Typography>
|
||||||
<Typography>Enter your password</Typography>
|
<Typography>{t("authLoginEnterPassword")}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
component="form"
|
component="form"
|
||||||
@@ -56,7 +57,7 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
<TextInput
|
<TextInput
|
||||||
type="password"
|
type="password"
|
||||||
id="login-password-input"
|
id="login-password-input"
|
||||||
label="Password"
|
label={t("password")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="••••••••••"
|
placeholder="••••••••••"
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
@@ -87,7 +88,7 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<ArrowBackRoundedIcon />
|
||||||
Back
|
{t("commonBack")}{" "}
|
||||||
</Button>
|
</Button>
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -104,7 +105,7 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
{t("continue")}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import EmailStep from "./Components/EmailStep";
|
|||||||
import PasswordStep from "./Components/PasswordStep";
|
import PasswordStep from "./Components/PasswordStep";
|
||||||
import ThemeSwitch from "../../../Components/ThemeSwitch";
|
import ThemeSwitch from "../../../Components/ThemeSwitch";
|
||||||
import ForgotPasswordLabel from "./Components/ForgotPasswordLabel";
|
import ForgotPasswordLabel from "./Components/ForgotPasswordLabel";
|
||||||
|
import LanguageSelector from "../../../Components/LanguageSelector";
|
||||||
|
|
||||||
const DEMO = import.meta.env.VITE_APP_DEMO;
|
const DEMO = import.meta.env.VITE_APP_DEMO;
|
||||||
|
|
||||||
@@ -163,11 +164,26 @@ const Login = () => {
|
|||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
justifyContent="space-between"
|
||||||
px={theme.spacing(12)}
|
px={theme.spacing(12)}
|
||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
>
|
>
|
||||||
<Logo style={{ borderRadius: theme.shape.borderRadius }} />
|
<Stack
|
||||||
<Typography sx={{ userSelect: "none" }}>Checkmate</Typography>
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
gap={theme.spacing(4)}
|
||||||
|
>
|
||||||
|
<Logo style={{ borderRadius: theme.shape.borderRadius }} />
|
||||||
|
<Typography sx={{ userSelect: "none" }}>Checkmate</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
<LanguageSelector />
|
||||||
|
<ThemeSwitch />
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -213,9 +229,6 @@ const Login = () => {
|
|||||||
email={form.email}
|
email={form.email}
|
||||||
errorEmail={errors.email}
|
errorEmail={errors.email}
|
||||||
/>
|
/>
|
||||||
<Box marginX={"auto"}>
|
|
||||||
<ThemeSwitch />
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import Background from "../../../assets/Images/background-grid.svg?react";
|
|||||||
import Logo from "../../../assets/icons/checkmate-icon.svg?react";
|
import Logo from "../../../assets/icons/checkmate-icon.svg?react";
|
||||||
import Mail from "../../../assets/icons/mail.svg?react";
|
import Mail from "../../../assets/icons/mail.svg?react";
|
||||||
import "../index.css";
|
import "../index.css";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
/**
|
/**
|
||||||
* Displays the initial landing page.
|
* Displays the initial landing page.
|
||||||
*
|
*
|
||||||
@@ -26,7 +26,7 @@ import "../index.css";
|
|||||||
*/
|
*/
|
||||||
const LandingPage = ({ isSuperAdmin, onSignup }) => {
|
const LandingPage = ({ isSuperAdmin, onSignup }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack
|
<Stack
|
||||||
@@ -37,7 +37,9 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
|
|||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Sign Up</Typography>
|
<Typography component="h1">Sign Up</Typography>
|
||||||
<Typography>
|
<Typography>
|
||||||
Create your {isSuperAdmin ? "Super admin " : ""}account to get started.
|
{isSuperAdmin
|
||||||
|
? t("authRegisterCreateSuperAdminAccount")
|
||||||
|
: t("authRegisterCreateAccount")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box width="100%">
|
<Box width="100%">
|
||||||
@@ -60,12 +62,12 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Mail />
|
<Mail />
|
||||||
Sign up with Email
|
{t("authRegisterSignUpWithEmail")}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
<Box maxWidth={400}>
|
<Box maxWidth={400}>
|
||||||
<Typography className="tos-p">
|
<Typography className="tos-p">
|
||||||
By signing up, you agree to our{" "}
|
{t("authRegisterBySigningUp")}
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -118,6 +120,7 @@ const Register = ({ isSuperAdmin }) => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { token } = useParams();
|
const { token } = useParams();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
// TODO If possible, change the IDs of these fields to match the backend
|
// TODO If possible, change the IDs of these fields to match the backend
|
||||||
const idMap = {
|
const idMap = {
|
||||||
"register-firstname-input": "firstName",
|
"register-firstname-input": "firstName",
|
||||||
@@ -307,7 +310,7 @@ const Register = ({ isSuperAdmin }) => {
|
|||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
>
|
>
|
||||||
<Logo style={{ borderRadius: theme.shape.borderRadius }} />
|
<Logo style={{ borderRadius: theme.shape.borderRadius }} />
|
||||||
<Typography sx={{ userSelect: "none" }}>Checkmate</Typography>
|
<Typography sx={{ userSelect: "none" }}>{t("commonAppName")}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -367,7 +370,9 @@ const Register = ({ isSuperAdmin }) => {
|
|||||||
textAlign="center"
|
textAlign="center"
|
||||||
p={theme.spacing(12)}
|
p={theme.spacing(12)}
|
||||||
>
|
>
|
||||||
<Typography display="inline-block">Already have an account? —</Typography>
|
<Typography display="inline-block">
|
||||||
|
{t("authRegisterAlreadyHaveAccount")} -
|
||||||
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
ml={theme.spacing(2)}
|
ml={theme.spacing(2)}
|
||||||
@@ -376,7 +381,7 @@ const Register = ({ isSuperAdmin }) => {
|
|||||||
}}
|
}}
|
||||||
sx={{ userSelect: "none", color: theme.palette.primary.main }}
|
sx={{ userSelect: "none", color: theme.palette.primary.main }}
|
||||||
>
|
>
|
||||||
Log In
|
{t("authLoginTitle")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
|||||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||||
import Check from "../../../../Components/Check/Check";
|
import Check from "../../../../Components/Check/Check";
|
||||||
import { useValidatePassword } from "../../hooks/useValidatePassword";
|
import { useValidatePassword } from "../../hooks/useValidatePassword";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
StepThree.propTypes = {
|
StepThree.propTypes = {
|
||||||
onSubmit: PropTypes.func,
|
onSubmit: PropTypes.func,
|
||||||
onBack: PropTypes.func,
|
onBack: PropTypes.func,
|
||||||
@@ -23,6 +23,7 @@ StepThree.propTypes = {
|
|||||||
function StepThree({ onSubmit, onBack }) {
|
function StepThree({ onSubmit, onBack }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
@@ -38,8 +39,8 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
textAlign="center"
|
textAlign="center"
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Sign Up</Typography>
|
<Typography component="h1">{t("signUp")}</Typography>
|
||||||
<Typography>Create your password</Typography>
|
<Typography>{t("createPassword")}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
component="form"
|
component="form"
|
||||||
@@ -63,9 +64,9 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
type="password"
|
type="password"
|
||||||
id="register-password-input"
|
id="register-password-input"
|
||||||
name="password"
|
name="password"
|
||||||
label="Password"
|
label={t("commonPassword")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="Create a password"
|
placeholder={t("createAPassword")}
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
value={form.password}
|
value={form.password}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
@@ -76,9 +77,9 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
type="password"
|
type="password"
|
||||||
id="register-confirm-input"
|
id="register-confirm-input"
|
||||||
name="confirm"
|
name="confirm"
|
||||||
label="Confirm password"
|
label={t("authSetNewPasswordConfirmPassword")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="Confirm your password"
|
placeholder={t("confirmPassword")}
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
value={form.confirm}
|
value={form.confirm}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
@@ -90,33 +91,33 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
mb={{ xs: theme.spacing(6), sm: theme.spacing(8) }}
|
mb={{ xs: theme.spacing(6), sm: theme.spacing(8) }}
|
||||||
>
|
>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must be at least"}
|
noHighlightText={t("authPasswordMustBeAtLeast")}
|
||||||
text={"8 characters long"}
|
text={t("authPasswordCharactersLong")}
|
||||||
variant={feedbacks.length}
|
variant={feedbacks.length}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one special character"}
|
text={t("authPasswordSpecialCharacter")}
|
||||||
variant={feedbacks.special}
|
variant={feedbacks.special}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one number"}
|
text={t("authPasswordOneNumber")}
|
||||||
variant={feedbacks.number}
|
variant={feedbacks.number}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one upper character"}
|
text={t("authPasswordUpperCharacter")}
|
||||||
variant={feedbacks.uppercase}
|
variant={feedbacks.uppercase}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one lower character"}
|
text={t("authPasswordLowerCharacter")}
|
||||||
variant={feedbacks.lowercase}
|
variant={feedbacks.lowercase}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Confirm password and password"}
|
noHighlightText={t("authPasswordConfirmAndPassword")}
|
||||||
text={"must match"}
|
text={t("authPasswordMustMatch")}
|
||||||
variant={feedbacks.confirm}
|
variant={feedbacks.confirm}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -140,7 +141,7 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<ArrowBackRoundedIcon />
|
||||||
Back
|
{t("commonBack")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -160,7 +161,7 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
{t("continue")}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useTheme } from "@emotion/react";
|
|||||||
import { Box, Button, Stack, Typography } from "@mui/material";
|
import { Box, Button, Stack, Typography } from "@mui/material";
|
||||||
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
StepTwo.propTypes = {
|
StepTwo.propTypes = {
|
||||||
form: PropTypes.object,
|
form: PropTypes.object,
|
||||||
@@ -27,6 +28,7 @@ StepTwo.propTypes = {
|
|||||||
function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
@@ -41,8 +43,8 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
textAlign="center"
|
textAlign="center"
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Sign Up</Typography>
|
<Typography component="h1">{t("signUp")}</Typography>
|
||||||
<Typography>Enter your email address</Typography>
|
<Typography>{t("enterEmail")}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
@@ -58,7 +60,7 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
<TextInput
|
<TextInput
|
||||||
type="email"
|
type="email"
|
||||||
id="register-email-input"
|
id="register-email-input"
|
||||||
label="Email"
|
label={t("commonEmail")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="jordan.ellis@domain.com"
|
placeholder="jordan.ellis@domain.com"
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
@@ -89,7 +91,7 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<ArrowBackRoundedIcon />
|
||||||
Back
|
{t("commonBack")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -105,7 +107,7 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
{t("continue")}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ import Logo from "../../assets/icons/checkmate-icon.svg?react";
|
|||||||
import Background from "../../assets/Images/background-grid.svg?react";
|
import Background from "../../assets/Images/background-grid.svg?react";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
import { useValidatePassword } from "./hooks/useValidatePassword";
|
import { useValidatePassword } from "./hooks/useValidatePassword";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const SetNewPassword = () => {
|
const SetNewPassword = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const passwordId = useId();
|
const passwordId = useId();
|
||||||
const confirmPasswordId = useId();
|
const confirmPasswordId = useId();
|
||||||
@@ -97,7 +99,7 @@ const SetNewPassword = () => {
|
|||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
>
|
>
|
||||||
<Logo style={{ borderRadius: theme.shape.borderRadius }} />
|
<Logo style={{ borderRadius: theme.shape.borderRadius }} />
|
||||||
<Typography sx={{ userSelect: "none" }}>Checkmate</Typography>
|
<Typography sx={{ userSelect: "none" }}>{t("commonAppName")}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -142,10 +144,8 @@ const SetNewPassword = () => {
|
|||||||
<LockIcon alt="lock icon" />
|
<LockIcon alt="lock icon" />
|
||||||
</IconBox>
|
</IconBox>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Typography component="h1">Set new password</Typography>
|
<Typography component="h1">{t("authSetNewPasswordTitle")}</Typography>
|
||||||
<Typography>
|
<Typography>{t("authSetNewPasswordDescription")}</Typography>
|
||||||
Your new password must be different to previously used passwords.
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -166,7 +166,7 @@ const SetNewPassword = () => {
|
|||||||
id={passwordId}
|
id={passwordId}
|
||||||
type="password"
|
type="password"
|
||||||
name="password"
|
name="password"
|
||||||
label="Password"
|
label={t("commonPassword")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="••••••••"
|
placeholder="••••••••"
|
||||||
value={form.password}
|
value={form.password}
|
||||||
@@ -186,7 +186,7 @@ const SetNewPassword = () => {
|
|||||||
id={confirmPasswordId}
|
id={confirmPasswordId}
|
||||||
type="password"
|
type="password"
|
||||||
name="confirm"
|
name="confirm"
|
||||||
label="Confirm password"
|
label={t("authSetNewPasswordConfirmPassword")}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="••••••••"
|
placeholder="••••••••"
|
||||||
value={form.confirm}
|
value={form.confirm}
|
||||||
@@ -201,33 +201,33 @@ const SetNewPassword = () => {
|
|||||||
mb={theme.spacing(12)}
|
mb={theme.spacing(12)}
|
||||||
>
|
>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must be at least"}
|
noHighlightText={t("authPasswordMustBeAtLeast")}
|
||||||
text={"8 characters long"}
|
text={t("authPasswordCharactersLong")}
|
||||||
variant={feedbacks.length}
|
variant={feedbacks.length}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one special character"}
|
text={t("authPasswordSpecialCharacter")}
|
||||||
variant={feedbacks.special}
|
variant={feedbacks.special}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one number"}
|
text={t("authPasswordOneNumber")}
|
||||||
variant={feedbacks.number}
|
variant={feedbacks.number}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one upper character"}
|
text={t("authPasswordUpperCharacter")}
|
||||||
variant={feedbacks.uppercase}
|
variant={feedbacks.uppercase}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Must contain at least"}
|
noHighlightText={t("authPasswordMustContainAtLeast")}
|
||||||
text={"one lower character"}
|
text={t("authPasswordLowerCharacter")}
|
||||||
variant={feedbacks.lowercase}
|
variant={feedbacks.lowercase}
|
||||||
/>
|
/>
|
||||||
<Check
|
<Check
|
||||||
noHighlightText={"Confirm password and password"}
|
noHighlightText={t("authPasswordConfirmAndPassword")}
|
||||||
text={"must match"}
|
text={t("authPasswordMustMatch")}
|
||||||
variant={feedbacks.confirm}
|
variant={feedbacks.confirm}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -244,7 +244,7 @@ const SetNewPassword = () => {
|
|||||||
}
|
}
|
||||||
sx={{ width: "100%", maxWidth: 400 }}
|
sx={{ width: "100%", maxWidth: 400 }}
|
||||||
>
|
>
|
||||||
Reset password
|
{t("authSetNewPasswordResetPassword")}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -252,7 +252,7 @@ const SetNewPassword = () => {
|
|||||||
textAlign="center"
|
textAlign="center"
|
||||||
p={theme.spacing(12)}
|
p={theme.spacing(12)}
|
||||||
>
|
>
|
||||||
<Typography display="inline-block">Go back to —</Typography>
|
<Typography display="inline-block">{t("goBackTo")} —</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
color={theme.palette.primary.main}
|
color={theme.palette.primary.main}
|
||||||
@@ -260,7 +260,7 @@ const SetNewPassword = () => {
|
|||||||
onClick={() => navigate("/login")}
|
onClick={() => navigate("/login")}
|
||||||
sx={{ userSelect: "none" }}
|
sx={{ userSelect: "none" }}
|
||||||
>
|
>
|
||||||
Log In
|
{t("authLoginTitle")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
const VisuallyHiddenInput = ({ onChange }) => {
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
accept="image/*"
|
||||||
|
onChange={onChange}
|
||||||
|
style={{
|
||||||
|
clip: "rect(0 0 0 0)",
|
||||||
|
clipPath: "inset(50%)",
|
||||||
|
height: 1,
|
||||||
|
overflow: "hidden",
|
||||||
|
position: "absolute",
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
width: 1,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default VisuallyHiddenInput;
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
// Components
|
||||||
|
import { Stack, Typography, Button, Box } from "@mui/material";
|
||||||
|
import ConfigBox from "../../../Components/ConfigBox";
|
||||||
|
import Checkbox from "../../../Components/Inputs/Checkbox";
|
||||||
|
import TextInput from "../../../Components/Inputs/TextInput";
|
||||||
|
import VisuallyHiddenInput from "./Components/VisuallyHiddenInput";
|
||||||
|
import Image from "../../../Components/Image";
|
||||||
|
import LogoPlaceholder from "../../../assets/Images/logo_placeholder.svg";
|
||||||
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
|
// Utils
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useCreateStatusPage } from "../../StatusPage/Create/Hooks/useCreateStatusPage";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { statusPageValidation } from "../../../Validation/validation";
|
||||||
|
import { buildErrors } from "../../../Validation/error";
|
||||||
|
import { createToast } from "../../../Utils/toastUtils";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
const CreateStatus = () => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { monitorId } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
const isCreate = location.pathname.startsWith("/distributed-uptime/status/create");
|
||||||
|
const [createStatusPage, isLoading, networkError] = useCreateStatusPage(isCreate);
|
||||||
|
const BREADCRUMBS = [
|
||||||
|
{ name: "distributed uptime", path: "/distributed-uptime" },
|
||||||
|
{ name: "details", path: `/distributed-uptime/${monitorId}` },
|
||||||
|
{ name: "create status page", path: `` },
|
||||||
|
];
|
||||||
|
// Local state
|
||||||
|
const [form, setForm] = useState({
|
||||||
|
isPublished: false,
|
||||||
|
url: Math.floor(Math.random() * 1000000).toFixed(0),
|
||||||
|
logo: undefined,
|
||||||
|
companyName: "",
|
||||||
|
monitors: [monitorId],
|
||||||
|
});
|
||||||
|
const [errors, setErrors] = useState({});
|
||||||
|
|
||||||
|
const handleFormChange = (e) => {
|
||||||
|
const { name, value, checked, type } = e.target;
|
||||||
|
|
||||||
|
// Check for errors
|
||||||
|
const { error } = statusPageValidation.validate(
|
||||||
|
{ [name]: value },
|
||||||
|
{ abortEarly: false }
|
||||||
|
);
|
||||||
|
|
||||||
|
setErrors((prev) => buildErrors(prev, name, error));
|
||||||
|
|
||||||
|
if (type === "checkbox") {
|
||||||
|
setForm({ ...form, [name]: checked });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setForm({ ...form, [name]: value });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleImageUpload = (e) => {
|
||||||
|
const img = e.target?.files?.[0];
|
||||||
|
setForm((prev) => ({
|
||||||
|
...prev,
|
||||||
|
logo: img,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
let logoToSubmit = undefined;
|
||||||
|
|
||||||
|
// Handle image
|
||||||
|
if (typeof form.logo !== "undefined") {
|
||||||
|
logoToSubmit = {
|
||||||
|
src: URL.createObjectURL(form.logo),
|
||||||
|
name: form.logo.name,
|
||||||
|
type: form.logo.type,
|
||||||
|
size: form.logo.size,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const formToSubmit = { ...form };
|
||||||
|
if (typeof logoToSubmit !== "undefined") {
|
||||||
|
formToSubmit.logo = logoToSubmit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
const { error } = statusPageValidation.validate(formToSubmit, { abortEarly: false });
|
||||||
|
if (typeof error === "undefined") {
|
||||||
|
const success = await createStatusPage({ form: formToSubmit });
|
||||||
|
if (success) {
|
||||||
|
createToast({ body: "Status page created successfully" });
|
||||||
|
navigate(`/distributed-uptime/status/${form.url}`);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const newErrors = {};
|
||||||
|
error?.details?.forEach((err) => {
|
||||||
|
newErrors[err.path[0]] = err.message;
|
||||||
|
});
|
||||||
|
setErrors((prev) => ({ ...prev, ...newErrors }));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack gap={theme.spacing(10)}>
|
||||||
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
|
<Typography variant="h1">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
fontSize="inherit"
|
||||||
|
>
|
||||||
|
Create your{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
variant="h2"
|
||||||
|
fontSize="inherit"
|
||||||
|
fontWeight="inherit"
|
||||||
|
>
|
||||||
|
status page
|
||||||
|
</Typography>
|
||||||
|
</Typography>
|
||||||
|
<ConfigBox>
|
||||||
|
<Stack>
|
||||||
|
<Typography component="h2">Access</Typography>
|
||||||
|
<Typography component="p">
|
||||||
|
If your status page is ready, you can mark it as published.
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack gap={theme.spacing(18)}>
|
||||||
|
<Checkbox
|
||||||
|
id="publish"
|
||||||
|
name="isPublished"
|
||||||
|
label={`Published and visible to the public`}
|
||||||
|
isChecked={form.isPublished}
|
||||||
|
onChange={handleFormChange}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
|
<ConfigBox>
|
||||||
|
<Stack gap={theme.spacing(6)}>
|
||||||
|
<Typography component="h2">Basic Information</Typography>
|
||||||
|
<Typography component="p">
|
||||||
|
Define company name and the subdomain that your status page points to.
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack gap={theme.spacing(18)}>
|
||||||
|
<TextInput
|
||||||
|
id="companyName"
|
||||||
|
name="companyName"
|
||||||
|
type="text"
|
||||||
|
label="Company name"
|
||||||
|
placeholder="Company name"
|
||||||
|
value={form.companyName}
|
||||||
|
onChange={handleFormChange}
|
||||||
|
helperText={errors["companyName"]}
|
||||||
|
error={errors["companyName"] ? true : false}
|
||||||
|
/>
|
||||||
|
<TextInput
|
||||||
|
id="url"
|
||||||
|
name="url"
|
||||||
|
type="url"
|
||||||
|
label="Your status page address"
|
||||||
|
value={form.url}
|
||||||
|
onChange={handleFormChange}
|
||||||
|
helperText={errors["url"]}
|
||||||
|
error={errors["url"] ? true : false}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
|
<ConfigBox>
|
||||||
|
<Stack gap={theme.spacing(6)}>
|
||||||
|
<Typography component="h2">Logo</Typography>
|
||||||
|
<Typography component="p">Upload a logo for your status page </Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
gap={theme.spacing(18)}
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
src={form.logo ? URL.createObjectURL(form.logo) : undefined}
|
||||||
|
alt="Logo"
|
||||||
|
minWidth={"300px"}
|
||||||
|
minHeight={"100px"}
|
||||||
|
maxWidth={"300px"}
|
||||||
|
maxHeight={"300px"}
|
||||||
|
placeholder={LogoPlaceholder}
|
||||||
|
/>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
component="label"
|
||||||
|
role={undefined}
|
||||||
|
variant="contained"
|
||||||
|
color="accent"
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
Upload logo
|
||||||
|
<VisuallyHiddenInput onChange={handleImageUpload} />
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="flex-end"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="accent"
|
||||||
|
onClick={handleSubmit}
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CreateStatus;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Stack, Typography, List, ListItem } from "@mui/material";
|
import { Stack, Typography, List, ListItem } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import PulseDot from "../../../../../Components/Animated/PulseDot";
|
import PulseDot from "../../../../../Components/Animated/PulseDot";
|
||||||
import "/node_modules/flag-icons/css/flag-icons.min.css";
|
import "flag-icons/css/flag-icons.min.css";
|
||||||
|
|
||||||
const BASE_BOX_PADDING_VERTICAL = 16;
|
const BASE_BOX_PADDING_VERTICAL = 16;
|
||||||
const BASE_BOX_PADDING_HORIZONTAL = 8;
|
const BASE_BOX_PADDING_HORIZONTAL = 8;
|
||||||
|
|||||||
+1
-2
@@ -6,7 +6,7 @@ import maplibregl from "maplibre-gl";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import buildStyle from "./buildStyle";
|
import buildStyle from "./buildStyle";
|
||||||
|
|
||||||
const DistributedUptimeMap = ({ width = "100%", height = "100%", checks }) => {
|
const DistributedUptimeMap = ({ width = "100%", checks }) => {
|
||||||
const mapContainer = useRef(null);
|
const mapContainer = useRef(null);
|
||||||
const map = useRef(null);
|
const map = useRef(null);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -87,7 +87,6 @@ const DistributedUptimeMap = ({ width = "100%", height = "100%", checks }) => {
|
|||||||
ref={mapContainer}
|
ref={mapContainer}
|
||||||
style={{
|
style={{
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
+122
-119
@@ -24,73 +24,70 @@ const CustomToolTip = ({ active, payload, label }) => {
|
|||||||
? payload[0]?.payload?.originalAvgResponseTime
|
? payload[0]?.payload?.originalAvgResponseTime
|
||||||
: (payload[0]?.payload?.avgResponseTime ?? 0);
|
: (payload[0]?.payload?.avgResponseTime ?? 0);
|
||||||
return (
|
return (
|
||||||
<ChartBox
|
<Box
|
||||||
icon={<ResponseTimeIcon />}
|
className="area-tooltip"
|
||||||
header="Response Times"
|
sx={{
|
||||||
sx={{ padding: 0 }}
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
border: 1,
|
||||||
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
|
borderRadius: theme.shape.borderRadius,
|
||||||
|
py: theme.spacing(2),
|
||||||
|
px: theme.spacing(4),
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Typography
|
||||||
className="area-tooltip"
|
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: theme.palette.background.main,
|
color: theme.palette.text.tertiary,
|
||||||
border: 1,
|
fontSize: 12,
|
||||||
borderColor: theme.palette.primary.lowContrast,
|
fontWeight: 500,
|
||||||
borderRadius: theme.shape.borderRadius,
|
|
||||||
py: theme.spacing(2),
|
|
||||||
px: theme.spacing(4),
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
{formatDateWithTz(label, "ddd, MMMM D, YYYY, h:mm A", uiTimezone)}
|
||||||
|
</Typography>
|
||||||
|
<Box mt={theme.spacing(1)}>
|
||||||
|
<Box
|
||||||
|
display="inline-block"
|
||||||
|
width={theme.spacing(4)}
|
||||||
|
height={theme.spacing(4)}
|
||||||
|
backgroundColor={theme.palette.primary.main}
|
||||||
|
sx={{ borderRadius: "50%" }}
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
display="inline-flex"
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
|
ml={theme.spacing(3)}
|
||||||
sx={{
|
sx={{
|
||||||
color: theme.palette.text.tertiary,
|
"& span": {
|
||||||
fontSize: 12,
|
color: theme.palette.text.tertiary,
|
||||||
fontWeight: 500,
|
fontSize: 11,
|
||||||
|
fontWeight: 500,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{formatDateWithTz(label, "ddd, MMMM D, YYYY, h:mm A", uiTimezone)}
|
<Typography
|
||||||
</Typography>
|
component="span"
|
||||||
<Box mt={theme.spacing(1)}>
|
sx={{ opacity: 0.8 }}
|
||||||
<Box
|
|
||||||
display="inline-block"
|
|
||||||
width={theme.spacing(4)}
|
|
||||||
height={theme.spacing(4)}
|
|
||||||
backgroundColor={theme.palette.primary.main}
|
|
||||||
sx={{ borderRadius: "50%" }}
|
|
||||||
/>
|
|
||||||
<Stack
|
|
||||||
display="inline-flex"
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
ml={theme.spacing(3)}
|
|
||||||
sx={{
|
|
||||||
"& span": {
|
|
||||||
color: theme.palette.text.tertiary,
|
|
||||||
fontSize: 11,
|
|
||||||
fontWeight: 500,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
|
Response time
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
ml={theme.spacing(4)}
|
||||||
|
component="span"
|
||||||
|
>
|
||||||
|
{Math.floor(responseTime)}
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
sx={{ opacity: 0.8 }}
|
sx={{ opacity: 0.8 }}
|
||||||
>
|
>
|
||||||
Response Time
|
{" "}
|
||||||
</Typography>{" "}
|
ms
|
||||||
<Typography component="span">
|
|
||||||
{Math.floor(responseTime)}
|
|
||||||
<Typography
|
|
||||||
component="span"
|
|
||||||
sx={{ opacity: 0.8 }}
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
ms
|
|
||||||
</Typography>
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Typography>
|
||||||
</Box>
|
</Stack>
|
||||||
{/* Display original value */}
|
|
||||||
</Box>
|
</Box>
|
||||||
</ChartBox>
|
{/* Display original value */}
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -143,75 +140,81 @@ const DistributedUptimeResponseChart = ({ checks }) => {
|
|||||||
|
|
||||||
if (checks.length === 0) return null;
|
if (checks.length === 0) return null;
|
||||||
return (
|
return (
|
||||||
<ResponsiveContainer
|
<ChartBox
|
||||||
width="100%"
|
icon={<ResponseTimeIcon />}
|
||||||
minWidth={25}
|
header="Response Times"
|
||||||
height={220}
|
sx={{ padding: 0 }}
|
||||||
>
|
>
|
||||||
<AreaChart
|
<ResponsiveContainer
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
minWidth={25}
|
||||||
data={checks}
|
height={220}
|
||||||
margin={{
|
|
||||||
top: 10,
|
|
||||||
right: 0,
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
}}
|
|
||||||
onMouseMove={() => setIsHovered(true)}
|
|
||||||
onMouseLeave={() => setIsHovered(false)}
|
|
||||||
>
|
>
|
||||||
<CartesianGrid
|
<AreaChart
|
||||||
stroke={theme.palette.primary.lowContrast}
|
width="100%"
|
||||||
strokeWidth={1}
|
height="100%"
|
||||||
strokeOpacity={1}
|
data={checks}
|
||||||
fill="transparent"
|
margin={{
|
||||||
vertical={false}
|
top: 10,
|
||||||
/>
|
right: 0,
|
||||||
<defs>
|
left: 0,
|
||||||
<linearGradient
|
bottom: 0,
|
||||||
id="colorUv"
|
}}
|
||||||
x1="0"
|
onMouseMove={() => setIsHovered(true)}
|
||||||
y1="0"
|
onMouseLeave={() => setIsHovered(false)}
|
||||||
x2="0"
|
>
|
||||||
y2="1"
|
<CartesianGrid
|
||||||
>
|
stroke={theme.palette.primary.lowContrast}
|
||||||
<stop
|
strokeWidth={1}
|
||||||
offset="0%"
|
strokeOpacity={1}
|
||||||
stopColor={theme.palette.accent.darker}
|
fill="transparent"
|
||||||
stopOpacity={0.8}
|
vertical={false}
|
||||||
/>
|
/>
|
||||||
<stop
|
<defs>
|
||||||
offset="100%"
|
<linearGradient
|
||||||
stopColor={theme.palette.accent.main}
|
id="colorUv"
|
||||||
stopOpacity={0}
|
x1="0"
|
||||||
/>
|
y1="0"
|
||||||
</linearGradient>
|
x2="0"
|
||||||
</defs>
|
y2="1"
|
||||||
<XAxis
|
>
|
||||||
stroke={theme.palette.primary.lowContrast}
|
<stop
|
||||||
dataKey="_id"
|
offset="0%"
|
||||||
tick={<CustomTick />}
|
stopColor={theme.palette.accent.darker}
|
||||||
minTickGap={0}
|
stopOpacity={0.8}
|
||||||
axisLine={false}
|
/>
|
||||||
tickLine={false}
|
<stop
|
||||||
height={20}
|
offset="100%"
|
||||||
/>
|
stopColor={theme.palette.accent.main}
|
||||||
<Tooltip
|
stopOpacity={0}
|
||||||
cursor={{ stroke: theme.palette.primary.lowContrast }}
|
/>
|
||||||
content={<CustomToolTip />}
|
</linearGradient>
|
||||||
wrapperStyle={{ pointerEvents: "none" }}
|
</defs>
|
||||||
/>
|
<XAxis
|
||||||
<Area
|
stroke={theme.palette.primary.lowContrast}
|
||||||
type="monotone"
|
dataKey="_id"
|
||||||
dataKey="avgResponseTime"
|
tick={<CustomTick />}
|
||||||
stroke={theme.palette.primary.accent}
|
minTickGap={0}
|
||||||
fill="url(#colorUv)"
|
axisLine={false}
|
||||||
strokeWidth={isHovered ? 2.5 : 1.5}
|
tickLine={false}
|
||||||
activeDot={{ stroke: theme.palette.background.main, r: 5 }}
|
height={20}
|
||||||
/>
|
/>
|
||||||
</AreaChart>
|
<Tooltip
|
||||||
</ResponsiveContainer>
|
cursor={{ stroke: theme.palette.primary.lowContrast }}
|
||||||
|
content={<CustomToolTip />}
|
||||||
|
wrapperStyle={{ pointerEvents: "none" }}
|
||||||
|
/>
|
||||||
|
<Area
|
||||||
|
type="monotone"
|
||||||
|
dataKey="avgResponseTime"
|
||||||
|
stroke={theme.palette.primary.accent}
|
||||||
|
fill="url(#colorUv)"
|
||||||
|
strokeWidth={isHovered ? 2.5 : 1.5}
|
||||||
|
activeDot={{ stroke: theme.palette.background.main, r: 5 }}
|
||||||
|
/>
|
||||||
|
</AreaChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</ChartBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { Stack, Skeleton } from "@mui/material";
|
||||||
|
|
||||||
|
export const SkeletonLayout = () => {
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Skeleton
|
||||||
|
variant="rectangular"
|
||||||
|
height={"90vh"}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SkeletonLayout;
|
||||||
@@ -45,7 +45,7 @@ const getRandomDevice = () => {
|
|||||||
model: randomModel,
|
model: randomModel,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
const useSubscribeToDetails = ({ monitorId, isPublic, isPublished, dateRange }) => {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [connectionStatus, setConnectionStatus] = useState(undefined);
|
const [connectionStatus, setConnectionStatus] = useState(undefined);
|
||||||
const [retryCount, setRetryCount] = useState(0);
|
const [retryCount, setRetryCount] = useState(0);
|
||||||
@@ -58,6 +58,14 @@ const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
|||||||
const prevDateRangeRef = useRef(dateRange);
|
const prevDateRangeRef = useRef(dateRange);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (typeof monitorId === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If this page is public and not published, don't subscribe to details
|
||||||
|
if (isPublic && isPublished === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const cleanup = networkService.subscribeToDistributedUptimeDetails({
|
const cleanup = networkService.subscribeToDistributedUptimeDetails({
|
||||||
authToken,
|
authToken,
|
||||||
@@ -65,6 +73,9 @@ const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
|||||||
dateRange: dateRange,
|
dateRange: dateRange,
|
||||||
normalize: true,
|
normalize: true,
|
||||||
onUpdate: (data) => {
|
onUpdate: (data) => {
|
||||||
|
if (isLoading === true) {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
if (networkError === true) {
|
if (networkError === true) {
|
||||||
setNetworkError(false);
|
setNetworkError(false);
|
||||||
}
|
}
|
||||||
@@ -84,6 +95,7 @@ const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
|||||||
setRetryCount(0); // Reset retry count on successful connection
|
setRetryCount(0); // Reset retry count on successful connection
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
|
setIsLoading(false);
|
||||||
setNetworkError(true);
|
setNetworkError(true);
|
||||||
setConnectionStatus("down");
|
setConnectionStatus("down");
|
||||||
},
|
},
|
||||||
@@ -91,8 +103,6 @@ const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
|||||||
return cleanup;
|
return cleanup;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setNetworkError(true);
|
setNetworkError(true);
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
authToken,
|
authToken,
|
||||||
@@ -102,6 +112,7 @@ const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
|||||||
setConnectionStatus,
|
setConnectionStatus,
|
||||||
networkError,
|
networkError,
|
||||||
devices,
|
devices,
|
||||||
|
isLoading,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -116,4 +127,4 @@ const useSubscribeToDetails = ({ monitorId, dateRange }) => {
|
|||||||
return [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger];
|
return [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useSubscribeToDetails;
|
export { useSubscribeToDetails };
|
||||||
@@ -10,21 +10,23 @@ import StatBoxes from "./Components/StatBoxes";
|
|||||||
import MonitorHeader from "./Components/MonitorHeader";
|
import MonitorHeader from "./Components/MonitorHeader";
|
||||||
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
import GenericFallback from "../../../Components/GenericFallback";
|
||||||
|
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
||||||
|
import SkeletonLayout from "./Components/Skeleton";
|
||||||
//Utils
|
//Utils
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import useSubscribeToDetails from "./Hooks/useSubscribeToDetails";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
|
import { useSubscribeToDetails } from "./Hooks/useSubscribeToDetails";
|
||||||
|
|
||||||
const DistributedUptimeDetails = () => {
|
const DistributedUptimeDetails = () => {
|
||||||
const { monitorId } = useParams();
|
const { monitorId } = useParams();
|
||||||
|
|
||||||
// Local State
|
// Local State
|
||||||
const [dateRange, setDateRange] = useState("day");
|
const [dateRange, setDateRange] = useState("day");
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const isAdmin = useIsAdmin();
|
||||||
const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] =
|
const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] =
|
||||||
useSubscribeToDetails({ monitorId, dateRange });
|
useSubscribeToDetails({ monitorId, dateRange });
|
||||||
// Constants
|
// Constants
|
||||||
@@ -33,6 +35,10 @@ const DistributedUptimeDetails = () => {
|
|||||||
{ name: "Details", path: `/distributed-uptime/${monitorId}` },
|
{ name: "Details", path: `/distributed-uptime/${monitorId}` },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <SkeletonLayout />;
|
||||||
|
}
|
||||||
|
|
||||||
if (networkError) {
|
if (networkError) {
|
||||||
return (
|
return (
|
||||||
<GenericFallback>
|
<GenericFallback>
|
||||||
@@ -65,6 +71,11 @@ const DistributedUptimeDetails = () => {
|
|||||||
gap={theme.spacing(10)}
|
gap={theme.spacing(10)}
|
||||||
>
|
>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
|
<MonitorCreateHeader
|
||||||
|
label="Create status page"
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
path={`/distributed-uptime/status/create/${monitorId}`}
|
||||||
|
/>
|
||||||
<MonitorHeader monitor={monitor} />
|
<MonitorHeader monitor={monitor} />
|
||||||
<StatBoxes
|
<StatBoxes
|
||||||
monitor={monitor}
|
monitor={monitor}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const MonitorTable = ({ isLoading, monitors }) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
onRowClick: (row) => {
|
onRowClick: (row) => {
|
||||||
navigate(`/distributed-uptime/${row.id}`);
|
navigate(`/distributed-uptime/${row._id}`);
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { Stack, Skeleton } from "@mui/material";
|
||||||
|
|
||||||
|
export const SkeletonLayout = () => {
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Skeleton
|
||||||
|
variant="rectangular"
|
||||||
|
height={"90vh"}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SkeletonLayout;
|
||||||
@@ -32,6 +32,10 @@ const useSubscribeToMonitors = () => {
|
|||||||
field: null,
|
field: null,
|
||||||
order: null,
|
order: null,
|
||||||
onUpdate: (data) => {
|
onUpdate: (data) => {
|
||||||
|
if (isLoading === true) {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
|
||||||
const res = data.monitors;
|
const res = data.monitors;
|
||||||
const { monitors, filteredMonitors, summary } = res;
|
const { monitors, filteredMonitors, summary } = res;
|
||||||
const mappedMonitors = filteredMonitors.map((monitor) =>
|
const mappedMonitors = filteredMonitors.map((monitor) =>
|
||||||
@@ -41,6 +45,9 @@ const useSubscribeToMonitors = () => {
|
|||||||
setMonitorsSummary(summary);
|
setMonitorsSummary(summary);
|
||||||
setFilteredMonitors(mappedMonitors);
|
setFilteredMonitors(mappedMonitors);
|
||||||
},
|
},
|
||||||
|
onError: () => {
|
||||||
|
setIsLoading(false);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return cleanup;
|
return cleanup;
|
||||||
@@ -49,8 +56,6 @@ const useSubscribeToMonitors = () => {
|
|||||||
body: error.message,
|
body: error.message,
|
||||||
});
|
});
|
||||||
setNetworkError(true);
|
setNetworkError(true);
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
}
|
||||||
}, [authToken, user, getMonitorWithPercentage, theme]);
|
}, [authToken, user, getMonitorWithPercentage, theme]);
|
||||||
return [isLoading, networkError, monitors, monitorsSummary, filteredMonitors];
|
return [isLoading, networkError, monitors, monitorsSummary, filteredMonitors];
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import GenericFallback from "../../../Components/GenericFallback";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
import { useSubscribeToMonitors } from "./Hooks/useSubscribeToMonitors";
|
import { useSubscribeToMonitors } from "./Hooks/useSubscribeToMonitors";
|
||||||
|
import SkeletonLayout from "./Components/Skeleton";
|
||||||
// Constants
|
// Constants
|
||||||
const BREADCRUMBS = [{ name: `Distributed Uptime`, path: "/distributed-uptime" }];
|
const BREADCRUMBS = [{ name: `Distributed Uptime`, path: "/distributed-uptime" }];
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ const DistributedUptimeMonitors = () => {
|
|||||||
const [isLoading, networkError, monitors, monitorsSummary, filteredMonitors] =
|
const [isLoading, networkError, monitors, monitorsSummary, filteredMonitors] =
|
||||||
useSubscribeToMonitors();
|
useSubscribeToMonitors();
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <SkeletonLayout />;
|
||||||
|
}
|
||||||
|
|
||||||
if (networkError) {
|
if (networkError) {
|
||||||
return (
|
return (
|
||||||
<GenericFallback>
|
<GenericFallback>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { Stack, Skeleton } from "@mui/material";
|
||||||
|
|
||||||
|
export const SkeletonLayout = () => {
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Skeleton
|
||||||
|
variant="rectangular"
|
||||||
|
height={"90vh"}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SkeletonLayout;
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { useState, useEffect } from "react";
|
||||||
|
import { networkService } from "../../../../main";
|
||||||
|
import { createToast } from "../../../../Utils/toastUtils";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
const useStatusPageFetchByUrl = ({ url }) => {
|
||||||
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
const [networkError, setNetworkError] = useState(false);
|
||||||
|
const [statusPage, setStatusPage] = useState(undefined);
|
||||||
|
const [monitorId, setMonitorId] = useState(undefined);
|
||||||
|
const [isPublished, setIsPublished] = useState(false);
|
||||||
|
const { authToken } = useSelector((state) => state.auth);
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchStatusPageByUrl = async () => {
|
||||||
|
try {
|
||||||
|
const response = await networkService.getStatusPageByUrl({ authToken, url });
|
||||||
|
if (!response?.data?.data) return;
|
||||||
|
const statusPage = response.data.data;
|
||||||
|
setStatusPage(statusPage);
|
||||||
|
setMonitorId(statusPage?.monitors[0]);
|
||||||
|
setIsPublished(statusPage?.isPublished);
|
||||||
|
} catch (error) {
|
||||||
|
setNetworkError(true);
|
||||||
|
createToast({
|
||||||
|
body: error.message,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fetchStatusPageByUrl();
|
||||||
|
}, [authToken, url]);
|
||||||
|
|
||||||
|
return [isLoading, networkError, statusPage, monitorId, isPublished];
|
||||||
|
};
|
||||||
|
|
||||||
|
export { useStatusPageFetchByUrl };
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
//Components
|
||||||
|
import DistributedUptimeMap from "../Details/Components/DistributedUptimeMap";
|
||||||
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
|
import { Stack, Typography } from "@mui/material";
|
||||||
|
import DeviceTicker from "../Details/Components/DeviceTicker";
|
||||||
|
import DistributedUptimeResponseChart from "../Details/Components/DistributedUptimeResponseChart";
|
||||||
|
import NextExpectedCheck from "../Details/Components/NextExpectedCheck";
|
||||||
|
import Footer from "../Details/Components/Footer";
|
||||||
|
import StatBoxes from "../Details/Components/StatBoxes";
|
||||||
|
import ControlsHeader from "../../StatusPage/Status/Components/ControlsHeader";
|
||||||
|
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
||||||
|
import GenericFallback from "../../../Components/GenericFallback";
|
||||||
|
import Dialog from "../../../Components/Dialog";
|
||||||
|
import SkeletonLayout from "./Components/Skeleton";
|
||||||
|
//Utils
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useSubscribeToDetails } from "../Details/Hooks/useSubscribeToDetails";
|
||||||
|
import { useStatusPageFetchByUrl } from "./Hooks/useStatusPageFetchByUrl";
|
||||||
|
import { useStatusPageDelete } from "../../StatusPage/Status/Hooks/useStatusPageDelete";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
const DistributedUptimeStatus = () => {
|
||||||
|
const { url } = useParams();
|
||||||
|
const location = useLocation();
|
||||||
|
const isPublic = location.pathname.startsWith("/distributed-uptime/status/public");
|
||||||
|
|
||||||
|
// Local State
|
||||||
|
const [dateRange, setDateRange] = useState("day");
|
||||||
|
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
|
||||||
|
// Utils
|
||||||
|
const theme = useTheme();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [
|
||||||
|
statusPageIsLoading,
|
||||||
|
statusPageNetworkError,
|
||||||
|
statusPage,
|
||||||
|
monitorId,
|
||||||
|
isPublished,
|
||||||
|
] = useStatusPageFetchByUrl({
|
||||||
|
url,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] =
|
||||||
|
useSubscribeToDetails({ monitorId, dateRange, isPublic, isPublished });
|
||||||
|
|
||||||
|
const [deleteStatusPage, isDeleting] = useStatusPageDelete(() => {
|
||||||
|
navigate("/distributed-uptime");
|
||||||
|
}, url);
|
||||||
|
// Constants
|
||||||
|
const BREADCRUMBS = [
|
||||||
|
{ name: "Distributed Uptime", path: "/distributed-uptime" },
|
||||||
|
{ name: "details", path: `/distributed-uptime/${monitorId}` },
|
||||||
|
{ name: "status", path: `` },
|
||||||
|
];
|
||||||
|
|
||||||
|
let sx = {};
|
||||||
|
if (isPublic) {
|
||||||
|
sx = {
|
||||||
|
paddingTop: "10vh",
|
||||||
|
paddingRight: "10vw",
|
||||||
|
paddingBottom: "10vh",
|
||||||
|
paddingLeft: "10vw",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done loading, a status page doesn't exist
|
||||||
|
if (!statusPageIsLoading && typeof statusPage === "undefined") {
|
||||||
|
return (
|
||||||
|
<Stack sx={sx}>
|
||||||
|
<GenericFallback>
|
||||||
|
<Typography
|
||||||
|
variant="h1"
|
||||||
|
marginY={theme.spacing(4)}
|
||||||
|
color={theme.palette.primary.contrastTextTertiary}
|
||||||
|
>
|
||||||
|
A public status page is not set up.
|
||||||
|
</Typography>
|
||||||
|
<Typography>Please contact to your administrator</Typography>
|
||||||
|
</GenericFallback>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done loading, a status page exists but is not public
|
||||||
|
if (!statusPageIsLoading && statusPage.isPublished === false) {
|
||||||
|
return (
|
||||||
|
<Stack sx={sx}>
|
||||||
|
<GenericFallback>
|
||||||
|
<Typography>This status page is not public.</Typography>
|
||||||
|
</GenericFallback>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLoading || statusPageIsLoading) {
|
||||||
|
return <SkeletonLayout />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (networkError || statusPageNetworkError) {
|
||||||
|
return (
|
||||||
|
<GenericFallback>
|
||||||
|
<Typography
|
||||||
|
variant="h1"
|
||||||
|
marginY={theme.spacing(4)}
|
||||||
|
color={theme.palette.primary.contrastTextTertiary}
|
||||||
|
>
|
||||||
|
Network error
|
||||||
|
</Typography>
|
||||||
|
<Typography>Please check your connection</Typography>
|
||||||
|
</GenericFallback>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof statusPage === "undefined" ||
|
||||||
|
typeof monitor === "undefined" ||
|
||||||
|
monitor.totalChecks === 0
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<Stack gap={theme.spacing(10)}>
|
||||||
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
|
<GenericFallback>
|
||||||
|
<Typography>There is no check history for this monitor yet.</Typography>
|
||||||
|
</GenericFallback>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="column"
|
||||||
|
gap={theme.spacing(10)}
|
||||||
|
sx={sx}
|
||||||
|
>
|
||||||
|
{!isPublic && <Breadcrumbs list={BREADCRUMBS} />}
|
||||||
|
<ControlsHeader
|
||||||
|
shouldShow={!isPublic}
|
||||||
|
statusPage={statusPage}
|
||||||
|
isDeleting={isDeleting}
|
||||||
|
isDeleteOpen={isDeleteOpen}
|
||||||
|
setIsDeleteOpen={setIsDeleteOpen}
|
||||||
|
/>
|
||||||
|
<StatBoxes
|
||||||
|
monitor={monitor}
|
||||||
|
lastUpdateTrigger={lastUpdateTrigger}
|
||||||
|
/>
|
||||||
|
<NextExpectedCheck
|
||||||
|
lastUpdateTime={monitor?.timeSinceLastCheck ?? 0}
|
||||||
|
interval={monitor?.interval ?? 0}
|
||||||
|
trigger={lastUpdateTrigger}
|
||||||
|
/>
|
||||||
|
<MonitorTimeFrameHeader
|
||||||
|
dateRange={dateRange}
|
||||||
|
setDateRange={setDateRange}
|
||||||
|
/>
|
||||||
|
<DistributedUptimeResponseChart checks={monitor?.groupedChecks ?? []} />
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.spacing(8)}
|
||||||
|
>
|
||||||
|
<DistributedUptimeMap
|
||||||
|
checks={monitor?.groupedMapChecks ?? []}
|
||||||
|
height={"100%"}
|
||||||
|
width={"100%"}
|
||||||
|
/>
|
||||||
|
<DeviceTicker
|
||||||
|
width={"25vw"}
|
||||||
|
data={monitor?.latestChecks ?? []}
|
||||||
|
connectionStatus={connectionStatus}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Footer />
|
||||||
|
<Dialog
|
||||||
|
// open={isOpen.deleteStats}
|
||||||
|
title="Do you want to delete this status page?"
|
||||||
|
onConfirm={() => {
|
||||||
|
deleteStatusPage();
|
||||||
|
setIsDeleteOpen(false);
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsDeleteOpen(false);
|
||||||
|
}}
|
||||||
|
open={isDeleteOpen}
|
||||||
|
confirmationButtonLabel="Yes, delete status page"
|
||||||
|
description="Once deleted, your status page cannot be retrieved."
|
||||||
|
isLoading={isDeleting || isLoading}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DistributedUptimeStatus;
|
||||||
@@ -126,7 +126,7 @@ const MonitorsTable = ({ shouldRender, monitors, isAdmin, handleActionMenuDelete
|
|||||||
transition: "background-color .3s ease",
|
transition: "background-color .3s ease",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onRowClick: (row) => openDetails(row.id),
|
onRowClick: (row) => openDetails(row._id),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,9 +14,15 @@ const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting }) => {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const currentPath = location.pathname;
|
const currentPath = location.pathname;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
if (currentPath === "/status/public") {
|
if (currentPath === "/status/public") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentPath.startsWith("/distributed-uptime/status/public")) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
@@ -80,7 +86,7 @@ const ControlsHeader = ({ statusPage, isDeleting, isDeleteOpen, setIsDeleteOpen
|
|||||||
<Image
|
<Image
|
||||||
shouldRender={statusPage?.logo?.data ? true : false}
|
shouldRender={statusPage?.logo?.data ? true : false}
|
||||||
alt={"Company logo"}
|
alt={"Company logo"}
|
||||||
maxWidth={"100px"}
|
maxWidth={"300px"}
|
||||||
base64={statusPage?.logo?.data}
|
base64={statusPage?.logo?.data}
|
||||||
/>
|
/>
|
||||||
<Typography variant="h2">{statusPage?.companyName}</Typography>
|
<Typography variant="h2">{statusPage?.companyName}</Typography>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const MonitorsList = ({ monitors = [] }) => {
|
|||||||
gap={theme.spacing(20)}
|
gap={theme.spacing(20)}
|
||||||
>
|
>
|
||||||
<Box flex={9}>
|
<Box flex={9}>
|
||||||
<StatusPageBarChart checks={monitor.checks.slice().reverse()} />
|
<StatusPageBarChart checks={monitor?.checks?.slice().reverse()} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box flex={1}>
|
<Box flex={1}>
|
||||||
<StatusLabel
|
<StatusLabel
|
||||||
|
|||||||
@@ -4,15 +4,14 @@ import { networkService } from "../../../../main";
|
|||||||
import { createToast } from "../../../../Utils/toastUtils";
|
import { createToast } from "../../../../Utils/toastUtils";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const useStatusPageDelete = (fetchStatusPage) => {
|
const useStatusPageDelete = (fetchStatusPage, url = "/status/public") => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { authToken } = useSelector((state) => state.auth);
|
const { authToken } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
const deleteStatusPage = async () => {
|
const deleteStatusPage = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
await networkService.deleteStatusPage({ authToken });
|
await networkService.deleteStatusPage({ authToken, url });
|
||||||
fetchStatusPage?.();
|
fetchStatusPage?.();
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ const useStatusPageFetch = (isCreate = false) => {
|
|||||||
const response = await networkService.getStatusPage({ authToken });
|
const response = await networkService.getStatusPage({ authToken });
|
||||||
if (!response?.data?.data) return;
|
if (!response?.data?.data) return;
|
||||||
const { statusPage, monitors } = response.data.data;
|
const { statusPage, monitors } = response.data.data;
|
||||||
|
|
||||||
setStatusPage(statusPage);
|
setStatusPage(statusPage);
|
||||||
|
|
||||||
const monitorsWithPercentage = monitors.map((monitor) =>
|
const monitorsWithPercentage = monitors.map((monitor) =>
|
||||||
getMonitorWithPercentage(monitor, theme)
|
getMonitorWithPercentage(monitor, theme)
|
||||||
);
|
);
|
||||||
|
|
||||||
setMonitors(monitorsWithPercentage);
|
setMonitors(monitorsWithPercentage);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If there is a 404, status page is not found
|
// If there is a 404, status page is not found
|
||||||
@@ -35,7 +37,7 @@ const useStatusPageFetch = (isCreate = false) => {
|
|||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}, [authToken, theme]);
|
}, [authToken, theme, getMonitorWithPercentage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isCreate === true) {
|
if (isCreate === true) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const PublicStatus = () => {
|
|||||||
const currentPath = location.pathname;
|
const currentPath = location.pathname;
|
||||||
let sx = { paddingLeft: theme.spacing(20), paddingRight: theme.spacing(20) };
|
let sx = { paddingLeft: theme.spacing(20), paddingRight: theme.spacing(20) };
|
||||||
let link = undefined;
|
let link = undefined;
|
||||||
|
|
||||||
// Public status page
|
// Public status page
|
||||||
if (currentPath === "/status/public") {
|
if (currentPath === "/status/public") {
|
||||||
sx = {
|
sx = {
|
||||||
@@ -139,7 +140,6 @@ const PublicStatus = () => {
|
|||||||
<MonitorsList monitors={monitors} />
|
<MonitorsList monitors={monitors} />
|
||||||
{link}
|
{link}
|
||||||
<Dialog
|
<Dialog
|
||||||
// open={isOpen.deleteStats}
|
|
||||||
title="Do you want to delete this status page?"
|
title="Do you want to delete this status page?"
|
||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
deleteStatusPage();
|
deleteStatusPage();
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const UptimeDataTable = ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
onRowClick: (row) => {
|
onRowClick: (row) => {
|
||||||
navigate(`/uptime/${row.id}`);
|
navigate(`/uptime/${row._id}`);
|
||||||
},
|
},
|
||||||
emptyView: "No monitors found",
|
emptyView: "No monitors found",
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import InfrastructureDetails from "../Pages/Infrastructure/Details";
|
|||||||
import DistributedUptimeMonitors from "../Pages/DistributedUptime/Monitors";
|
import DistributedUptimeMonitors from "../Pages/DistributedUptime/Monitors";
|
||||||
import CreateDistributedUptime from "../Pages/DistributedUptime/Create";
|
import CreateDistributedUptime from "../Pages/DistributedUptime/Create";
|
||||||
import DistributedUptimeDetails from "../Pages/DistributedUptime/Details";
|
import DistributedUptimeDetails from "../Pages/DistributedUptime/Details";
|
||||||
|
import DistributedUptimeStatus from "../Pages/DistributedUptime/Status";
|
||||||
|
import CreateDistributedUptimeStatus from "../Pages/DistributedUptime/CreateStatus";
|
||||||
|
|
||||||
// Incidents
|
// Incidents
|
||||||
import Incidents from "../Pages/Incidents";
|
import Incidents from "../Pages/Incidents";
|
||||||
@@ -110,6 +112,23 @@ const Routes = () => {
|
|||||||
</ProtectedDistributedUptimeRoute>
|
</ProtectedDistributedUptimeRoute>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/distributed-uptime/status/create/:monitorId"
|
||||||
|
element={
|
||||||
|
<ProtectedDistributedUptimeRoute>
|
||||||
|
<CreateDistributedUptimeStatus />
|
||||||
|
</ProtectedDistributedUptimeRoute>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/distributed-uptime/status/:url"
|
||||||
|
element={
|
||||||
|
<ProtectedDistributedUptimeRoute>
|
||||||
|
<DistributedUptimeStatus />
|
||||||
|
</ProtectedDistributedUptimeRoute>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="pagespeed"
|
path="pagespeed"
|
||||||
element={<PageSpeed />}
|
element={<PageSpeed />}
|
||||||
@@ -223,6 +242,10 @@ const Routes = () => {
|
|||||||
path="/status/public"
|
path="/status/public"
|
||||||
element={<Status />}
|
element={<Status />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/distributed-uptime/status/public/:url"
|
||||||
|
element={<DistributedUptimeStatus />}
|
||||||
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="*"
|
path="*"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import i18next from 'i18next';
|
||||||
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
||||||
const FALLBACK_BASE_URL = "http://localhost:5000/api/v1";
|
const FALLBACK_BASE_URL = "http://localhost:5000/api/v1";
|
||||||
import { clearAuthState } from "../Features/Auth/authSlice";
|
import { clearAuthState } from "../Features/Auth/authSlice";
|
||||||
@@ -23,6 +24,21 @@ class NetworkService {
|
|||||||
}
|
}
|
||||||
this.setBaseUrl(baseURL);
|
this.setBaseUrl(baseURL);
|
||||||
});
|
});
|
||||||
|
this.axiosInstance.interceptors.request.use(
|
||||||
|
(config) => {
|
||||||
|
const currentLanguage = i18next.language || 'en';
|
||||||
|
|
||||||
|
config.headers = {
|
||||||
|
...config.headers,
|
||||||
|
"Accept-Language": currentLanguage,
|
||||||
|
};
|
||||||
|
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
this.axiosInstance.interceptors.response.use(
|
this.axiosInstance.interceptors.response.use(
|
||||||
(response) => response,
|
(response) => response,
|
||||||
(error) => {
|
(error) => {
|
||||||
@@ -974,19 +990,31 @@ class NetworkService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getStatusPageByUrl(config) {
|
||||||
|
const { authToken, url } = config;
|
||||||
|
return this.axiosInstance.get(`/status-page/${url}`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${authToken}`,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async createStatusPage(config) {
|
async createStatusPage(config) {
|
||||||
const { authToken, user, form, isCreate } = config;
|
const { authToken, user, form, isCreate } = config;
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("isPublished", form.isPublished);
|
form.isPublished && fd.append("isPublished", form.isPublished);
|
||||||
fd.append("companyName", form.companyName);
|
form.companyName && fd.append("companyName", form.companyName);
|
||||||
fd.append("url", form.url);
|
form.url && fd.append("url", form.url);
|
||||||
fd.append("timezone", form.timezone);
|
form.timezone && fd.append("timezone", form.timezone);
|
||||||
fd.append("color", form.color);
|
form.color && fd.append("color", form.color);
|
||||||
fd.append("showCharts", form.showCharts);
|
form.showCharts && fd.append("showCharts", form.showCharts);
|
||||||
fd.append("showUptimePercentage", form.showUptimePercentage);
|
form.showUptimePercentage &&
|
||||||
form.monitors.forEach((monitorId) => {
|
fd.append("showUptimePercentage", form.showUptimePercentage);
|
||||||
fd.append("monitors[]", monitorId);
|
form.monitors &&
|
||||||
});
|
form.monitors.forEach((monitorId) => {
|
||||||
|
fd.append("monitors[]", monitorId);
|
||||||
|
});
|
||||||
if (form?.logo?.src && form?.logo?.src !== "") {
|
if (form?.logo?.src && form?.logo?.src !== "") {
|
||||||
const imageResult = await axios.get(form.logo.src, {
|
const imageResult = await axios.get(form.logo.src, {
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
@@ -1013,8 +1041,10 @@ class NetworkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteStatusPage(config) {
|
async deleteStatusPage(config) {
|
||||||
const { authToken } = config;
|
const { authToken, url } = config;
|
||||||
return this.axiosInstance.delete(`/status-page`, {
|
const encodedUrl = encodeURIComponent(url);
|
||||||
|
|
||||||
|
return this.axiosInstance.delete(`/status-page/${encodedUrl}`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${authToken}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -128,6 +128,10 @@ const baseTheme = (palette) => ({
|
|||||||
"&:hover": {
|
"&:hover": {
|
||||||
boxShadow: "none",
|
boxShadow: "none",
|
||||||
},
|
},
|
||||||
|
"&.Mui-disabled": {
|
||||||
|
backgroundColor: theme.palette.secondary.main,
|
||||||
|
color: theme.palette.primary.contrastText,
|
||||||
|
},
|
||||||
"&.MuiLoadingButton-root": {
|
"&.MuiLoadingButton-root": {
|
||||||
"&:disabled": {
|
"&:disabled": {
|
||||||
backgroundColor: theme.palette.secondary.main,
|
backgroundColor: theme.palette.secondary.main,
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import i18n from "i18next";
|
||||||
|
import { initReactI18next } from "react-i18next";
|
||||||
|
|
||||||
|
const primaryLanguage = "gb";
|
||||||
|
|
||||||
|
const translations = import.meta.glob("../locales/*.json", { eager: true });
|
||||||
|
|
||||||
|
const resources = {};
|
||||||
|
Object.keys(translations).forEach((path) => {
|
||||||
|
const langCode = path.match(/\/([^/]+)\.json$/)[1];
|
||||||
|
resources[langCode] = {
|
||||||
|
translation: translations[path].default || translations[path],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const savedLanguage = localStorage.getItem("language") || primaryLanguage;
|
||||||
|
|
||||||
|
i18n.use(initReactI18next).init({
|
||||||
|
resources,
|
||||||
|
lng: savedLanguage,
|
||||||
|
fallbackLng: primaryLanguage,
|
||||||
|
debug: import.meta.env.MODE === "development",
|
||||||
|
ns: ["translation"],
|
||||||
|
defaultNS: "translation",
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
i18n.on("languageChanged", (lng) => {
|
||||||
|
localStorage.setItem("language", lng);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default i18n;
|
||||||
@@ -180,6 +180,8 @@ const imageValidation = joi.object({
|
|||||||
|
|
||||||
const logoImageValidation = joi
|
const logoImageValidation = joi
|
||||||
.object({
|
.object({
|
||||||
|
src: joi.string(),
|
||||||
|
name: joi.string(),
|
||||||
type: joi
|
type: joi
|
||||||
.string()
|
.string()
|
||||||
.valid("image/jpeg", "image/png")
|
.valid("image/jpeg", "image/png")
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="100" viewBox="0 0 300 100">
|
||||||
|
<rect width="100%" height="100%" fill="#DDDDDD" />
|
||||||
|
<path fill="#999999"
|
||||||
|
d="m76.795 37.635-7.38 12.4v7.84h-3.75v-7.84l-7.38-12.4h3.32q.49 0 .78.23.29.24.48.61l3.7 6.76q.32.6.57 1.13.24.53.44 1.07.18-.54.42-1.07.23-.53.54-1.13l3.68-6.76q.16-.31.47-.58.3-.26.78-.26zm7.88 5.65q1.6 0 2.91.52t2.24 1.47 1.43 2.32q.51 1.38.51 3.07 0 1.71-.51 3.08-.5 1.37-1.43 2.34-.93.96-2.24 1.48t-2.91.52q-1.61 0-2.92-.52-1.32-.52-2.25-1.48-.93-.97-1.44-2.34t-.51-3.08q0-1.69.51-3.07.51-1.37 1.44-2.32t2.25-1.47q1.31-.52 2.92-.52m0 12.14q1.8 0 2.66-1.2.86-1.21.86-3.53 0-2.33-.86-3.54-.86-1.22-2.66-1.22-1.82 0-2.69 1.22-.88 1.23-.88 3.54t.88 3.52q.87 1.21 2.69 1.21m18.65-11.91h3.46v14.36h-2.11q-.69 0-.87-.63l-.24-1.15q-.88.9-1.95 1.45-1.06.55-2.5.55-1.18 0-2.08-.4-.9-.39-1.52-1.12t-.93-1.73q-.32-1-.32-2.21v-9.12h3.46v9.12q0 1.32.61 2.04t1.83.72q.89 0 1.68-.4.78-.4 1.48-1.1zm9.93.86.21 1.63q.67-1.29 1.59-2.02.93-.74 2.19-.74.99 0 1.59.43l-.22 2.59q-.07.26-.2.36-.14.11-.36.11-.21 0-.62-.07-.42-.07-.81-.07-.57 0-1.02.16-.45.17-.8.49-.36.31-.63.76-.28.45-.52 1.02v8.85h-3.45v-14.36h2.03q.53 0 .74.18.21.19.28.68m14.24-7.3h3.45v20.8h-3.45zm13.27 6.21q1.59 0 2.9.52t2.24 1.47 1.44 2.32q.5 1.38.5 3.07 0 1.71-.5 3.08-.51 1.37-1.44 2.34-.93.96-2.24 1.48t-2.9.52q-1.61 0-2.93-.52-1.31-.52-2.24-1.48-.94-.97-1.45-2.34t-.51-3.08q0-1.69.51-3.07.51-1.37 1.45-2.32.93-.95 2.24-1.47 1.32-.52 2.93-.52m0 12.14q1.79 0 2.65-1.2.86-1.21.86-3.53 0-2.33-.86-3.54-.86-1.22-2.65-1.22-1.82 0-2.7 1.22-.87 1.23-.87 3.54t.87 3.52q.88 1.21 2.7 1.21m14.98-5.08q.64 0 1.12-.18.47-.17.79-.48.31-.31.48-.74.16-.44.16-.95 0-1.07-.64-1.69t-1.91-.62q-1.28 0-1.91.62-.64.62-.64 1.69 0 .5.16.93.16.44.48.75.31.32.8.49.48.18 1.11.18m3.9 8.17q0-.42-.25-.68-.25-.27-.68-.42-.44-.14-1.02-.21t-1.23-.11l-1.34-.06q-.7-.03-1.36-.11-.57.32-.93.75-.35.44-.35 1.01 0 .38.19.71.18.33.6.57.41.23 1.07.37.66.13 1.61.13.96 0 1.66-.15.7-.14 1.16-.4.45-.26.66-.62t.21-.78m-.68-14.51h4.13v1.28q0 .62-.74.76l-1.29.24q.29.74.29 1.62 0 1.07-.42 1.93-.43.86-1.19 1.46-.75.6-1.78.93t-2.22.33q-.42 0-.81-.04-.4-.04-.77-.11-.68.4-.68.91 0 .43.4.63.4.21 1.06.29t1.5.1q.84.03 1.72.1t1.72.24q.84.18 1.5.55.66.38 1.06 1.03t.4 1.68q0 .95-.47 1.84-.47.9-1.36 1.6t-2.18 1.13q-1.3.42-2.95.42-1.63 0-2.83-.31-1.2-.32-2-.84-.8-.53-1.19-1.21-.39-.69-.39-1.43 0-1.01.61-1.69.6-.68 1.67-1.08-.58-.3-.91-.79-.34-.49-.34-1.28 0-.33.12-.67t.35-.68q.23-.33.58-.64.35-.3.83-.53-1.09-.59-1.72-1.57-.62-.98-.62-2.3 0-1.06.43-1.92.42-.86 1.19-1.47.76-.61 1.8-.93 1.05-.33 2.28-.33.92 0 1.73.19.82.19 1.49.56m12.67-.72q1.59 0 2.9.52t2.24 1.47 1.44 2.32q.5 1.38.5 3.07 0 1.71-.5 3.08-.51 1.37-1.44 2.34-.93.96-2.24 1.48t-2.9.52q-1.61 0-2.93-.52-1.31-.52-2.24-1.48-.94-.97-1.45-2.34t-.51-3.08q0-1.69.51-3.07.51-1.37 1.45-2.32.93-.95 2.24-1.47 1.32-.52 2.93-.52m0 12.14q1.79 0 2.65-1.2.86-1.21.86-3.53 0-2.33-.86-3.54-.86-1.22-2.65-1.22-1.82 0-2.7 1.22-.87 1.23-.87 3.54t.87 3.52q.88 1.21 2.7 1.21m19.99-18.35v7.98q.84-.79 1.85-1.28t2.36-.49q1.18 0 2.09.4t1.52 1.12.92 1.72q.32 1 .32 2.21v9.14h-3.46v-9.14q0-1.32-.6-2.04t-1.84-.72q-.89 0-1.68.41-.78.4-1.48 1.1v10.39h-3.46v-20.8zm15.06 11.97h6.53q0-.68-.19-1.27-.19-.6-.57-1.04-.38-.45-.96-.71t-1.35-.26q-1.5 0-2.36.85-.86.86-1.1 2.43m8.82 2.08h-8.89q.09 1.11.4 1.91.3.81.81 1.33.5.53 1.2.79.69.26 1.53.26t1.45-.2 1.06-.43q.46-.24.8-.44.34-.19.66-.19.44 0 .65.32l.99 1.26q-.57.67-1.29 1.12-.71.46-1.49.73-.77.28-1.58.39-.8.11-1.56.11-1.5 0-2.79-.5-1.28-.49-2.24-1.47-.95-.97-1.49-2.41-.55-1.43-.55-3.32 0-1.47.48-2.77.47-1.29 1.36-2.25t2.17-1.52 2.89-.56q1.36 0 2.51.44 1.15.43 1.97 1.26.83.84 1.3 2.05t.47 2.76q0 .79-.17 1.06t-.65.27m6.46-6.75.21 1.63q.67-1.29 1.59-2.02.93-.74 2.19-.74.99 0 1.59.43l-.22 2.59q-.07.26-.2.36-.14.11-.36.11-.21 0-.62-.07-.42-.07-.81-.07-.57 0-1.02.16-.45.17-.8.49-.36.31-.63.76-.28.45-.52 1.02v8.85h-3.45v-14.36h2.03q.53 0 .74.18.21.19.28.68m10.12 4.67h6.52q0-.68-.18-1.27-.19-.6-.57-1.04-.38-.45-.96-.71t-1.35-.26q-1.5 0-2.36.85-.86.86-1.1 2.43m8.82 2.08h-8.89q.08 1.11.39 1.91.31.81.81 1.33.51.53 1.2.79t1.53.26 1.45-.2 1.07-.43q.45-.24.8-.44.34-.19.66-.19.43 0 .64.32l1 1.26q-.58.67-1.29 1.12-.71.46-1.49.73-.78.28-1.58.39-.81.11-1.56.11-1.5 0-2.79-.5-1.29-.49-2.24-1.47-.95-.97-1.5-2.41-.54-1.43-.54-3.32 0-1.47.47-2.77.48-1.29 1.37-2.25t2.17-1.52 2.89-.56q1.36 0 2.5.44 1.15.43 1.98 1.26.82.84 1.29 2.05t.47 2.76q0 .79-.17 1.06-.16.27-.64.27" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 4.3 KiB |
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"dontHaveAccount": "Don't have account",
|
||||||
|
"email": "E-mail",
|
||||||
|
"forgotPassword": "Forgot Password",
|
||||||
|
"password": "password",
|
||||||
|
"signUp": "Sign up",
|
||||||
|
"submit": "Submit",
|
||||||
|
"title": "Title",
|
||||||
|
"continue": "Continue",
|
||||||
|
"enterEmail": "Enter your email",
|
||||||
|
"authLoginTitle": "Log In",
|
||||||
|
"authLoginEnterPassword": "Enter your password",
|
||||||
|
"commonPassword": "Password",
|
||||||
|
"createPassword": "Create your password",
|
||||||
|
"createAPassword": "Create a password",
|
||||||
|
"commonBack": "Back",
|
||||||
|
"authForgotPasswordTitle": "Forgot password?",
|
||||||
|
"authForgotPasswordResetPassword": "Reset password",
|
||||||
|
"authRegisterAlreadyHaveAccount": "Already have an account?",
|
||||||
|
"commonAppName": "Checkmate",
|
||||||
|
"authLoginEnterEmail": "Enter your email",
|
||||||
|
"authRegisterTitle": "Create an account",
|
||||||
|
"authRegisterStepOneTitle": "Create your account",
|
||||||
|
"authRegisterStepOneDescription": "Enter your details to get started",
|
||||||
|
"authRegisterStepTwoTitle": "Set up your profile",
|
||||||
|
"authRegisterStepTwoDescription": "Tell us more about yourself",
|
||||||
|
"authRegisterStepThreeTitle": "Almost done!",
|
||||||
|
"authRegisterStepThreeDescription": "Review your information",
|
||||||
|
"authForgotPasswordDescription": "No worries, we'll send you reset instructions.",
|
||||||
|
"authForgotPasswordSendInstructions": "Send instructions",
|
||||||
|
"authForgotPasswordBackTo": "Back to",
|
||||||
|
"authCheckEmailTitle": "Check your email",
|
||||||
|
"authCheckEmailDescription": "We sent a password reset link to {{email}}",
|
||||||
|
"authCheckEmailResendEmail": "Resend email",
|
||||||
|
"authCheckEmailBackTo": "Back to",
|
||||||
|
"goBackTo": "Go back to",
|
||||||
|
"authCheckEmailDidntReceiveEmail": "Didn't receive the email?",
|
||||||
|
"authCheckEmailClickToResend": "Click to resend",
|
||||||
|
"authSetNewPasswordTitle": "Set new password",
|
||||||
|
"authSetNewPasswordDescription": "Your new password must be different from previously used passwords.",
|
||||||
|
"authSetNewPasswordNewPassword": "New password",
|
||||||
|
"authSetNewPasswordConfirmPassword": "Confirm password",
|
||||||
|
"confirmPassword": "Confirm your password",
|
||||||
|
"authSetNewPasswordResetPassword": "Reset password",
|
||||||
|
"authSetNewPasswordBackTo": "Back to",
|
||||||
|
"authPasswordMustBeAtLeast": "Must be at least",
|
||||||
|
"authPasswordCharactersLong": "8 characters long",
|
||||||
|
"authPasswordMustContainAtLeast": "Must contain at least",
|
||||||
|
"authPasswordSpecialCharacter": "one special character",
|
||||||
|
"authPasswordOneNumber": "one number",
|
||||||
|
"authPasswordUpperCharacter": "one upper character",
|
||||||
|
"authPasswordLowerCharacter": "one lower character",
|
||||||
|
"authPasswordConfirmAndPassword": "Confirm password and password",
|
||||||
|
"authPasswordMustMatch": "must match",
|
||||||
|
"authRegisterCreateAccount": "Create your account to get started",
|
||||||
|
"authRegisterCreateSuperAdminAccount": "Create your Super admin account to get started",
|
||||||
|
"authRegisterSignUpWithEmail": "Sign up with Email",
|
||||||
|
"authRegisterBySigningUp": "By signing up, you agree to our"
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"dontHaveAccount": "Hesabınız yok mu",
|
||||||
|
"email": "E-posta",
|
||||||
|
"forgotPassword": "Parolamı unuttum",
|
||||||
|
"password": "Parola",
|
||||||
|
"signUp": "Kayıt Ol",
|
||||||
|
"submit": "Gönder",
|
||||||
|
"title": "Başlık",
|
||||||
|
"continue": "Devam Et",
|
||||||
|
"enterEmail": "E-posta adresinizi girin",
|
||||||
|
"authLoginTitle": "Giriş Yap",
|
||||||
|
"authLoginEnterPassword": "Parolanızı girin",
|
||||||
|
"commonPassword": "Parola",
|
||||||
|
"createPassword": "Parolanızı oluşturun",
|
||||||
|
"createAPassword": "Bir parola oluşturun",
|
||||||
|
"commonBack": "Geri",
|
||||||
|
"authForgotPasswordTitle": "Parolanızı mı unuttunuz?",
|
||||||
|
"authForgotPasswordResetPassword": "Parola sıfırla",
|
||||||
|
"authRegisterAlreadyHaveAccount": "Zaten hesabınız var mı?",
|
||||||
|
"commonAppName": "Checkmate",
|
||||||
|
"authLoginEnterEmail": "E-posta adresinizi girin",
|
||||||
|
"authRegisterTitle": "Hesap oluştur",
|
||||||
|
"authRegisterStepOneTitle": "Hesabınızı oluşturun",
|
||||||
|
"authRegisterStepOneDescription": "Başlamak için bilgilerinizi girin",
|
||||||
|
"authRegisterStepTwoTitle": "Profilinizi ayarlayın",
|
||||||
|
"authRegisterStepTwoDescription": "Kendiniz hakkında daha fazla bilgi verin",
|
||||||
|
"authRegisterStepThreeTitle": "Neredeyse bitti!",
|
||||||
|
"authRegisterStepThreeDescription": "Bilgilerinizi gözden geçirin",
|
||||||
|
"authForgotPasswordDescription": "Endişelenmeyin, size sıfırlama talimatlarını göndereceğiz.",
|
||||||
|
"authForgotPasswordSendInstructions": "Talimatları gönder",
|
||||||
|
"authForgotPasswordBackTo": "Geri dön",
|
||||||
|
"authCheckEmailTitle": "E-postanızı kontrol edin",
|
||||||
|
"authCheckEmailDescription": "{{email}} adresine şifre sıfırlama bağlantısı gönderdik",
|
||||||
|
"authCheckEmailResendEmail": "E-postayı yeniden gönder",
|
||||||
|
"authCheckEmailBackTo": "Geri dön",
|
||||||
|
"goBackTo": "Geri dön",
|
||||||
|
"authCheckEmailDidntReceiveEmail": "E-posta almadınız mı?",
|
||||||
|
"authCheckEmailClickToResend": "Yeniden göndermek için tıklayın",
|
||||||
|
"authSetNewPasswordTitle": "Yeni şifre belirle",
|
||||||
|
"authSetNewPasswordDescription": "Yeni şifreniz daha önce kullanılan şifrelerden farklı olmalıdır.",
|
||||||
|
"authSetNewPasswordNewPassword": "Yeni şifre",
|
||||||
|
"authSetNewPasswordConfirmPassword": "Parolayı onayla",
|
||||||
|
"confirmPassword": "Parolanızı onaylayın",
|
||||||
|
"authSetNewPasswordResetPassword": "Parola sıfırla",
|
||||||
|
"authSetNewPasswordBackTo": "Geri dön",
|
||||||
|
"authPasswordMustBeAtLeast": "En az",
|
||||||
|
"authPasswordCharactersLong": "8 karakter uzunluğunda olmalı",
|
||||||
|
"authPasswordMustContainAtLeast": "En az içermeli",
|
||||||
|
"authPasswordSpecialCharacter": "bir özel karakter",
|
||||||
|
"authPasswordOneNumber": "bir rakam",
|
||||||
|
"authPasswordUpperCharacter": "bir büyük harf",
|
||||||
|
"authPasswordLowerCharacter": "bir küçük harf",
|
||||||
|
"authPasswordConfirmAndPassword": "Onay şifresi ve şifre",
|
||||||
|
"authPasswordMustMatch": "eşleşmelidir",
|
||||||
|
"authRegisterCreateAccount": "Hesap oluşturmak için devam et",
|
||||||
|
"authRegisterCreateSuperAdminAccount": "Super admin hesabınızı oluşturmak için devam edin",
|
||||||
|
"authRegisterSignUpWithEmail": "E-posta ile kayıt ol",
|
||||||
|
"authRegisterBySigningUp": "Kayıt olarak, aşağıdaki şartları kabul ediyorsunuz:"
|
||||||
|
}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import App from "./App.jsx";
|
import App from "./App.jsx";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
import "./Utils/i18n";
|
||||||
import { BrowserRouter as Router } from "react-router-dom";
|
import { BrowserRouter as Router } from "react-router-dom";
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import { persistor, store } from "./store";
|
import { persistor, store } from "./store";
|
||||||
@@ -17,7 +18,7 @@ ReactDOM.createRoot(document.getElementById("root")).render(
|
|||||||
>
|
>
|
||||||
<Router>
|
<Router>
|
||||||
<NetworkServiceProvider>
|
<NetworkServiceProvider>
|
||||||
<App />
|
<App />
|
||||||
</NetworkServiceProvider>
|
</NetworkServiceProvider>
|
||||||
</Router>
|
</Router>
|
||||||
</PersistGate>
|
</PersistGate>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { handleError } from "./controllerUtils.js";
|
import { handleError } from "./controllerUtils.js";
|
||||||
import Monitor from "../db/models/Monitor.js";
|
import Monitor from "../db/models/Monitor.js";
|
||||||
import DistributedUptimeCheck from "../db/models/DistributedUptimeCheck.js";
|
import DistributedUptimeCheck from "../db/models/DistributedUptimeCheck.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "DistributedUptimeQueueController";
|
const SERVICE_NAME = "DistributedUptimeQueueController";
|
||||||
|
|
||||||
class DistributedUptimeController {
|
class DistributedUptimeController {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class StatusPageController {
|
|||||||
try {
|
try {
|
||||||
const statusPage = await this.db.getStatusPage();
|
const statusPage = await this.db.getStatusPage();
|
||||||
return res.success({
|
return res.success({
|
||||||
msg: successMessages.STATUS_PAGE_BY_URL,
|
msg: successMessages.STATUS_PAGE,
|
||||||
data: statusPage,
|
data: statusPage,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -70,9 +70,28 @@ class StatusPageController {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getStatusPageByUrl = async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
await getStatusPageParamValidation.validateAsync(req.params);
|
||||||
|
} catch (error) {
|
||||||
|
next(handleValidationError(error, SERVICE_NAME));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const statusPage = await this.db.getStatusPageByUrl(req.params.url);
|
||||||
|
return res.success({
|
||||||
|
msg: successMessages.STATUS_PAGE_BY_URL,
|
||||||
|
data: statusPage,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
next(handleError(error, SERVICE_NAME, "getStatusPageByUrl"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
deleteStatusPage = async (req, res, next) => {
|
deleteStatusPage = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
await this.db.deleteStatusPage();
|
await this.db.deleteStatusPage(req.params.url);
|
||||||
return res.success({
|
return res.success({
|
||||||
msg: successMessages.STATUS_PAGE_DELETE,
|
msg: successMessages.STATUS_PAGE_DELETE,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,12 +15,11 @@ const StatusPageSchema = mongoose.Schema(
|
|||||||
},
|
},
|
||||||
timezone: {
|
timezone: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: false,
|
||||||
default: "America/Toronto",
|
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: false,
|
||||||
default: "#4169E1",
|
default: "#4169E1",
|
||||||
},
|
},
|
||||||
monitors: [
|
monitors: [
|
||||||
|
|||||||
@@ -47,10 +47,21 @@ const updateStatusPage = async (statusPageData, image) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getStatusPageByUrl = async (url) => {
|
||||||
|
try {
|
||||||
|
const statusPage = await StatusPage.aggregate([{ $match: { url } }]);
|
||||||
|
return statusPage[0];
|
||||||
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "getStatusPageByUrl";
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getStatusPage = async () => {
|
const getStatusPage = async () => {
|
||||||
try {
|
try {
|
||||||
const statusPageQuery = await StatusPage.aggregate([
|
const statusPageQuery = await StatusPage.aggregate([
|
||||||
{ $limit: 1 },
|
{ $match: { url: "/status/public" } },
|
||||||
{
|
{
|
||||||
$set: {
|
$set: {
|
||||||
originalMonitors: "$monitors",
|
originalMonitors: "$monitors",
|
||||||
@@ -143,14 +154,20 @@ const getStatusPage = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteStatusPage = async () => {
|
const deleteStatusPage = async (url) => {
|
||||||
try {
|
try {
|
||||||
await StatusPage.deleteOne({});
|
await StatusPage.deleteOne({ url });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error.service = SERVICE_NAME;
|
error.service = SERVICE_NAME;
|
||||||
error.method = "createStatusPage";
|
error.method = "deleteStatusPage";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export { createStatusPage, updateStatusPage, getStatusPage, deleteStatusPage };
|
export {
|
||||||
|
createStatusPage,
|
||||||
|
updateStatusPage,
|
||||||
|
getStatusPage,
|
||||||
|
getStatusPageByUrl,
|
||||||
|
deleteStatusPage,
|
||||||
|
};
|
||||||
Generated
+24
-11
@@ -324,9 +324,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "9.19.0",
|
"version": "9.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.20.0.tgz",
|
||||||
"integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==",
|
"integrity": "sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -3071,18 +3071,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "9.19.0",
|
"version": "9.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.20.0.tgz",
|
||||||
"integrity": "sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==",
|
"integrity": "sha512-aL4F8167Hg4IvsW89ejnpTwx+B/UQRzJPGgbIOl+4XqffWsahVVsLEWoZvnrVuwpWmnRd7XeXmQI1zlKcFDteA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.12.1",
|
"@eslint-community/regexpp": "^4.12.1",
|
||||||
"@eslint/config-array": "^0.19.0",
|
"@eslint/config-array": "^0.19.0",
|
||||||
"@eslint/core": "^0.10.0",
|
"@eslint/core": "^0.11.0",
|
||||||
"@eslint/eslintrc": "^3.2.0",
|
"@eslint/eslintrc": "^3.2.0",
|
||||||
"@eslint/js": "9.19.0",
|
"@eslint/js": "9.20.0",
|
||||||
"@eslint/plugin-kit": "^0.2.5",
|
"@eslint/plugin-kit": "^0.2.5",
|
||||||
"@humanfs/node": "^0.16.6",
|
"@humanfs/node": "^0.16.6",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
@@ -3217,6 +3217,19 @@
|
|||||||
"url": "https://opencollective.com/eslint"
|
"url": "https://opencollective.com/eslint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint/node_modules/@eslint/core": {
|
||||||
|
"version": "0.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.11.0.tgz",
|
||||||
|
"integrity": "sha512-DWUB2pksgNEb6Bz2fggIy1wh6fGgZP4Xyy/Mt0QZPiloKKXerbqq9D3SBQTlCRYOrcRPu4vuz+CGjwdfqxnoWA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/json-schema": "^7.0.15"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint/node_modules/brace-expansion": {
|
"node_modules/eslint/node_modules/brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
@@ -6869,9 +6882,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "3.4.2",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz",
|
||||||
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
|
"integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class StatusPageRoutes {
|
|||||||
|
|
||||||
initRoutes() {
|
initRoutes() {
|
||||||
this.router.get("/", this.statusPageController.getStatusPage);
|
this.router.get("/", this.statusPageController.getStatusPage);
|
||||||
|
this.router.get("/:url", this.statusPageController.getStatusPageByUrl);
|
||||||
this.router.post(
|
this.router.post(
|
||||||
"/",
|
"/",
|
||||||
upload.single("logo"),
|
upload.single("logo"),
|
||||||
@@ -24,7 +25,7 @@ class StatusPageRoutes {
|
|||||||
verifyJWT,
|
verifyJWT,
|
||||||
this.statusPageController.updateStatusPage
|
this.statusPageController.updateStatusPage
|
||||||
);
|
);
|
||||||
this.router.delete("/", verifyJWT, this.statusPageController.deleteStatusPage);
|
this.router.delete("/:url(*)", verifyJWT, this.statusPageController.deleteStatusPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRouter() {
|
getRouter() {
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ const successMessages = {
|
|||||||
|
|
||||||
// Status Page
|
// Status Page
|
||||||
STATUS_PAGE_BY_URL: "Got status page by url successfully",
|
STATUS_PAGE_BY_URL: "Got status page by url successfully",
|
||||||
|
STATUS_PAGE: "Got status page successfully",
|
||||||
STATUS_PAGE_CREATE: "Status page created successfully",
|
STATUS_PAGE_CREATE: "Status page created successfully",
|
||||||
STATUS_PAGE_DELETE: "Status page deleted successfully",
|
STATUS_PAGE_DELETE: "Status page deleted successfully",
|
||||||
STATUS_PAGE_UPDATE: "Status page updated successfully",
|
STATUS_PAGE_UPDATE: "Status page updated successfully",
|
||||||
|
|||||||
@@ -421,8 +421,8 @@ const getStatusPageParamValidation = joi.object({
|
|||||||
const createStatusPageBodyValidation = joi.object({
|
const createStatusPageBodyValidation = joi.object({
|
||||||
companyName: joi.string().required(),
|
companyName: joi.string().required(),
|
||||||
url: joi.string().required(),
|
url: joi.string().required(),
|
||||||
timezone: joi.string().required(),
|
timezone: joi.string().optional(),
|
||||||
color: joi.string().required(),
|
color: joi.string().optional(),
|
||||||
monitors: joi
|
monitors: joi
|
||||||
.array()
|
.array()
|
||||||
.items(joi.string().pattern(/^[0-9a-fA-F]{24}$/))
|
.items(joi.string().pattern(/^[0-9a-fA-F]{24}$/))
|
||||||
@@ -434,7 +434,7 @@ const createStatusPageBodyValidation = joi.object({
|
|||||||
"any.required": "Monitors are required",
|
"any.required": "Monitors are required",
|
||||||
}),
|
}),
|
||||||
isPublished: joi.boolean(),
|
isPublished: joi.boolean(),
|
||||||
showCharts: joi.boolean(),
|
showCharts: joi.boolean().optional(),
|
||||||
showUptimePercentage: joi.boolean(),
|
showUptimePercentage: joi.boolean(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user