Compare commits
349
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea698b6558 | ||
|
|
189293b04d | ||
|
|
13e9185011 | ||
|
|
a7cf78cecc | ||
|
|
0b30e23783 | ||
|
|
1155619835 | ||
|
|
e0608ad3ed | ||
|
|
d665e95f02 | ||
|
|
afc27c804d | ||
|
|
1deb22bf63 | ||
|
|
af8b128ac2 | ||
|
|
00150ba6f4 | ||
|
|
7f04dd5d9a | ||
|
|
ab5389190d | ||
|
|
cba9f43032 | ||
|
|
1cd6e723cc | ||
|
|
f79a87f98a | ||
|
|
a0ea50d745 | ||
|
|
bfa11216f0 | ||
|
|
07a2f36dd7 | ||
|
|
8e44718787 | ||
|
|
83572aa12a | ||
|
|
332a21cd99 | ||
|
|
128d1d12b0 | ||
|
|
f73b07cd3c | ||
|
|
a7d14e0e43 | ||
|
|
6622a990be | ||
|
|
3854931682 | ||
|
|
09534757a2 | ||
|
|
7b2ce0e350 | ||
|
|
19887332c6 | ||
|
|
a1858e8302 | ||
|
|
9fd006cfff | ||
|
|
75a7e144cd | ||
|
|
16cf23baf1 | ||
|
|
8236b02034 | ||
|
|
64242322a2 | ||
|
|
c1e03a45b0 | ||
|
|
f1466df56c | ||
|
|
3654c58469 | ||
|
|
b997c43bd5 | ||
|
|
a5d3c95145 | ||
|
|
003106348a | ||
|
|
c3a41272a3 | ||
|
|
0bff26fe47 | ||
|
|
9169410c1a | ||
|
|
9174e66134 | ||
|
|
04c3c57a59 | ||
|
|
f69b6bbf31 | ||
|
|
05aa1e7112 | ||
|
|
8aead0a00c | ||
|
|
db8ed2994a | ||
|
|
8571ccea78 | ||
|
|
4d273a6dce | ||
|
|
4aabc16096 | ||
|
|
94f9c3d118 | ||
|
|
a719364e40 | ||
|
|
308a439790 | ||
|
|
42a001b24e | ||
|
|
f48fc24b9e | ||
|
|
e3057ad039 | ||
|
|
32f41a3cc4 | ||
|
|
177d6f80d0 | ||
|
|
ecef55f1b3 | ||
|
|
dede689990 | ||
|
|
85edea713a | ||
|
|
7e3da7add7 | ||
|
|
dfeba1e4fb | ||
|
|
0442c8dd0f | ||
|
|
7960f1e82c | ||
|
|
f7f1602423 | ||
|
|
78d1451621 | ||
|
|
a9f005b2c4 | ||
|
|
b68214fc47 | ||
|
|
64c0c93c3e | ||
|
|
40a1f0c6e0 | ||
|
|
1bb2dd323a | ||
|
|
17238c982e | ||
|
|
cc1d63f91a | ||
|
|
ba6e931c59 | ||
|
|
885acf6fe6 | ||
|
|
477c30286d | ||
|
|
88e28b9819 | ||
|
|
e7ba3cb5f9 | ||
|
|
651fbd7cbb | ||
|
|
64fdd04cc7 | ||
|
|
c3e4b5b95f | ||
|
|
10313102ee | ||
|
|
868cbae66f | ||
|
|
2989968fa1 | ||
|
|
89a7fdbe34 | ||
|
|
432d1d8ccf | ||
|
|
5a74411ea2 | ||
|
|
705ecf41c2 | ||
|
|
1d4e9d6806 | ||
|
|
8e37ed7ba2 | ||
|
|
b870f25d1a | ||
|
|
7d3abb3f98 | ||
|
|
9baa6692dd | ||
|
|
dd7dfba1cf | ||
|
|
858aecce62 | ||
|
|
42fdc47d86 | ||
|
|
af8f913e62 | ||
|
|
ea086d6956 | ||
|
|
22b33d789c | ||
|
|
42e7bc1dbf | ||
|
|
13aa600852 | ||
|
|
c06f81ef76 | ||
|
|
c95db26437 | ||
|
|
94a85f8bbb | ||
|
|
05f8e6a07e | ||
|
|
dac78c7647 | ||
|
|
2d023de568 | ||
|
|
f2c88cfd23 | ||
|
|
910c675a49 | ||
|
|
882e91f6a7 | ||
|
|
06be65ec52 | ||
|
|
ea54736a39 | ||
|
|
da38f2ee76 | ||
|
|
83d56f1ff6 | ||
|
|
f94afb63c6 | ||
|
|
673f47983a | ||
|
|
b708e83cce | ||
|
|
288b677781 | ||
|
|
efcf2567b8 | ||
|
|
3763b668ed | ||
|
|
39c6d05196 | ||
|
|
7bf83c12af | ||
|
|
e25669ac6a | ||
|
|
f9653888b1 | ||
|
|
921a1c5145 | ||
|
|
d45e6ec97c | ||
|
|
ef774b44f2 | ||
|
|
8d104ee30a | ||
|
|
fc6300d057 | ||
|
|
73f313e4d5 | ||
|
|
42fe6ade3e | ||
|
|
b78b584844 | ||
|
|
b64cf3f6b6 | ||
|
|
c27bb0e7f1 | ||
|
|
1a52531faf | ||
|
|
0974c84b8d | ||
|
|
600c937062 | ||
|
|
b87fd5438e | ||
|
|
6a04ce5eee | ||
|
|
dae2709d31 | ||
|
|
889bb07946 | ||
|
|
9283890b5f | ||
|
|
f2779160a1 | ||
|
|
216c7753b4 | ||
|
|
a3a25b2add | ||
|
|
b5f2a7b26c | ||
|
|
d4e72ee8a6 | ||
|
|
a59f7fd830 | ||
|
|
d8e7f9fc0f | ||
|
|
cdbf5fd0c0 | ||
|
|
bbb2da3935 | ||
|
|
248482a406 | ||
|
|
1c1474cd6f | ||
|
|
db800e2259 | ||
|
|
b6765830a5 | ||
|
|
8cbde4a705 | ||
|
|
6fcaabbdb6 | ||
|
|
7cfbc85d9b | ||
|
|
ab834d400e | ||
|
|
1fcf06a415 | ||
|
|
dab465b8c5 | ||
|
|
59d245b424 | ||
|
|
e921b20fe3 | ||
|
|
0e6680366d | ||
|
|
7f7a9f40df | ||
|
|
31698bd002 | ||
|
|
c7ccdafec2 | ||
|
|
c920191984 | ||
|
|
374b6aa6ae | ||
|
|
3d5c81fe2f | ||
|
|
3bd6ec5d28 | ||
|
|
7bb47ef432 | ||
|
|
7856317e8f | ||
|
|
edbd8f2abb | ||
|
|
cddf8b32e6 | ||
|
|
0032765bd1 | ||
|
|
6bc9194e8f | ||
|
|
ef15e5d6e0 | ||
|
|
97750da889 | ||
|
|
af8083bdaa | ||
|
|
54b33ec835 | ||
|
|
847904a274 | ||
|
|
7bc03c976b | ||
|
|
73f05ab78e | ||
|
|
584e4633d3 | ||
|
|
433c57b42e | ||
|
|
a2cf2afc09 | ||
|
|
232be7a405 | ||
|
|
7d66bb5668 | ||
|
|
566fded55c | ||
|
|
fbb0e940c6 | ||
|
|
f983863c72 | ||
|
|
e0a75c78db | ||
|
|
2cd2a6d917 | ||
|
|
6f55e4934f | ||
|
|
0e1dc3e3fe | ||
|
|
e18681606c | ||
|
|
d2d75cd035 | ||
|
|
a65515fc08 | ||
|
|
302ac6f4f1 | ||
|
|
b51d40fe77 | ||
|
|
27f3def9bd | ||
|
|
e7a7c0e603 | ||
|
|
55885ea007 | ||
|
|
475801e91c | ||
|
|
cd501e46cd | ||
|
|
93c15588a4 | ||
|
|
a8ecd44abf | ||
|
|
412a3b7cc9 | ||
|
|
be8580ee99 | ||
|
|
8020bfde21 | ||
|
|
7061eb8eb0 | ||
|
|
70ae15725e | ||
|
|
32a7bd6543 | ||
|
|
68db4b8701 | ||
|
|
b75c1a4fcb | ||
|
|
e50240885d | ||
|
|
22645d86f7 | ||
|
|
62778886e1 | ||
|
|
9c467c763d | ||
|
|
97ace1e058 | ||
|
|
2fb6cb0b6f | ||
|
|
a7b0ce4d8f | ||
|
|
4a73170583 | ||
|
|
41310cb552 | ||
|
|
111b68b8df | ||
|
|
2430bbeebb | ||
|
|
f694917dd4 | ||
|
|
47b18e1d9d | ||
|
|
0d863aefe8 | ||
|
|
c319738048 | ||
|
|
002a82bb9a | ||
|
|
8719efab5d | ||
|
|
86fd535eaf | ||
|
|
2f6dbe9a3a | ||
|
|
649eaae712 | ||
|
|
1888ee0478 | ||
|
|
fd2c54d3d3 | ||
|
|
bd941db771 | ||
|
|
88fceddbbf | ||
|
|
13251ca7c5 | ||
|
|
6d6b597f99 | ||
|
|
dfc1733820 | ||
|
|
39a449e594 | ||
|
|
974d33b3de | ||
|
|
afe2b9d3bb | ||
|
|
5ab5cbe622 | ||
|
|
b6b1b8464c | ||
|
|
f337ca5ff0 | ||
|
|
f5bc8e78e4 | ||
|
|
8089e71f96 | ||
|
|
6195650dc1 | ||
|
|
f600647ff0 | ||
|
|
cafea2bf5d | ||
|
|
4e3a82d25f | ||
|
|
33e0136a2a | ||
|
|
b0b7b6a435 | ||
|
|
85dbe34e00 | ||
|
|
f38b305ba7 | ||
|
|
f9c32cb19b | ||
|
|
b540e48aab | ||
|
|
a50c2578e9 | ||
|
|
2e30b622d3 | ||
|
|
f59d8bf1bf | ||
|
|
0941f3ce1a | ||
|
|
3838b18931 | ||
|
|
71cdd05b15 | ||
|
|
4b1c588f5a | ||
|
|
cbd8b5db47 | ||
|
|
94afe19b37 | ||
|
|
d622bce6c1 | ||
|
|
7b658a9e52 | ||
|
|
d296aec02e | ||
|
|
82c8122a5a | ||
|
|
446c791f88 | ||
|
|
e214d9a54c | ||
|
|
6f6920f3b2 | ||
|
|
de447d7be2 | ||
|
|
ee3062fcb4 | ||
|
|
6443802024 | ||
|
|
d88c73bb20 | ||
|
|
10bfdc9da1 | ||
|
|
0503c25663 | ||
|
|
442fc2ce22 | ||
|
|
71f3c90472 | ||
|
|
4c5c2d2d5e | ||
|
|
a390ee5f21 | ||
|
|
0d98353625 | ||
|
|
0e1b074c6c | ||
|
|
a289a197a1 | ||
|
|
0f6c273dad | ||
|
|
1db5f4b70f | ||
|
|
d1d96bd2ba | ||
|
|
7ef10b4fcd | ||
|
|
a2dfbd29c7 | ||
|
|
14ba3016f6 | ||
|
|
ac98f783e3 | ||
|
|
28dc61e1a6 | ||
|
|
a20fdb423a | ||
|
|
1236b9191e | ||
|
|
34762ef475 | ||
|
|
b817a16459 | ||
|
|
2091d8dcd7 | ||
|
|
3d1bd94279 | ||
|
|
07aad0204e | ||
|
|
7c0d45d287 | ||
|
|
06c571d89f | ||
|
|
9b60e32125 | ||
|
|
c681074bb2 | ||
|
|
b47e17fe91 | ||
|
|
28affa1cd1 | ||
|
|
f5372b4d86 | ||
|
|
4db4947220 | ||
|
|
48fb422e0f | ||
|
|
20d4f2c092 | ||
|
|
48081d85ee | ||
|
|
ece6970fa7 | ||
|
|
4434189c72 | ||
|
|
197e075ba1 | ||
|
|
c4ab56095e | ||
|
|
550d5cc555 | ||
|
|
b08e69764c | ||
|
|
08e4b0c39e | ||
|
|
a46e282633 | ||
|
|
8b7fd826b3 | ||
|
|
264e6f7d1f | ||
|
|
fafd581f06 | ||
|
|
d69cec9730 | ||
|
|
1552018796 | ||
|
|
3fc4160b88 | ||
|
|
9ca79ea793 | ||
|
|
2e3b32462f | ||
|
|
7e527b8eb2 | ||
|
|
021b4e8ae5 | ||
|
|
b6004241e7 | ||
|
|
af4c9d8f91 | ||
|
|
f2b740a8f9 | ||
|
|
b26d135a4f | ||
|
|
4f4203dbb3 | ||
|
|
4945b29334 | ||
|
|
1808db5cd7 | ||
|
|
31cc9cd294 | ||
|
|
19b370d89b |
No files matched your search
@@ -107,6 +107,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./docker/dist-arm/server.Dockerfile
|
file: ./docker/dist-arm/server.Dockerfile
|
||||||
push: true
|
push: true
|
||||||
|
no-cache: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:${{ steps.extract_tag.outputs.version }}
|
ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:${{ steps.extract_tag.outputs.version }}
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./docker/dist-arm/server.Dockerfile
|
file: ./docker/dist-arm/server.Dockerfile
|
||||||
push: true
|
push: true
|
||||||
|
no-cache: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:latest
|
ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:latest
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|||||||
+5
-1
@@ -3,4 +3,8 @@
|
|||||||
.VSCodeCounter
|
.VSCodeCounter
|
||||||
*.sh
|
*.sh
|
||||||
mongo
|
mongo
|
||||||
node_modules/
|
node_modules/
|
||||||
|
docs/architecture
|
||||||
|
docs/reviews
|
||||||
|
docs/todo
|
||||||
|
docs/frontend
|
||||||
@@ -42,7 +42,7 @@ Checkmate has been stress-tested with 1000+ active monitors without any particul
|
|||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
You can see the latest build of [Checkmate](https://checkmate-demo.bluewavelabs.ca/) in action. The username is uptimedemo@demo.com and the password is Demouser1! (just a note that we update the demo server from time to time, so if it doesn't work for you, please ping us on the Discussions channel).
|
You can see the latest build of [Checkmate](https://checkmate-demo.bluewavelabs.ca/) in action. The username is demouser@demo.com and the password is Demouser1! (just a note that we update the demo server from time to time, so if it doesn't work for you, please ping us on the Discussions channel).
|
||||||
|
|
||||||
## User's guide
|
## User's guide
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ If you would like to sponsor an additional feature, [see this page](https://chec
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
We are [Alex](http://github.com/ajhollid) (team lead), [Gorkem](http://github.com/gorkem-bwl/), [Owaise](http://github.com/Owaiseimdad), [Aryaman](https://github.com/Br0wnHammer), [Mert](https://github.com/mertssmnoglu) and [Karen](https://github.com/karenvicent) helping individuals and businesses monitor their infra and servers.
|
We are [Alex](http://github.com/ajhollid) (team lead), [Gorkem](http://github.com/gorkem-bwl/), [Aryaman](https://github.com/Br0wnHammer), [Mert](https://github.com/mertssmnoglu) and [Karen](https://github.com/karenvicent) helping individuals and businesses monitor their infra and servers.
|
||||||
|
|
||||||
We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 7000+ stars and attracted 90+ contributors from around the globe.
|
We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 7000+ stars and attracted 90+ contributors from around the globe.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script
|
<script
|
||||||
type="module"
|
type="module"
|
||||||
src="/src/main.jsx"
|
src="/src/main.tsx"
|
||||||
></script>
|
></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Generated
+645
-27
File diff suppressed because it is too large.
Load diff
@@ -25,6 +25,7 @@
|
|||||||
"@mui/x-charts": "7.29.1",
|
"@mui/x-charts": "7.29.1",
|
||||||
"@mui/x-date-pickers": "7.29.4",
|
"@mui/x-date-pickers": "7.29.4",
|
||||||
"@reduxjs/toolkit": "2.7.0",
|
"@reduxjs/toolkit": "2.7.0",
|
||||||
|
"@types/maplibre-gl": "^1.13.2",
|
||||||
"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",
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
"i18next": "25.4.2",
|
"i18next": "25.4.2",
|
||||||
"joi": "17.13.3",
|
"joi": "17.13.3",
|
||||||
"lucide-react": "^0.562.0",
|
"lucide-react": "^0.562.0",
|
||||||
|
"maplibre-gl": "^5.19.0",
|
||||||
"mui-color-input": "^7.0.0",
|
"mui-color-input": "^7.0.0",
|
||||||
"pretty-bytes": "^7.1.0",
|
"pretty-bytes": "^7.1.0",
|
||||||
"pretty-ms": "^9.3.0",
|
"pretty-ms": "^9.3.0",
|
||||||
@@ -41,6 +43,7 @@
|
|||||||
"react-hook-form": "^7.63.0",
|
"react-hook-form": "^7.63.0",
|
||||||
"react-i18next": "^15.4.0",
|
"react-i18next": "^15.4.0",
|
||||||
"react-icons": "5.5.0",
|
"react-icons": "5.5.0",
|
||||||
|
"react-map-gl": "^8.1.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",
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
import { useEffect } from "react";
|
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
import "react-toastify/dist/ReactToastify.css";
|
|
||||||
import { ToastContainer } from "react-toastify";
|
|
||||||
import { ThemeProvider } from "@emotion/react";
|
|
||||||
import lightTheme from "./Utils/Theme/lightTheme";
|
|
||||||
import darkTheme from "./Utils/Theme/darkTheme";
|
|
||||||
import { CssBaseline, GlobalStyles } from "@mui/material";
|
|
||||||
import { logger } from "./Utils/Logger"; // Import the logger
|
|
||||||
import { networkService } from "./main";
|
|
||||||
import { Routes } from "./Routes";
|
|
||||||
import AppLayout from "@/Components/v1/Layouts/AppLayout";
|
|
||||||
|
|
||||||
function App() {
|
|
||||||
const mode = useSelector((state) => state.ui.mode);
|
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
logger.cleanup();
|
|
||||||
networkService.cleanup();
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const theme = mode === "light" ? lightTheme : darkTheme;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ThemeProvider theme={theme}>
|
|
||||||
<CssBaseline />
|
|
||||||
<GlobalStyles
|
|
||||||
styles={{
|
|
||||||
body: {
|
|
||||||
backgroundColor: theme.palette.background.main,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<AppLayout>
|
|
||||||
<Routes />
|
|
||||||
</AppLayout>
|
|
||||||
<ToastContainer
|
|
||||||
newestOnTop={true}
|
|
||||||
theme={mode}
|
|
||||||
style={{
|
|
||||||
"--toastify-color-progress-light": "#7C8BA1",
|
|
||||||
"--toastify-color-progress-dark": "#7C8BA1",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ThemeProvider>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import { type CSSProperties } from "react";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
|
import { ToastContainer } from "react-toastify";
|
||||||
|
import { ThemeProvider } from "@emotion/react";
|
||||||
|
import { CssBaseline, GlobalStyles } from "@mui/material";
|
||||||
|
import { SWRConfig } from "swr";
|
||||||
|
import { Routes } from "./Routes";
|
||||||
|
import AppLayout from "@/Components/layout/AppLayout";
|
||||||
|
import type { RootState } from "@/Types/state";
|
||||||
|
import { lightTheme, darkTheme } from "@/Utils/Theme/Theme";
|
||||||
|
|
||||||
|
const swrConfig = {
|
||||||
|
dedupingInterval: 5000,
|
||||||
|
revalidateOnFocus: false,
|
||||||
|
revalidateOnReconnect: true,
|
||||||
|
shouldRetryOnError: false,
|
||||||
|
errorRetryCount: 2,
|
||||||
|
errorRetryInterval: 1000,
|
||||||
|
focusThrottleInterval: 5000,
|
||||||
|
};
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const mode = useSelector((state: RootState) => state.ui.mode);
|
||||||
|
const theme = mode === "light" ? lightTheme : darkTheme;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SWRConfig value={swrConfig}>
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
|
<CssBaseline />
|
||||||
|
<GlobalStyles
|
||||||
|
styles={{
|
||||||
|
body: {
|
||||||
|
backgroundColor: theme.palette.background.default,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<AppLayout>
|
||||||
|
<Routes />
|
||||||
|
</AppLayout>
|
||||||
|
<ToastContainer
|
||||||
|
newestOnTop={true}
|
||||||
|
theme={mode}
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
"--toastify-color-progress-light": "#7C8BA1",
|
||||||
|
"--toastify-color-progress-dark": "#7C8BA1",
|
||||||
|
} as CSSProperties
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ThemeProvider>
|
||||||
|
</SWRConfig>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
.wallet-adapter-dropdown {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--env-var-spacing-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.wallet-adapter-button {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: auto;
|
|
||||||
height: var(--env-var-height-2) !important;
|
|
||||||
font-size: var(--env-var-font-size-medium-plus) !important;
|
|
||||||
font-weight: 500 !important;
|
|
||||||
margin: 0;
|
|
||||||
padding: calc(
|
|
||||||
(var(--env-var-height-2) - var(--env-var-font-size-medium-plus) * 1.2) / 2
|
|
||||||
)
|
|
||||||
var(--env-var-spacing-1);
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wallet-adapter-modal-title {
|
|
||||||
font-size: var(--font-size-h5) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Separator styling */
|
|
||||||
.wallet-adapter-modal-divider {
|
|
||||||
background-color: var(--border-color) !important;
|
|
||||||
margin: var(--spacing-md) 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responsive fixes */
|
|
||||||
@media (max-width: 1200px) {
|
|
||||||
.wallet-adapter-button {
|
|
||||||
font-size: var(--env-var-font-size-medium) !important;
|
|
||||||
padding: calc((var(--env-var-height-2) - var(--env-var-font-size-medium) * 1.2) / 2)
|
|
||||||
var(--env-var-spacing-1-minus) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.wallet-adapter-modal-wrapper {
|
|
||||||
flex-direction: column !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wallet-adapter-modal-divider {
|
|
||||||
margin: var(--spacing-sm) 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
// import { useMemo } from "react";
|
|
||||||
// import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react";
|
|
||||||
// import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
|
|
||||||
// import {
|
|
||||||
// UnsafeBurnerWalletAdapter,
|
|
||||||
// PhantomWalletAdapter,
|
|
||||||
// } from "@solana/wallet-adapter-wallets";
|
|
||||||
|
|
||||||
// import { WalletModalProvider } from "@solana/wallet-adapter-react-ui";
|
|
||||||
// import { clusterApiUrl } from "@solana/web3.js";
|
|
||||||
// import PropTypes from "prop-types";
|
|
||||||
// import "./index.css";
|
|
||||||
|
|
||||||
// // Default styles that can be overridden by your app
|
|
||||||
// import "@solana/wallet-adapter-react-ui/styles.css";
|
|
||||||
|
|
||||||
// export const Wallet = ({ children }) => {
|
|
||||||
// // The network can be set to 'devnet', 'testnet', or 'mainnet-beta'.
|
|
||||||
// const network = WalletAdapterNetwork.Mainnet;
|
|
||||||
|
|
||||||
// // You can also provide a custom RPC endpoint.
|
|
||||||
// const endpoint = useMemo(() => clusterApiUrl(network), [network]);
|
|
||||||
|
|
||||||
// const wallets = useMemo(
|
|
||||||
// () => [new PhantomWalletAdapter()],
|
|
||||||
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
// [network]
|
|
||||||
// );
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <ConnectionProvider endpoint={endpoint}>
|
|
||||||
// <WalletProvider
|
|
||||||
// wallets={wallets}
|
|
||||||
// autoConnect
|
|
||||||
// >
|
|
||||||
// <WalletModalProvider>{children}</WalletModalProvider>
|
|
||||||
// </WalletProvider>
|
|
||||||
// </ConnectionProvider>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Wallet.propTypes = {
|
|
||||||
// children: PropTypes.node,
|
|
||||||
// };
|
|
||||||
|
|
||||||
const Wallet = ({ children }) => {
|
|
||||||
return children;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Wallet;
|
|
||||||
File renamed without changes.
+1
-1
@@ -2,7 +2,7 @@ import Box from "@mui/material/Box";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { CheckSnapshot } from "@/Types/Check";
|
import type { CheckSnapshot } from "@/Types/Check";
|
||||||
import { getResponseColor } from "@/Utils/DataUtils";
|
import { getResponseColor } from "@/Utils/DataUtils";
|
||||||
import { HeatmapResponseTimeTooltip } from "@/Components/v2/common/charts/HeatmapResponseTimeTooltip";
|
import { HeatmapResponseTimeTooltip } from "@/Components/common/charts/HeatmapResponseTimeTooltip";
|
||||||
import type { SxProps } from "@mui/material/styles";
|
import type { SxProps } from "@mui/material/styles";
|
||||||
import type { ResponsiveStyleValue } from "@mui/system";
|
import type { ResponsiveStyleValue } from "@mui/system";
|
||||||
|
|
||||||
File renamed without changes.
@@ -0,0 +1,155 @@
|
|||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import type { ResponsiveStyleValue } from "@mui/system";
|
||||||
|
import type { CheckSnapshot } from "@/Types/Check";
|
||||||
|
import { HeatmapResponseTimeTooltip } from "./HeatmapResponseTimeTooltip";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
interface HistogramResponseTimeProps {
|
||||||
|
checks: CheckSnapshot[];
|
||||||
|
height?: ResponsiveStyleValue<number | string>;
|
||||||
|
gap?: ResponsiveStyleValue<number | string>;
|
||||||
|
showStats?: boolean;
|
||||||
|
statsPosition?: "left" | "right";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ResponseTimeStats {
|
||||||
|
max: number | string;
|
||||||
|
avg: number | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_HEIGHT = 50;
|
||||||
|
|
||||||
|
const calculateResponseTimeStats = (checks: CheckSnapshot[]): ResponseTimeStats => {
|
||||||
|
if (!Array.isArray(checks) || checks.length === 0) {
|
||||||
|
return { max: "-", avg: "-" };
|
||||||
|
}
|
||||||
|
|
||||||
|
const validChecks = checks.filter((check) => check.originalResponseTime != null);
|
||||||
|
if (validChecks.length === 0) {
|
||||||
|
return { max: "-", avg: "-" };
|
||||||
|
}
|
||||||
|
|
||||||
|
const responseTimes = validChecks.map((check) => check.originalResponseTime);
|
||||||
|
const max = Math.max(...responseTimes);
|
||||||
|
const avg = Math.round(
|
||||||
|
responseTimes.reduce((sum, time) => sum + time, 0) / responseTimes.length
|
||||||
|
);
|
||||||
|
|
||||||
|
return { max, avg };
|
||||||
|
};
|
||||||
|
|
||||||
|
export const HistogramResponseTime = ({
|
||||||
|
checks,
|
||||||
|
height = DEFAULT_HEIGHT,
|
||||||
|
gap,
|
||||||
|
showStats = true,
|
||||||
|
statsPosition = "right",
|
||||||
|
}: HistogramResponseTimeProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const stats = useMemo(() => calculateResponseTimeStats(checks), [checks]);
|
||||||
|
|
||||||
|
if (!Array.isArray(checks) || checks.length === 0) return null;
|
||||||
|
|
||||||
|
const data =
|
||||||
|
checks.length !== 25
|
||||||
|
? [...checks, ...Array(25 - checks.length).fill({ status: "placeholder" })]
|
||||||
|
: checks;
|
||||||
|
|
||||||
|
const chartHeight = typeof height === "number" ? `${height}px` : height;
|
||||||
|
const gridGap = gap ?? theme.spacing(0.5);
|
||||||
|
|
||||||
|
const statsContent = showStats &&
|
||||||
|
(typeof stats.max === "number" || typeof stats.avg === "number") && (
|
||||||
|
<Stack
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems={statsPosition === "left" ? "flex-end" : "flex-start"}
|
||||||
|
minWidth={70}
|
||||||
|
pr={statsPosition === "left" ? theme.spacing(8) : 0}
|
||||||
|
pl={statsPosition === "right" ? theme.spacing(8) : 0}
|
||||||
|
>
|
||||||
|
<Typography variant="body2">
|
||||||
|
{t("common.charts.histogram.avg", { value: stats.avg })}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2">
|
||||||
|
{t("common.charts.histogram.max", { value: stats.max })}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction={statsPosition === "left" ? "row-reverse" : "row"}
|
||||||
|
alignItems="center"
|
||||||
|
sx={{ width: "100%" }}
|
||||||
|
>
|
||||||
|
<Box sx={{ flex: 1 }}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
display: "grid",
|
||||||
|
gridTemplateColumns: "repeat(25, 1fr)",
|
||||||
|
gap: gridGap,
|
||||||
|
alignItems: "end",
|
||||||
|
height: chartHeight,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{data.map((check, index) => {
|
||||||
|
const isPlaceholder = (check as any).status === "placeholder";
|
||||||
|
const heightPct = `${Math.max(0, Math.min(100, (check as any).responseTime ?? 0))}%`;
|
||||||
|
const barColor =
|
||||||
|
check.status === true
|
||||||
|
? theme.palette.success.light
|
||||||
|
: theme.palette.error.light;
|
||||||
|
const bar = (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: "relative",
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
borderRadius: theme.spacing(1),
|
||||||
|
bgcolor: theme.palette.action.hover,
|
||||||
|
overflow: "hidden",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
width: "100%",
|
||||||
|
height: isPlaceholder ? 0 : heightPct,
|
||||||
|
bgcolor: barColor,
|
||||||
|
transition: "height 500ms cubic-bezier(0.4, 0, 0.2, 1)",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
|
||||||
|
return isPlaceholder ? (
|
||||||
|
<Box
|
||||||
|
key={index}
|
||||||
|
sx={{ height: "100%" }}
|
||||||
|
>
|
||||||
|
{bar}
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
|
<HeatmapResponseTimeTooltip
|
||||||
|
key={index}
|
||||||
|
check={check}
|
||||||
|
>
|
||||||
|
{bar}
|
||||||
|
</HeatmapResponseTimeTooltip>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
{statsContent}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { ToggleButtonGroup, ToggleButton } from "@/Components/v2/inputs";
|
import { ToggleButtonGroup, ToggleButton } from "@/Components/inputs";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export * from "./charts/HistogramResponseTime";
|
||||||
|
export * from "./charts/HeatmapResponseTime";
|
||||||
|
export * from "./charts/HeatmapResponseTimeTooltip";
|
||||||
|
export * from "./controls/HeaderCreate";
|
||||||
|
export * from "./controls/HeaderTimeRange";
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { Avatar as MuiAvatar } from "@mui/material";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
|
import type { RootState } from "@/Types/state";
|
||||||
|
|
||||||
|
interface AvatarProps {
|
||||||
|
src?: string;
|
||||||
|
small?: boolean;
|
||||||
|
sx?: object;
|
||||||
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Avatar = ({ src, small, sx, onClick = () => {} }: AvatarProps) => {
|
||||||
|
const { user } = useSelector((state: RootState) => state.auth);
|
||||||
|
const theme = useTheme();
|
||||||
|
if (!user) return null;
|
||||||
|
|
||||||
|
const style = small ? { width: 32, height: 32 } : { width: 64, height: 64 };
|
||||||
|
|
||||||
|
const [image, setImage] = useState<string>();
|
||||||
|
useEffect(() => {
|
||||||
|
if (user.avatarImage) {
|
||||||
|
setImage(`data:image/png;base64,${user.avatarImage}`);
|
||||||
|
}
|
||||||
|
}, [user?.avatarImage]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MuiAvatar
|
||||||
|
onClick={onClick}
|
||||||
|
alt={`${user?.firstName} ${user?.lastName}`}
|
||||||
|
src={src ? src : user?.avatarImage ? image : undefined}
|
||||||
|
sx={{
|
||||||
|
color: theme.palette.primary.contrastText,
|
||||||
|
fontSize: small ? "16px" : "22px",
|
||||||
|
fontWeight: 400,
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
display: "inline-flex",
|
||||||
|
|
||||||
|
...style,
|
||||||
|
...sx,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{user.firstName?.charAt(0)}
|
||||||
|
{user.lastName?.charAt(0) || ""}
|
||||||
|
</MuiAvatar>
|
||||||
|
);
|
||||||
|
};
|
||||||
File renamed without changes.
+5
-4
@@ -1,7 +1,8 @@
|
|||||||
import { BaseBox } from "../design-elements";
|
import { BaseBox } from ".";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
import type { ResponsiveStyleValue } from "@mui/system";
|
import type { ResponsiveStyleValue } from "@mui/system";
|
||||||
|
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -26,7 +27,7 @@ export const BaseChart = ({
|
|||||||
return (
|
return (
|
||||||
<BaseBox
|
<BaseBox
|
||||||
sx={{
|
sx={{
|
||||||
padding: padding ?? theme.spacing(8),
|
padding: padding ?? theme.spacing(LAYOUT.MD),
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
width: width,
|
width: width,
|
||||||
@@ -34,13 +35,13 @@ export const BaseChart = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(8)}
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
flex={1}
|
flex={1}
|
||||||
>
|
>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(LAYOUT.XS)}
|
||||||
>
|
>
|
||||||
{icon && (
|
{icon && (
|
||||||
<BaseBox
|
<BaseBox
|
||||||
+9
-8
@@ -3,13 +3,14 @@ import Stack from "@mui/material/Stack";
|
|||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Alert from "@mui/material/Alert";
|
import Alert from "@mui/material/Alert";
|
||||||
import Link from "@mui/material/Link";
|
import Link from "@mui/material/Link";
|
||||||
|
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
|
||||||
import {
|
import {
|
||||||
ErrorFallback,
|
ErrorFallback,
|
||||||
EmptyFallback,
|
EmptyFallback,
|
||||||
EmptyMonitorFallback,
|
EmptyMonitorFallback,
|
||||||
BaseFallback,
|
BaseFallback,
|
||||||
} from "@/Components/v2/design-elements/Fallback";
|
} from "@/Components/design-elements/Fallback";
|
||||||
import { Breadcrumb } from "@/Components/v2/design-elements/Breadcrumb";
|
import { Breadcrumb } from "@/Components/design-elements/Breadcrumb";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import { HeaderAuthControls } from "@/Pages/Auth/components/HeaderAuthControls";
|
import { HeaderAuthControls } from "@/Pages/Auth/components/HeaderAuthControls";
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ export const BasePage = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
spacing={theme.spacing(10)}
|
spacing={theme.spacing(LAYOUT.LG)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<Breadcrumb breadcrumbOverride={breadcrumbOverride} />
|
<Breadcrumb breadcrumbOverride={breadcrumbOverride} />
|
||||||
@@ -177,7 +178,7 @@ export const MonitorBasePageWithStates = ({
|
|||||||
error={error}
|
error={error}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{priorityFallback}
|
<Stack height={"100%"}>{priorityFallback}</Stack>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -220,7 +221,7 @@ export const BaseAuthPage = ({
|
|||||||
return (
|
return (
|
||||||
<BasePage
|
<BasePage
|
||||||
breadcrumbOverride={[]}
|
breadcrumbOverride={[]}
|
||||||
gap={theme.spacing(8)}
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
minHeight="100vh"
|
minHeight="100vh"
|
||||||
@@ -229,7 +230,7 @@ export const BaseAuthPage = ({
|
|||||||
>
|
>
|
||||||
<HeaderAuthControls
|
<HeaderAuthControls
|
||||||
hideLogo
|
hideLogo
|
||||||
py={theme.spacing(4)}
|
py={theme.spacing(LAYOUT.XS)}
|
||||||
position={"absolute"}
|
position={"absolute"}
|
||||||
top={0}
|
top={0}
|
||||||
left={0}
|
left={0}
|
||||||
@@ -243,14 +244,14 @@ export const BaseAuthPage = ({
|
|||||||
<Stack alignItems={"center"}>
|
<Stack alignItems={"center"}>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h1"
|
variant="h1"
|
||||||
mb={theme.spacing(2)}
|
mb={theme.spacing(SPACING.LG)}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h2">{subtitle}</Typography>
|
<Typography variant="h2">{subtitle}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(8)}
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
width={{
|
width={{
|
||||||
xs: "80%",
|
xs: "80%",
|
||||||
md: "25%",
|
md: "25%",
|
||||||
File renamed without changes.
+3
-1
@@ -2,6 +2,7 @@ import Stack from "@mui/material/Stack";
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { Check } from "lucide-react";
|
import { Check } from "lucide-react";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
|
|
||||||
export const BulletPointCheck = ({
|
export const BulletPointCheck = ({
|
||||||
text,
|
text,
|
||||||
@@ -21,12 +22,13 @@ export const BulletPointCheck = ({
|
|||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={theme.spacing(6)}
|
gap={theme.spacing(LAYOUT.SM)}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
<Check
|
<Check
|
||||||
size={16}
|
size={16}
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
|
color={variant === "info" ? theme.palette.text.secondary : colors[variant]}
|
||||||
style={{
|
style={{
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
}}
|
}}
|
||||||
File renamed without changes.
+10
-14
@@ -1,7 +1,8 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { BulletPointCheck, SkeletonCard } from "@/Components/v2/design-elements";
|
import { BulletPointCheck, SkeletonCard } from "@/Components/design-elements";
|
||||||
import { Button } from "@/Components/v2/inputs";
|
import { Button } from "@/Components/inputs";
|
||||||
|
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
|
||||||
|
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
@@ -27,7 +28,7 @@ export const BaseFallback = ({ children, ...props }: BaseFallbackProps) => {
|
|||||||
lg: "50%",
|
lg: "50%",
|
||||||
xl: "40%",
|
xl: "40%",
|
||||||
}}
|
}}
|
||||||
padding={{ xs: theme.spacing(8), md: theme.spacing(16) }}
|
padding={{ xs: theme.spacing(LAYOUT.MD), md: theme.spacing(LAYOUT.XXL) }}
|
||||||
bgcolor={theme.palette.background.paper}
|
bgcolor={theme.palette.background.paper}
|
||||||
border={1}
|
border={1}
|
||||||
borderColor={theme.palette.divider}
|
borderColor={theme.palette.divider}
|
||||||
@@ -55,7 +56,7 @@ export const ErrorFallback = ({
|
|||||||
<BaseFallback>
|
<BaseFallback>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h1"
|
variant="h1"
|
||||||
marginY={theme.spacing(4)}
|
marginY={theme.spacing(LAYOUT.XS)}
|
||||||
color={theme.palette.text.secondary}
|
color={theme.palette.text.secondary}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
@@ -81,20 +82,15 @@ export const EmptyFallback = ({
|
|||||||
return (
|
return (
|
||||||
<BaseFallback>
|
<BaseFallback>
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(10)}
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
zIndex={1}
|
zIndex={1}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography component="h1">{title}</Typography>
|
||||||
component="h1"
|
|
||||||
color={theme.palette.primary.contrastText}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</Typography>
|
|
||||||
<Stack
|
<Stack
|
||||||
sx={{
|
sx={{
|
||||||
flexWrap: "wrap",
|
flexWrap: "wrap",
|
||||||
gap: theme.spacing(2),
|
gap: theme.spacing(SPACING.MD),
|
||||||
maxWidth: "1100px",
|
maxWidth: "1100px",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
@@ -139,7 +135,7 @@ export const EmptyMonitorFallback = ({
|
|||||||
return (
|
return (
|
||||||
<BaseFallback>
|
<BaseFallback>
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(10)}
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
zIndex={1}
|
zIndex={1}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
@@ -152,7 +148,7 @@ export const EmptyMonitorFallback = ({
|
|||||||
<Stack
|
<Stack
|
||||||
sx={{
|
sx={{
|
||||||
flexWrap: "wrap",
|
flexWrap: "wrap",
|
||||||
gap: theme.spacing(2),
|
gap: theme.spacing(SPACING.MD),
|
||||||
maxWidth: "1100px",
|
maxWidth: "1100px",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
+1
@@ -4,6 +4,7 @@ interface IconProps {
|
|||||||
icon: LucideIcon;
|
icon: LucideIcon;
|
||||||
size?: number;
|
size?: number;
|
||||||
strokeWidth?: number;
|
strokeWidth?: number;
|
||||||
|
stroke?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Icon = ({ icon: Icon, size = 20, strokeWidth = 1.5 }: IconProps) => {
|
const Icon = ({ icon: Icon, size = 20, strokeWidth = 1.5 }: IconProps) => {
|
||||||
+2
-5
@@ -1,11 +1,11 @@
|
|||||||
import type { Monitor } from "@/Types/Monitor";
|
import type { Monitor } from "@/Types/Monitor";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { PulseDot, Dot } from "@/Components/v2/design-elements";
|
import { PulseDot, Dot } from "@/Components/design-elements";
|
||||||
import { getStatusColor, formatUrl } from "@/Utils/MonitorUtils";
|
import { getStatusColor, formatUrl } from "@/Utils/MonitorUtils";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import prettyMilliseconds from "pretty-ms";
|
import prettyMilliseconds from "pretty-ms";
|
||||||
import { typographyLevels } from "@/Utils/Theme/v2Palette";
|
import { typographyLevels } from "@/Utils/Theme/Palette";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -19,11 +19,9 @@ export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
|||||||
<Typography
|
<Typography
|
||||||
fontSize={typographyLevels.xl}
|
fontSize={typographyLevels.xl}
|
||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
color={theme.palette.primary.contrastText}
|
|
||||||
overflow={"hidden"}
|
overflow={"hidden"}
|
||||||
textOverflow={"ellipsis"}
|
textOverflow={"ellipsis"}
|
||||||
whiteSpace={"nowrap"}
|
whiteSpace={"nowrap"}
|
||||||
maxWidth={isSmall ? "100%" : "calc((100vw - var(--env-var-width-2)) / 2)"}
|
|
||||||
>
|
>
|
||||||
{monitor.name}
|
{monitor.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -40,7 +38,6 @@ export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
|||||||
overflow={"hidden"}
|
overflow={"hidden"}
|
||||||
textOverflow={"ellipsis"}
|
textOverflow={"ellipsis"}
|
||||||
whiteSpace={"nowrap"}
|
whiteSpace={"nowrap"}
|
||||||
maxWidth={isSmall ? "100%" : "calc((100vw - var(--env-var-width-2)) / 2)"}
|
|
||||||
>
|
>
|
||||||
{formatUrl(monitor?.url)}
|
{formatUrl(monitor?.url)}
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { WifiOff } from "lucide-react";
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
interface OfflineBannerProps {
|
||||||
|
visible: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const OfflineBanner = ({ visible }: OfflineBannerProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [shouldRender, setShouldRender] = useState(visible);
|
||||||
|
const [isAnimating, setIsAnimating] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (visible) {
|
||||||
|
setShouldRender(true);
|
||||||
|
requestAnimationFrame(() => setIsAnimating(true));
|
||||||
|
} else {
|
||||||
|
setIsAnimating(false);
|
||||||
|
const timer = setTimeout(() => setShouldRender(false), 1000);
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}
|
||||||
|
}, [visible]);
|
||||||
|
|
||||||
|
if (!shouldRender) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: "fixed",
|
||||||
|
top: isAnimating ? 0 : "-100%",
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
zIndex: theme.zIndex.snackbar,
|
||||||
|
backgroundColor: theme.palette.error.main,
|
||||||
|
color: theme.palette.error.contrastText,
|
||||||
|
px: theme.spacing(8),
|
||||||
|
py: theme.spacing(4),
|
||||||
|
transition: "top 1s ease-in-out",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
gap={theme.spacing(4)}
|
||||||
|
>
|
||||||
|
<WifiOff size={20} />
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
fontWeight={500}
|
||||||
|
>
|
||||||
|
{t("components.offlineBanner.serverUnreachable")}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
+15
-2
@@ -1,4 +1,17 @@
|
|||||||
import { Box, Stack, useTheme } from "@mui/material";
|
import Box from "@mui/material/Box";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import { useTheme, keyframes } from "@mui/material";
|
||||||
|
|
||||||
|
const ripple = keyframes`
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(2);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
interface PulseDotProps {
|
interface PulseDotProps {
|
||||||
color: string;
|
color: string;
|
||||||
@@ -28,7 +41,7 @@ export const PulseDot = ({ color }: PulseDotProps) => {
|
|||||||
height: "100%",
|
height: "100%",
|
||||||
backgroundColor: "inherit",
|
backgroundColor: "inherit",
|
||||||
borderRadius: "50%",
|
borderRadius: "50%",
|
||||||
animation: "ripple 1.8s ease-out infinite",
|
animation: `${ripple} 1.8s ease-out infinite`,
|
||||||
},
|
},
|
||||||
"&::after": {
|
"&::after": {
|
||||||
content: `""`,
|
content: `""`,
|
||||||
File renamed without changes.
+5
-4
@@ -3,6 +3,7 @@ import Box from "@mui/material/Box";
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
export const SplitBox = ({
|
export const SplitBox = ({
|
||||||
left,
|
left,
|
||||||
right,
|
right,
|
||||||
@@ -18,10 +19,10 @@ export const SplitBox = ({
|
|||||||
bgcolor={theme.palette.background.paper}
|
bgcolor={theme.palette.background.paper}
|
||||||
border={1}
|
border={1}
|
||||||
borderColor={theme.palette.divider}
|
borderColor={theme.palette.divider}
|
||||||
borderRadius={theme.spacing(2)}
|
borderRadius={theme.shape.borderRadius}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
padding={theme.spacing(15)}
|
padding={theme.spacing(LAYOUT.XXL)}
|
||||||
borderRight={isSmall ? 0 : 1}
|
borderRight={isSmall ? 0 : 1}
|
||||||
borderBottom={isSmall ? 1 : 0}
|
borderBottom={isSmall ? 1 : 0}
|
||||||
borderColor={theme.palette.divider}
|
borderColor={theme.palette.divider}
|
||||||
@@ -37,7 +38,7 @@ export const SplitBox = ({
|
|||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
flex={1}
|
flex={1}
|
||||||
padding={theme.spacing(15)}
|
padding={theme.spacing(LAYOUT.XXL)}
|
||||||
>
|
>
|
||||||
{right}
|
{right}
|
||||||
</Box>
|
</Box>
|
||||||
@@ -60,7 +61,7 @@ export const ConfigBox = ({
|
|||||||
return (
|
return (
|
||||||
<SplitBox
|
<SplitBox
|
||||||
left={
|
left={
|
||||||
<Stack spacing={theme.spacing(4)}>
|
<Stack spacing={theme.spacing(LAYOUT.XS)}>
|
||||||
<Typography
|
<Typography
|
||||||
textTransform={"capitalize"}
|
textTransform={"capitalize"}
|
||||||
component="h2"
|
component="h2"
|
||||||
+2
-2
@@ -4,8 +4,8 @@ import Box from "@mui/material/Box";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { lighten } from "@mui/material/styles";
|
import { lighten } from "@mui/material/styles";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
import type { PaletteKey } from "@/Utils/Theme/v2Theme";
|
import type { PaletteKey } from "@/Utils/Theme/Theme";
|
||||||
import { BaseBox, TooltipWithInfo } from "@/Components/v2/design-elements";
|
import { BaseBox, TooltipWithInfo } from "@/Components/design-elements";
|
||||||
import type { SxProps } from "@mui/material";
|
import type { SxProps } from "@mui/material";
|
||||||
|
|
||||||
type GradientBox = React.PropsWithChildren<{
|
type GradientBox = React.PropsWithChildren<{
|
||||||
+53
-19
@@ -1,8 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { BaseBox } from "@/Components/v2/design-elements";
|
import { BaseBox } from "@/Components/design-elements";
|
||||||
import Background from "@/assets/Images/background-grid.svg?react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import type { SxProps } from "@mui/material";
|
import type { SxProps } from "@mui/material";
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ export const BGBox = ({ children, sx }: StatusBoxProps) => {
|
|||||||
return (
|
return (
|
||||||
<BaseBox
|
<BaseBox
|
||||||
sx={{
|
sx={{
|
||||||
|
backgroundColor: theme.palette.background.default,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
position: "relative",
|
position: "relative",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@@ -27,11 +27,23 @@ export const BGBox = ({ children, sx }: StatusBoxProps) => {
|
|||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
position="absolute"
|
position="absolute"
|
||||||
top="-10%"
|
top={0}
|
||||||
left="5%"
|
left={0}
|
||||||
>
|
right={0}
|
||||||
<Background />
|
bottom={0}
|
||||||
</Box>
|
sx={{
|
||||||
|
pointerEvents: "none",
|
||||||
|
backgroundImage: `
|
||||||
|
linear-gradient(${theme.palette.divider} 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, ${theme.palette.divider} 1px, transparent 1px)
|
||||||
|
`,
|
||||||
|
backgroundSize: "24px 24px",
|
||||||
|
maskImage:
|
||||||
|
"linear-gradient(135deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.4) 100%)",
|
||||||
|
WebkitMaskImage:
|
||||||
|
"linear-gradient(135deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.4) 100%)",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{children}
|
{children}
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
);
|
);
|
||||||
@@ -105,6 +117,40 @@ export const PausedStatusBox = ({ n }: { n: number }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
export const MaintenanceStatusBox = ({ n }: { n: number }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<StatusBox
|
||||||
|
label={t("pages.common.monitors.status.maintenance")}
|
||||||
|
n={n}
|
||||||
|
color={theme.palette.warning.light}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export const InitializingStatusBox = ({ n }: { n: number }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<StatusBox
|
||||||
|
label={t("pages.common.monitors.status.initializing")}
|
||||||
|
n={n}
|
||||||
|
color={theme.palette.warning.light}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export const BreachedStatusBox = ({ n }: { n: number }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<StatusBox
|
||||||
|
label={t("pages.common.monitors.status.breached")}
|
||||||
|
n={n}
|
||||||
|
color={theme.palette.warning.main}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const TotalChecksBox = ({ n }: { n: number }) => {
|
export const TotalChecksBox = ({ n }: { n: number }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -138,15 +184,3 @@ export const UpChecksBox = ({ n }: { n: number }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const InitializingStatusBox = ({ n }: { n: number }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
return (
|
|
||||||
<StatusBox
|
|
||||||
label={t("pages.common.monitors.status.initializing")}
|
|
||||||
n={n}
|
|
||||||
color={theme.palette.warning.light}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
+15
-24
@@ -1,5 +1,5 @@
|
|||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { BaseBox } from "@/Components/v2/design-elements";
|
import { BaseBox } from "@/Components/design-elements";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import type { MonitorStatus } from "@/Types/Monitor";
|
import type { MonitorStatus } from "@/Types/Monitor";
|
||||||
@@ -11,33 +11,26 @@ import { useTranslation } from "react-i18next";
|
|||||||
export const ValueTypes = ["positive", "negative", "neutral"] as const;
|
export const ValueTypes = ["positive", "negative", "neutral"] as const;
|
||||||
export type ValueType = (typeof ValueTypes)[number];
|
export type ValueType = (typeof ValueTypes)[number];
|
||||||
|
|
||||||
export const StatusLabel = ({
|
export const StatusLabel = ({ status, sx }: { status: MonitorStatus; sx?: SxProps }) => {
|
||||||
status,
|
|
||||||
isActive,
|
|
||||||
sx,
|
|
||||||
}: {
|
|
||||||
status: MonitorStatus;
|
|
||||||
isActive?: boolean;
|
|
||||||
sx?: SxProps;
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const palette = getStatusPalette(status);
|
const palette = getStatusPalette(status);
|
||||||
|
|
||||||
const determineStatus = (
|
const determineStatus = (status: MonitorStatus): string => {
|
||||||
isActive: boolean | undefined,
|
if (status === "up") {
|
||||||
status: MonitorStatus
|
return t("pages.common.monitors.status.up");
|
||||||
): string => {
|
} else if (status === "down") {
|
||||||
if (isActive === false) {
|
return t("pages.common.monitors.status.down");
|
||||||
|
} else if (status === "breached") {
|
||||||
|
return t("pages.common.monitors.status.breached");
|
||||||
|
} else if (status === "maintenance") {
|
||||||
|
return t("pages.common.monitors.status.maintenance");
|
||||||
|
} else if (status === "paused") {
|
||||||
return t("pages.common.monitors.status.paused");
|
return t("pages.common.monitors.status.paused");
|
||||||
|
} else if (status === "initializing") {
|
||||||
|
return t("pages.common.monitors.status.initializing");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status === true) {
|
|
||||||
return t("pages.common.monitors.status.up");
|
|
||||||
}
|
|
||||||
if (status === false) {
|
|
||||||
return t("pages.common.monitors.status.down");
|
|
||||||
}
|
|
||||||
return t("pages.common.monitors.status.initializing");
|
return t("pages.common.monitors.status.initializing");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,9 +57,7 @@ export const StatusLabel = ({
|
|||||||
borderRadius="50%"
|
borderRadius="50%"
|
||||||
marginRight="5px"
|
marginRight="5px"
|
||||||
/>
|
/>
|
||||||
<Typography textTransform={"capitalize"}>
|
<Typography textTransform={"capitalize"}>{determineStatus(status)}</Typography>
|
||||||
{determineStatus(isActive, status)}
|
|
||||||
</Typography>
|
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
+11
-10
@@ -29,6 +29,7 @@ import type { TablePaginationOwnProps } from "@mui/material/TablePagination";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useState, Fragment, useEffect } from "react";
|
import { useState, Fragment, useEffect } from "react";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
|
||||||
import type { SxProps, Theme } from "@mui/material/styles";
|
import type { SxProps, Theme } from "@mui/material/styles";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
|
|
||||||
@@ -90,20 +91,20 @@ export function DataTable<
|
|||||||
// Return stack of cards for small screens
|
// Return stack of cards for small screens
|
||||||
if (isSmall && cardsOnSmallScreens) {
|
if (isSmall && cardsOnSmallScreens) {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={theme.spacing(4)}>
|
<Stack spacing={theme.spacing(LAYOUT.XS)}>
|
||||||
{data.map((row) => {
|
{data.map((row) => {
|
||||||
const key = row.id || row._id || Math.random();
|
const key = row.id || row._id || Math.random();
|
||||||
keys.push(key);
|
keys.push(key);
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
onClick={() => (onRowClick ? onRowClick(row) : null)}
|
onClick={() => (onRowClick ? onRowClick(row) : null)}
|
||||||
spacing={theme.spacing(4)}
|
spacing={theme.spacing(LAYOUT.XS)}
|
||||||
sx={{
|
sx={{
|
||||||
borderStyle: "solid",
|
borderStyle: "solid",
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: theme.palette.divider,
|
borderColor: theme.palette.divider,
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
padding: theme.spacing(4),
|
padding: theme.spacing(LAYOUT.XS),
|
||||||
cursor: onRowClick ? "pointer" : "default",
|
cursor: onRowClick ? "pointer" : "default",
|
||||||
}}
|
}}
|
||||||
key={key}
|
key={key}
|
||||||
@@ -155,7 +156,7 @@ export function DataTable<
|
|||||||
<Table
|
<Table
|
||||||
sx={{
|
sx={{
|
||||||
"&.MuiTable-root :is(.MuiTableHead-root, .MuiTableBody-root) :is(th, td)": {
|
"&.MuiTable-root :is(.MuiTableHead-root, .MuiTableBody-root) :is(th, td)": {
|
||||||
paddingLeft: theme.spacing(8),
|
paddingLeft: theme.spacing(LAYOUT.MD),
|
||||||
},
|
},
|
||||||
"& .MuiTableCell-root": {
|
"& .MuiTableCell-root": {
|
||||||
borderBottom: `1px solid ${theme.palette.divider}`,
|
borderBottom: `1px solid ${theme.palette.divider}`,
|
||||||
@@ -168,13 +169,13 @@ export function DataTable<
|
|||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
textTransform: "uppercase",
|
textTransform: "uppercase",
|
||||||
padding: `${theme.spacing(2)} ${theme.spacing(8)}`,
|
padding: `${theme.spacing(SPACING.LG)} ${theme.spacing(LAYOUT.MD)}`,
|
||||||
fontSize: theme.typography.fontSize,
|
fontSize: theme.typography.fontSize,
|
||||||
},
|
},
|
||||||
"& :is(td)": {
|
"& :is(td)": {
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
padding: `${theme.spacing(7)} ${theme.spacing(8)}`,
|
padding: `${theme.spacing(LAYOUT.MD)} ${theme.spacing(LAYOUT.MD)}`,
|
||||||
fontSize: theme.typography.fontSize,
|
fontSize: theme.typography.fontSize,
|
||||||
overflowX: "hidden",
|
overflowX: "hidden",
|
||||||
},
|
},
|
||||||
@@ -514,7 +515,7 @@ export const Pagination = ({ ...props }: PaginationProps) => {
|
|||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns: "1fr 1fr",
|
gridTemplateColumns: "1fr 1fr",
|
||||||
gridAutoRows: "auto",
|
gridAutoRows: "auto",
|
||||||
rowGap: theme.spacing(1),
|
rowGap: theme.spacing(SPACING.SM),
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyItems: "center",
|
justifyItems: "center",
|
||||||
paddingLeft: 0,
|
paddingLeft: 0,
|
||||||
@@ -556,8 +557,8 @@ const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) =>
|
|||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
sx={{
|
sx={{
|
||||||
py: theme.spacing(12),
|
py: theme.spacing(LAYOUT.XL),
|
||||||
px: theme.spacing(4),
|
px: theme.spacing(LAYOUT.XS),
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderStyle: "solid",
|
borderStyle: "solid",
|
||||||
borderColor: theme.palette.divider,
|
borderColor: theme.palette.divider,
|
||||||
@@ -574,7 +575,7 @@ const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) =>
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
mb: theme.spacing(2),
|
mb: theme.spacing(SPACING.LG),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
File renamed without changes.
+2
-1
@@ -10,7 +10,7 @@ interface TextLinkProps extends StackProps {
|
|||||||
text: string;
|
text: string;
|
||||||
linkText: string;
|
linkText: string;
|
||||||
href: string;
|
href: string;
|
||||||
target?: string;
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TextLink = ({
|
export const TextLink = ({
|
||||||
@@ -34,6 +34,7 @@ export const TextLink = ({
|
|||||||
to={href}
|
to={href}
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
target={target}
|
target={target}
|
||||||
|
{...(target === "_blank" && { rel: "noopener noreferrer" })}
|
||||||
>
|
>
|
||||||
{linkText}
|
{linkText}
|
||||||
</Link>
|
</Link>
|
||||||
File renamed without changes.
+2
@@ -19,3 +19,5 @@ export * from "./Gauge";
|
|||||||
export * from "./Tabs";
|
export * from "./Tabs";
|
||||||
export * from "./SplitBox";
|
export * from "./SplitBox";
|
||||||
export * from "./TextLink";
|
export * from "./TextLink";
|
||||||
|
export * from "./OfflineBanner";
|
||||||
|
export * from "./Avatar";
|
||||||
+3
-2
@@ -1,8 +1,9 @@
|
|||||||
import i18n from "../../../Utils/i18n.js";
|
import i18n from "@/Utils/i18n.js";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import type { RootState } from "@/store";
|
||||||
const I18nLoader = () => {
|
const I18nLoader = () => {
|
||||||
const language = useSelector((state) => state.ui.language ?? "en");
|
const language = useSelector((state: RootState) => state.ui.language ?? "en");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (language && i18n.language !== language) {
|
if (language && i18n.language !== language) {
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import Autocomplete from "@mui/material/Autocomplete";
|
import Autocomplete from "@mui/material/Autocomplete";
|
||||||
import type { AutocompleteProps } from "@mui/material/Autocomplete";
|
import type { AutocompleteProps } from "@mui/material/Autocomplete";
|
||||||
import { TextField, Checkbox } from "@/Components/v2/inputs";
|
import { TextField, Checkbox } from "@/Components/inputs";
|
||||||
import ListItem from "@mui/material/ListItem";
|
import ListItem from "@mui/material/ListItem";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { MuiColorInput } from "mui-color-input";
|
import { MuiColorInput } from "mui-color-input";
|
||||||
import type { MuiColorInputProps } from "mui-color-input";
|
import type { MuiColorInputProps } from "mui-color-input";
|
||||||
import { typographyLevels } from "@/Utils/Theme/v2Palette";
|
import { typographyLevels } from "@/Utils/Theme/Palette";
|
||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { FieldLabel } from "@/Components/v2/inputs/FieldLabel";
|
import { FieldLabel } from "@/Components/inputs/FieldLabel";
|
||||||
|
|
||||||
interface ColorPickerProps extends MuiColorInputProps {
|
interface ColorPickerProps extends MuiColorInputProps {
|
||||||
fieldLabel?: string;
|
fieldLabel?: string;
|
||||||
File renamed without changes.
+5
-2
@@ -4,8 +4,8 @@ import DialogActions from "@mui/material/DialogActions";
|
|||||||
import DialogContent from "@mui/material/DialogContent";
|
import DialogContent from "@mui/material/DialogContent";
|
||||||
import DialogContentText from "@mui/material/DialogContentText";
|
import DialogContentText from "@mui/material/DialogContentText";
|
||||||
import DialogTitle from "@mui/material/DialogTitle";
|
import DialogTitle from "@mui/material/DialogTitle";
|
||||||
import { Button } from "@/Components/v2/inputs";
|
import { Button } from "@/Components/inputs";
|
||||||
import { typographyLevels } from "@/Utils/Theme/v2Palette";
|
import { typographyLevels } from "@/Utils/Theme/Palette";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ export const DialogInput = ({
|
|||||||
children,
|
children,
|
||||||
maxWidth,
|
maxWidth,
|
||||||
fullWidth = false,
|
fullWidth = false,
|
||||||
|
additionalButtons,
|
||||||
}: {
|
}: {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -37,6 +38,7 @@ export const DialogInput = ({
|
|||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
maxWidth?: DialogProps["maxWidth"];
|
maxWidth?: DialogProps["maxWidth"];
|
||||||
fullWidth?: boolean;
|
fullWidth?: boolean;
|
||||||
|
additionalButtons?: ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
@@ -59,6 +61,7 @@ export const DialogInput = ({
|
|||||||
>
|
>
|
||||||
{cancelText ?? t("common.buttons.cancel")}
|
{cancelText ?? t("common.buttons.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
|
{additionalButtons}
|
||||||
{onConfirm && (
|
{onConfirm && (
|
||||||
<Button
|
<Button
|
||||||
loading={loading}
|
loading={loading}
|
||||||
File renamed without changes.
+5
-5
@@ -38,11 +38,11 @@ export const ImageUpload = ({
|
|||||||
const isValidType = accept.some((type) => file.type.includes(type));
|
const isValidType = accept.some((type) => file.type.includes(type));
|
||||||
const isValidSize = file.size <= maxSize;
|
const isValidSize = file.size <= maxSize;
|
||||||
if (!isValidType) {
|
if (!isValidType) {
|
||||||
setLocalError(t("common.errors.invalidFileFormat"));
|
setLocalError(t("components.imageUpload.errors.invalidFileFormat"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isValidSize) {
|
if (!isValidSize) {
|
||||||
setLocalError(t("common.errors.invalidFileSize"));
|
setLocalError(t("components.imageUpload.errors.invalidFileSize"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setLocalError(null);
|
setLocalError(null);
|
||||||
@@ -137,15 +137,15 @@ export const ImageUpload = ({
|
|||||||
color="primary"
|
color="primary"
|
||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
>
|
>
|
||||||
{t("common.imageUpload.clickToUpload")}
|
{t("components.imageUpload.clickToUpload")}
|
||||||
</Typography>{" "}
|
</Typography>{" "}
|
||||||
{t("common.imageUpload.orDragAndDrop")}
|
{t("components.imageUpload.orDragAndDrop")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="caption"
|
variant="caption"
|
||||||
color="text.disabled"
|
color="text.disabled"
|
||||||
>
|
>
|
||||||
{accept.join(", ").toUpperCase()} • {t("common.imageUpload.maxSize")}{" "}
|
{accept.join(", ").toUpperCase()} • {t("components.imageUpload.maxSize")}{" "}
|
||||||
{Math.round(maxSize / 1024 / 1024)}MB
|
{Math.round(maxSize / 1024 / 1024)}MB
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import { Select } from "@/Components/v2/inputs";
|
import { Select } from "@/Components/inputs";
|
||||||
import "flag-icons/css/flag-icons.min.css";
|
import "flag-icons/css/flag-icons.min.css";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
File renamed without changes.
File renamed without changes.
+4
-1
@@ -41,7 +41,10 @@ export const SliderInput = forwardRef<HTMLSpanElement, SliderInputProps>(
|
|||||||
"& .MuiSlider-thumb": {
|
"& .MuiSlider-thumb": {
|
||||||
backgroundColor: "#fff",
|
backgroundColor: "#fff",
|
||||||
"&:hover, &.Mui-focusVisible": {
|
"&:hover, &.Mui-focusVisible": {
|
||||||
boxShadow: `0 0 0 8px ${theme.palette.primary.main}20`,
|
boxShadow: "none",
|
||||||
|
},
|
||||||
|
"&:active": {
|
||||||
|
boxShadow: "none",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"& .MuiSlider-valueLabel": {
|
"& .MuiSlider-valueLabel": {
|
||||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { forwardRef } from "react";
|
import { forwardRef } from "react";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import type { TextFieldProps } from "@mui/material";
|
import type { TextFieldProps } from "@mui/material";
|
||||||
import { typographyLevels } from "@/Utils/Theme/v2Palette";
|
import { typographyLevels } from "@/Utils/Theme/Palette";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { FieldLabel } from "./FieldLabel";
|
import { FieldLabel } from "./FieldLabel";
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,62 @@
|
|||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import { useState, useEffect, useRef } from "react";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import BackgroundSVG from "@/assets/Images/background.svg";
|
||||||
|
import type { RootState } from "@/Types/state";
|
||||||
|
import { OfflineBanner } from "@/Components/design-elements";
|
||||||
|
import { setServerUnreachableCallback, get } from "@/Utils/ApiClient";
|
||||||
|
|
||||||
|
interface AppLayoutProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AppLayout = ({ children }: AppLayoutProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const mode = useSelector((state: RootState) => state.ui.mode);
|
||||||
|
const [serverUnreachable, setServerUnreachable] = useState(false);
|
||||||
|
const retryIntervalRef = useRef<number | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setServerUnreachableCallback(setServerUnreachable);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (serverUnreachable) {
|
||||||
|
retryIntervalRef.current = window.setInterval(async () => {
|
||||||
|
try {
|
||||||
|
await get("/health", { timeout: 5000 });
|
||||||
|
} catch {
|
||||||
|
// NO_OP
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
} else if (retryIntervalRef.current) {
|
||||||
|
clearInterval(retryIntervalRef.current);
|
||||||
|
retryIntervalRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (retryIntervalRef.current) {
|
||||||
|
clearInterval(retryIntervalRef.current);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [serverUnreachable]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
minHeight: "100vh",
|
||||||
|
backgroundColor: theme.palette.background.default,
|
||||||
|
backgroundImage: mode === "dark" ? `url("${BackgroundSVG}")` : "none",
|
||||||
|
backgroundSize: "100% 100%",
|
||||||
|
backgroundPosition: "center",
|
||||||
|
backgroundRepeat: "no-repeat",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<OfflineBanner visible={serverUnreachable} />
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AppLayout;
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { Sidebar } from "@/Components/sidebar";
|
||||||
|
import { Outlet } from "react-router";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import { useMediaQuery } from "@mui/material";
|
||||||
|
import { useSidebar } from "@/Hooks/useSidebar";
|
||||||
|
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
|
|
||||||
|
const RootLayout = () => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
|
const { collapsedWidth } = useSidebar();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack flexDirection="row">
|
||||||
|
<Sidebar />
|
||||||
|
<Stack
|
||||||
|
flex={1}
|
||||||
|
padding={6}
|
||||||
|
overflow={"hidden"}
|
||||||
|
sx={{
|
||||||
|
backgroundColor:
|
||||||
|
theme.palette.mode === "dark"
|
||||||
|
? "rgba(255, 255, 255, 0.01)"
|
||||||
|
: "rgba(0, 0, 0, 0.01)",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
paddingLeft: isSmall ? `${collapsedWidth + 12}px` : 12,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
maxWidth={1280}
|
||||||
|
width="100%"
|
||||||
|
paddingY={theme.spacing(6)}
|
||||||
|
flex={1}
|
||||||
|
>
|
||||||
|
<Outlet />
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RootLayout;
|
||||||
+14
-4
@@ -1,12 +1,21 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { Select, Button } from "@/Components/v2/inputs";
|
import { Select, Button } from "@/Components/inputs";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
|
|
||||||
import type { MonitorType } from "@/Types/Monitor";
|
import type { MonitorType } from "@/Types/Monitor";
|
||||||
import { Typography, useTheme } from "@mui/material";
|
import { Typography, useTheme } from "@mui/material";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const types = ["http", "ping", "port", "docker", "game"];
|
const types = ["http", "ping", "port", "docker", "game", "grpc"];
|
||||||
|
const typeDisplayNames: Record<string, string> = {
|
||||||
|
http: "HTTP",
|
||||||
|
ping: "Ping",
|
||||||
|
port: "Port",
|
||||||
|
docker: "Docker",
|
||||||
|
game: "Game",
|
||||||
|
grpc: "gRPC",
|
||||||
|
};
|
||||||
const statuses = ["up", "down"];
|
const statuses = ["up", "down"];
|
||||||
const states = ["active", "paused"];
|
const states = ["active", "paused"];
|
||||||
|
|
||||||
@@ -30,6 +39,7 @@ export const ControlsFilter = ({
|
|||||||
onClearFilters: () => void;
|
onClearFilters: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
const isFilterActive =
|
const isFilterActive =
|
||||||
(selectedTypes?.length ?? 0) > 0 || selectedStatus !== "" || selectedState !== "";
|
(selectedTypes?.length ?? 0) > 0 || selectedStatus !== "" || selectedState !== "";
|
||||||
@@ -50,7 +60,7 @@ export const ControlsFilter = ({
|
|||||||
key={type}
|
key={type}
|
||||||
value={type}
|
value={type}
|
||||||
>
|
>
|
||||||
<Typography textTransform={"capitalize"}>{type}</Typography>
|
<Typography>{typeDisplayNames[type] ?? type}</Typography>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
@@ -88,7 +98,7 @@ export const ControlsFilter = ({
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={onClearFilters}
|
onClick={onClearFilters}
|
||||||
>
|
>
|
||||||
Clear Filters
|
{t("common.buttons.clearFilters")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
import { useRef, useEffect, useState } from "react";
|
||||||
|
import { Box, Typography, Stack, useTheme, GlobalStyles } from "@mui/material";
|
||||||
|
import Map, { Marker, Popup } from "react-map-gl/maplibre";
|
||||||
|
import type { MapRef } from "react-map-gl/maplibre";
|
||||||
|
import type { FlatGeoCheck } from "@/Types/GeoCheck";
|
||||||
|
import "maplibre-gl/dist/maplibre-gl.css";
|
||||||
|
|
||||||
|
interface GeoChecksMapProps {
|
||||||
|
geoChecks: FlatGeoCheck[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
||||||
|
const mapRef = useRef<MapRef>(null);
|
||||||
|
const [selectedCheck, setSelectedCheck] = useState<FlatGeoCheck | null>(null);
|
||||||
|
const theme = useTheme();
|
||||||
|
const isDarkMode = theme.palette.mode === "dark";
|
||||||
|
|
||||||
|
const mapPopupStyles = (
|
||||||
|
<GlobalStyles
|
||||||
|
styles={{
|
||||||
|
".maplibregl-popup-content": {
|
||||||
|
background: "transparent !important",
|
||||||
|
padding: "0 !important",
|
||||||
|
boxShadow: "none !important",
|
||||||
|
},
|
||||||
|
".maplibregl-popup-tip": {
|
||||||
|
display: "none",
|
||||||
|
},
|
||||||
|
".maplibregl-ctrl-attrib": {
|
||||||
|
display: "none",
|
||||||
|
},
|
||||||
|
".maplibregl-ctrl-logo": {
|
||||||
|
display: "none",
|
||||||
|
},
|
||||||
|
".maplibregl-popup-close-button": {
|
||||||
|
color: theme.palette.text.primary,
|
||||||
|
background: "transparent",
|
||||||
|
fontSize: "20px",
|
||||||
|
padding: "4px",
|
||||||
|
"&:hover": {
|
||||||
|
backgroundColor: theme.palette.action.hover,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (geoChecks.length === 0 || !mapRef.current) return;
|
||||||
|
|
||||||
|
const bounds = geoChecks.reduce(
|
||||||
|
(acc, check) => {
|
||||||
|
return {
|
||||||
|
minLng: Math.min(acc.minLng, check.location.longitude),
|
||||||
|
maxLng: Math.max(acc.maxLng, check.location.longitude),
|
||||||
|
minLat: Math.min(acc.minLat, check.location.latitude),
|
||||||
|
maxLat: Math.max(acc.maxLat, check.location.latitude),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
minLng: Infinity,
|
||||||
|
maxLng: -Infinity,
|
||||||
|
minLat: Infinity,
|
||||||
|
maxLat: -Infinity,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (bounds.minLng !== Infinity) {
|
||||||
|
mapRef.current.fitBounds(
|
||||||
|
[
|
||||||
|
[bounds.minLng, bounds.minLat],
|
||||||
|
[bounds.maxLng, bounds.maxLat],
|
||||||
|
],
|
||||||
|
{ padding: 50, duration: 1000 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [geoChecks]);
|
||||||
|
|
||||||
|
const getMarkerColor = (status: boolean): string => {
|
||||||
|
return status ? theme.palette.success.main : theme.palette.error.main;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatResponseTime = (timing: number): string => {
|
||||||
|
return `${timing.toFixed(0)}ms`;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{mapPopupStyles}
|
||||||
|
<Box
|
||||||
|
height={500}
|
||||||
|
width={"100%"}
|
||||||
|
borderRadius={theme.shape.borderRadius}
|
||||||
|
overflow={"hidden"}
|
||||||
|
>
|
||||||
|
<Map
|
||||||
|
ref={mapRef}
|
||||||
|
initialViewState={{
|
||||||
|
longitude: 0,
|
||||||
|
latitude: 20,
|
||||||
|
zoom: 1.5,
|
||||||
|
}}
|
||||||
|
style={{ height: "100%", width: "100%" }}
|
||||||
|
mapStyle={
|
||||||
|
isDarkMode
|
||||||
|
? "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"
|
||||||
|
: "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{geoChecks.map((check, index) => (
|
||||||
|
<Marker
|
||||||
|
key={`${check.id}-${index}`}
|
||||||
|
longitude={check.location.longitude}
|
||||||
|
latitude={check.location.latitude}
|
||||||
|
anchor="bottom"
|
||||||
|
onClick={(e: any) => {
|
||||||
|
e.originalEvent.stopPropagation();
|
||||||
|
setSelectedCheck(check);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: "10px",
|
||||||
|
height: "10px",
|
||||||
|
borderRadius: "50%",
|
||||||
|
backgroundColor: getMarkerColor(check.status),
|
||||||
|
boxShadow: "0 2px 4px rgba(0,0,0,0.3)",
|
||||||
|
cursor: "pointer",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Marker>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{selectedCheck && (
|
||||||
|
<Popup
|
||||||
|
longitude={selectedCheck.location.longitude}
|
||||||
|
latitude={selectedCheck.location.latitude}
|
||||||
|
anchor="top"
|
||||||
|
onClose={() => setSelectedCheck(null)}
|
||||||
|
closeOnClick={false}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
minWidth: 200,
|
||||||
|
p: theme.spacing(4),
|
||||||
|
bgcolor: theme.palette.background.paper,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderColor: theme.palette.divider,
|
||||||
|
borderRadius: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle1"
|
||||||
|
fontWeight="bold"
|
||||||
|
gutterBottom
|
||||||
|
>
|
||||||
|
{selectedCheck.location.city}, {selectedCheck.location.country}
|
||||||
|
</Typography>
|
||||||
|
<Stack spacing={0.5}>
|
||||||
|
<Typography variant="body2">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
fontWeight="medium"
|
||||||
|
>
|
||||||
|
Status:
|
||||||
|
</Typography>{" "}
|
||||||
|
{selectedCheck.status ? "Up" : "Down"}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
fontWeight="medium"
|
||||||
|
>
|
||||||
|
Status Code:
|
||||||
|
</Typography>{" "}
|
||||||
|
{selectedCheck.statusCode}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
fontWeight="medium"
|
||||||
|
>
|
||||||
|
Response Time:
|
||||||
|
</Typography>{" "}
|
||||||
|
{formatResponseTime(selectedCheck.timings.total)}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="caption"
|
||||||
|
color="text.secondary"
|
||||||
|
sx={{ mt: 0.5 }}
|
||||||
|
>
|
||||||
|
{new Date(selectedCheck.createdAt).toLocaleString()}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Popup>
|
||||||
|
)}
|
||||||
|
</Map>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import { Tabs, Tab } from "@/Components/design-elements";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import type { GeoContinent } from "@/Types/GeoCheck";
|
||||||
|
|
||||||
|
interface HeaderGeoTabsProps {
|
||||||
|
geoCheckEnabled: boolean;
|
||||||
|
locations: GeoContinent[] | undefined;
|
||||||
|
selectedLocation: GeoContinent;
|
||||||
|
onLocationChange: (location: GeoContinent) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HeaderGeoTabs = ({
|
||||||
|
geoCheckEnabled,
|
||||||
|
locations,
|
||||||
|
selectedLocation,
|
||||||
|
onLocationChange,
|
||||||
|
}: HeaderGeoTabsProps) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
if (!geoCheckEnabled || !locations || locations.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleChange = (_event: React.SyntheticEvent, newValue: GeoContinent) => {
|
||||||
|
onLocationChange(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
spacing={{ xs: theme.spacing(8), md: 0 }}
|
||||||
|
direction={{ xs: "column", md: "row" }}
|
||||||
|
alignItems={"center"}
|
||||||
|
justifyContent={"flex-start"}
|
||||||
|
>
|
||||||
|
<Tabs
|
||||||
|
value={selectedLocation}
|
||||||
|
onChange={handleChange}
|
||||||
|
>
|
||||||
|
{locations.map((location) => (
|
||||||
|
<Tab
|
||||||
|
key={location}
|
||||||
|
label={t(
|
||||||
|
`pages.createMonitor.form.geoChecks.option.locations.options.${location}`
|
||||||
|
)}
|
||||||
|
value={location}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Tabs>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { Icon, MonitorStatus } from "@/Components/v2/design-elements";
|
import { Icon, MonitorStatus } from "@/Components/design-elements";
|
||||||
import { Button } from "@/Components/v2/inputs";
|
import { Button } from "@/Components/inputs";
|
||||||
import { Settings, Pause, Play, Mail, Bug, Trash } from "lucide-react";
|
import { Settings, Pause, Play, Mail, Bug, Trash } from "lucide-react";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import {
|
||||||
|
UpStatusBox,
|
||||||
|
DownStatusBox,
|
||||||
|
PausedStatusBox,
|
||||||
|
InitializingStatusBox,
|
||||||
|
BreachedStatusBox,
|
||||||
|
} from "@/Components/design-elements";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
|
||||||
|
import type { MonitorsSummary } from "@/Types/Monitor";
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
|
|
||||||
|
interface MonitorsSummaryProps {
|
||||||
|
summary: MonitorsSummary | null;
|
||||||
|
showBreached?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HeaderMonitorsSummary = ({
|
||||||
|
summary,
|
||||||
|
showBreached = false,
|
||||||
|
}: MonitorsSummaryProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction={{ xs: "column", md: "row" }}
|
||||||
|
gap={theme.spacing(8)}
|
||||||
|
>
|
||||||
|
<UpStatusBox n={summary?.upMonitors || 0} />
|
||||||
|
<DownStatusBox n={summary?.downMonitors || 0} />
|
||||||
|
{showBreached && <BreachedStatusBox n={summary?.breachedMonitors || 0} />}
|
||||||
|
<PausedStatusBox n={summary?.pausedMonitors || 0} />
|
||||||
|
<InitializingStatusBox n={summary?.initializingMonitors || 0} />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { StatBox } from "@/Components/v2/design-elements";
|
import { StatBox } from "@/Components/design-elements";
|
||||||
|
|
||||||
import prettyMilliseconds from "pretty-ms";
|
import prettyMilliseconds from "pretty-ms";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { BaseChart, BaseBox } from "@/Components/v2/design-elements";
|
import { BaseChart, BaseBox } from "@/Components/design-elements";
|
||||||
import { Clock } from "lucide-react";
|
import { Clock } from "lucide-react";
|
||||||
import {
|
import {
|
||||||
AreaChart,
|
AreaChart,
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import {
|
import {
|
||||||
AreaChart,
|
AreaChart,
|
||||||
Area,
|
Area,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ResponsiveContainer,
|
ResponsiveContainer,
|
||||||
} from "recharts";
|
} from "recharts";
|
||||||
import { Fragment, useId } from "react";
|
import { Fragment, useId } from "react";
|
||||||
import { XTick } from "@/Components/v2/monitors";
|
import { XTick } from "@/Components/monitors";
|
||||||
|
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { HardwareCheckStats } from "@/Types/Monitor";
|
import type { HardwareCheckStats } from "@/Types/Monitor";
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip } from "recharts";
|
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip } from "recharts";
|
||||||
import { HistogramPageSpeedTooltip } from "@/Components/v2/monitors/charts/HistogramPageSpeedTooltip";
|
import { HistogramPageSpeedTooltip } from "@/Components/monitors/charts/HistogramPageSpeedTooltip";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { CheckSnapshot } from "@/Types/Check";
|
import type { CheckSnapshot } from "@/Types/Check";
|
||||||
import type { MonitorStatus } from "@/Types/Monitor";
|
import type { MonitorStatus } from "@/Types/Monitor";
|
||||||
+6
-6
@@ -1,6 +1,6 @@
|
|||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import { TrendingUp } from "lucide-react";
|
import { TrendingUp } from "lucide-react";
|
||||||
import { XTick } from "@/Components/v2/monitors/";
|
import { XTick } from "@/Components/monitors";
|
||||||
import {
|
import {
|
||||||
XAxis,
|
XAxis,
|
||||||
AreaChart,
|
AreaChart,
|
||||||
@@ -9,10 +9,10 @@ import {
|
|||||||
CartesianGrid,
|
CartesianGrid,
|
||||||
ResponsiveContainer,
|
ResponsiveContainer,
|
||||||
} from "recharts";
|
} from "recharts";
|
||||||
import { HistogramPageSpeedScoresTooltip } from "@/Components/v2/monitors";
|
import { HistogramPageSpeedScoresTooltip } from "@/Components/monitors";
|
||||||
|
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { CheckSnapshot } from "@/Types/Check";
|
import type { PageSpeedGroupedCheck } from "@/Types/Check";
|
||||||
import type { Palette } from "@mui/material/styles";
|
import type { Palette } from "@mui/material/styles";
|
||||||
type PaletteColorKey = Extract<
|
type PaletteColorKey = Extract<
|
||||||
keyof Palette,
|
keyof Palette,
|
||||||
@@ -52,7 +52,7 @@ export const HistogramPageSpeedDetails = ({
|
|||||||
checks,
|
checks,
|
||||||
range,
|
range,
|
||||||
}: {
|
}: {
|
||||||
checks: CheckSnapshot[];
|
checks: PageSpeedGroupedCheck[];
|
||||||
range: string;
|
range: string;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -73,7 +73,7 @@ export const HistogramPageSpeedDetails = ({
|
|||||||
>
|
>
|
||||||
<AreaChart data={checks}>
|
<AreaChart data={checks}>
|
||||||
<XAxis
|
<XAxis
|
||||||
dataKey={"createdAt"}
|
dataKey={"bucketDate"}
|
||||||
tick={(props) => (
|
tick={(props) => (
|
||||||
<XTick
|
<XTick
|
||||||
{...props}
|
{...props}
|
||||||
+8
-7
@@ -2,8 +2,9 @@ import Box from "@mui/material/Box";
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
|
||||||
import { formatDateWithTz } from "@/Utils/TimeUtils";
|
import { formatDateWithTz } from "@/Utils/TimeUtils";
|
||||||
import type { ConfigItem } from "@/Components/v2/monitors";
|
import type { ConfigItem } from "@/Components/monitors";
|
||||||
import type { TooltipProps } from "recharts";
|
import type { TooltipProps } from "recharts";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import type { RootState } from "@/Types/state";
|
import type { RootState } from "@/Types/state";
|
||||||
@@ -30,8 +31,8 @@ export const HistogramPageSpeedScoresTooltip = ({
|
|||||||
border: 1,
|
border: 1,
|
||||||
borderColor: theme.palette.divider,
|
borderColor: theme.palette.divider,
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
py: theme.spacing(2),
|
py: theme.spacing(SPACING.LG),
|
||||||
px: theme.spacing(4),
|
px: theme.spacing(LAYOUT.XS),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -54,12 +55,12 @@ export const HistogramPageSpeedScoresTooltip = ({
|
|||||||
key={`${key}-tooltip`}
|
key={`${key}-tooltip`}
|
||||||
direction="row"
|
direction="row"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
gap={theme.spacing(3)}
|
gap={theme.spacing(SPACING.XXL)}
|
||||||
mt={theme.spacing(1)}
|
mt={theme.spacing(SPACING.SM)}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
width={theme.spacing(4)}
|
width={theme.spacing(LAYOUT.XS)}
|
||||||
height={theme.spacing(4)}
|
height={theme.spacing(LAYOUT.XS)}
|
||||||
sx={{ borderRadius: "50%", backgroundColor: dotColor }}
|
sx={{ borderRadius: "50%", backgroundColor: dotColor }}
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { formatDateWithTz } from "@/Utils/timeUtilsLegacy";
|
import { formatDateWithTz } from "@/Utils/TimeUtils";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ResponsiveContainer, BarChart, XAxis, Bar, Cell, Tooltip } from "recharts";
|
import { ResponsiveContainer, BarChart, XAxis, Bar, Cell, Tooltip } from "recharts";
|
||||||
import { getResponseTimeColor } from "@/Utils/MonitorUtils";
|
import { getResponseTimeColor } from "@/Utils/MonitorUtils";
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import { FileText } from "lucide-react";
|
import { FileText } from "lucide-react";
|
||||||
import type { CheckAudits, CheckSnapshot } from "@/Types/Check";
|
import type { CheckAudits, CheckSnapshot } from "@/Types/Check";
|
||||||
import { Pie, PieChart, ResponsiveContainer, Label } from "recharts";
|
import { Pie, PieChart, ResponsiveContainer, Label } from "recharts";
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { BarChart3 } from "lucide-react";
|
import { BarChart3 } from "lucide-react";
|
||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import type { CheckSnapshot } from "@/Types/Check";
|
import type { CheckSnapshot } from "@/Types/Check";
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { BaseChart } from "@/Components/v2/design-elements";
|
import { BaseChart } from "@/Components/design-elements";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { Gauge } from "lucide-react";
|
import { Gauge } from "lucide-react";
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
export * from "./ControlsFilter";
|
export * from "./ControlsFilter";
|
||||||
export * from "./MonitorStatBoxes";
|
export * from "./MonitorStatBoxes";
|
||||||
export * from "./HeaderMonitorControls";
|
export * from "./HeaderMonitorControls";
|
||||||
|
export * from "./HeaderGeoTabs";
|
||||||
|
export * from "./GeoChecksMap";
|
||||||
export * from "./charts/HistogramStatus";
|
export * from "./charts/HistogramStatus";
|
||||||
export * from "./charts/RadialAvgResponse";
|
export * from "./charts/RadialAvgResponse";
|
||||||
export * from "./charts/HistogramDetails";
|
export * from "./charts/HistogramDetails";
|
||||||
@@ -11,3 +13,4 @@ export * from "./charts/PiePageSpeedLegend";
|
|||||||
export * from "./charts/HistogramPageSpeedDetails";
|
export * from "./charts/HistogramPageSpeedDetails";
|
||||||
export * from "./charts/HistogramPageSpeedDetailsTooltip";
|
export * from "./charts/HistogramPageSpeedDetailsTooltip";
|
||||||
export * from "./charts/HistogramInfrastructure";
|
export * from "./charts/HistogramInfrastructure";
|
||||||
|
export * from "./HeaderMonitorsSummary";
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { Navigate } from "react-router-dom";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import type { RootState } from "@/Types/state";
|
||||||
|
import type { UserRole } from "@/Types/User";
|
||||||
|
|
||||||
|
interface ProtectedRouteProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
||||||
|
const authState = useSelector((state: RootState) => state.auth);
|
||||||
|
|
||||||
|
return authState.authToken ? (
|
||||||
|
children
|
||||||
|
) : (
|
||||||
|
<Navigate
|
||||||
|
to="/login"
|
||||||
|
replace
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface RoleProtectedRouteProps {
|
||||||
|
roles: UserRole[];
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const RoleProtectedRoute = ({ roles, children }: RoleProtectedRouteProps) => {
|
||||||
|
const authState = useSelector((state: RootState) => state.auth);
|
||||||
|
const userRoles = authState?.user?.role || [];
|
||||||
|
const canAccess = userRoles.some((role) => roles.includes(role));
|
||||||
|
|
||||||
|
return canAccess ? (
|
||||||
|
children
|
||||||
|
) : (
|
||||||
|
<Navigate
|
||||||
|
to="/uptime"
|
||||||
|
replace
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Menu from "@mui/material/Menu";
|
||||||
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
|
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
|
||||||
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
|
import { MoreVertical, LogOut } from "lucide-react";
|
||||||
|
import { Avatar, Icon } from "@/Components/design-elements";
|
||||||
|
import { clearAuthState } from "@/Features/Auth/authSlice.js";
|
||||||
|
import type { RootState } from "@/Types/state.js";
|
||||||
|
|
||||||
|
interface AuthFooterProps {
|
||||||
|
collapsed: boolean;
|
||||||
|
accountMenuItems: Array<{
|
||||||
|
name: string;
|
||||||
|
path: string;
|
||||||
|
icon: React.ReactNode;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const theme = useTheme();
|
||||||
|
const user = useSelector((state: RootState) => state.auth.user);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
||||||
|
|
||||||
|
const menuOpen = Boolean(anchorEl);
|
||||||
|
const handleMenuOpen = (e: React.MouseEvent<HTMLElement>) =>
|
||||||
|
setAnchorEl(e.currentTarget);
|
||||||
|
const handleMenuClose = () => setAnchorEl(null);
|
||||||
|
|
||||||
|
const handleNavigate = (path: string) => {
|
||||||
|
handleMenuClose();
|
||||||
|
navigate(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLogout = () => {
|
||||||
|
dispatch(clearAuthState());
|
||||||
|
navigate("/login");
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRoleText = () => {
|
||||||
|
const role = user?.role ?? "";
|
||||||
|
if (role.includes("superadmin"))
|
||||||
|
return t("components.sidebar.authFooter.roles.superAdmin");
|
||||||
|
if (role.includes("admin")) return t("components.sidebar.authFooter.roles.admin");
|
||||||
|
if (role.includes("user")) return t("components.sidebar.authFooter.roles.user");
|
||||||
|
if (role.includes("demo")) return t("components.sidebar.authFooter.roles.demoUser");
|
||||||
|
return role;
|
||||||
|
};
|
||||||
|
|
||||||
|
const filteredMenuItems = accountMenuItems.filter((item) => {
|
||||||
|
if (!user) return false;
|
||||||
|
if (item.name === "Password" && user.role?.includes("demo")) return false;
|
||||||
|
if (item.name === "Team" && !user.role?.includes("superadmin")) return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const menuItemSx = {
|
||||||
|
gap: theme.spacing(LAYOUT.MD),
|
||||||
|
borderRadius: theme.shape.borderRadius,
|
||||||
|
pl: theme.spacing(LAYOUT.XS),
|
||||||
|
"& svg": { stroke: theme.palette.text.secondary },
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
py={theme.spacing(LAYOUT.XS)}
|
||||||
|
px={theme.spacing(LAYOUT.MD)}
|
||||||
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
small
|
||||||
|
onClick={collapsed ? handleMenuOpen : undefined}
|
||||||
|
sx={{ cursor: collapsed ? "pointer" : "default" }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{!collapsed && (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
gap={theme.spacing(SPACING.MD)}
|
||||||
|
minWidth={0}
|
||||||
|
flex={1}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
minWidth={0}
|
||||||
|
flex={1}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
fontWeight={500}
|
||||||
|
noWrap
|
||||||
|
sx={{ color: theme.palette.text.primary }}
|
||||||
|
>
|
||||||
|
{user?.firstName} {user?.lastName}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
noWrap
|
||||||
|
sx={{ textTransform: "capitalize", color: theme.palette.text.secondary }}
|
||||||
|
>
|
||||||
|
{getRoleText()}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleMenuOpen}
|
||||||
|
sx={{
|
||||||
|
"&:focus": { outline: "none" },
|
||||||
|
"& svg": { stroke: theme.palette.text.secondary },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon={MoreVertical}
|
||||||
|
size={22}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Menu
|
||||||
|
anchorEl={anchorEl}
|
||||||
|
open={menuOpen}
|
||||||
|
onClose={handleMenuClose}
|
||||||
|
disableScrollLock
|
||||||
|
anchorOrigin={{ vertical: "top", horizontal: "right" }}
|
||||||
|
slotProps={{
|
||||||
|
paper: {
|
||||||
|
sx: {
|
||||||
|
mt: theme.spacing(-LAYOUT.XS),
|
||||||
|
ml: collapsed ? theme.spacing(SPACING.LG) : 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
MenuListProps={{ sx: { p: 2, "& li": { m: 0 } } }}
|
||||||
|
sx={{ ml: theme.spacing(LAYOUT.XS) }}
|
||||||
|
>
|
||||||
|
{collapsed && (
|
||||||
|
<Box
|
||||||
|
px={2}
|
||||||
|
pb={2}
|
||||||
|
sx={{ pointerEvents: "none" }}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
fontWeight={500}
|
||||||
|
fontSize={13}
|
||||||
|
>
|
||||||
|
{user?.firstName} {user?.lastName}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
fontSize={12}
|
||||||
|
sx={{ textTransform: "capitalize" }}
|
||||||
|
>
|
||||||
|
{getRoleText()}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
{filteredMenuItems.map((item) => (
|
||||||
|
<MenuItem
|
||||||
|
key={item.name}
|
||||||
|
onClick={() => handleNavigate(item.path)}
|
||||||
|
sx={menuItemSx}
|
||||||
|
>
|
||||||
|
{item.icon}
|
||||||
|
{item.name}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
<MenuItem
|
||||||
|
onClick={handleLogout}
|
||||||
|
sx={menuItemSx}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon={LogOut}
|
||||||
|
size={20}
|
||||||
|
/>
|
||||||
|
{t("components.sidebar.authFooter.logOut")}
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
+15
-22
@@ -1,37 +1,37 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack, { type StackProps } from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useNavigate } from "react-router";
|
import { toggleSidebar } from "@/Features/UI/uiSlice.js";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import PropTypes from "prop-types";
|
import useSidebar from "@/Hooks/useSidebar";
|
||||||
|
|
||||||
const Logo = ({ collapsed }) => {
|
export const Logo = (props: StackProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const dispatch = useDispatch();
|
||||||
|
const { collapsed } = useSidebar();
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
pt={theme.spacing(6)}
|
|
||||||
pb={theme.spacing(12)}
|
|
||||||
pl={theme.spacing(8)}
|
|
||||||
direction="row"
|
direction="row"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
onClick={() => navigate("/")}
|
onClick={() => {
|
||||||
|
dispatch(toggleSidebar());
|
||||||
|
}}
|
||||||
sx={{ cursor: "pointer" }}
|
sx={{ cursor: "pointer" }}
|
||||||
|
{...props}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
pl={theme.spacing("1px")}
|
|
||||||
minWidth={theme.spacing(16)}
|
minWidth={theme.spacing(16)}
|
||||||
minHeight={theme.spacing(16)}
|
minHeight={theme.spacing(16)}
|
||||||
display={"flex"}
|
display={"flex"}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
backgroundColor={theme.palette.accent.main}
|
bgcolor={theme.palette.primary.main}
|
||||||
borderRadius={theme.shape.borderRadius}
|
borderRadius={theme.shape.borderRadius}
|
||||||
color={theme.palette.accent.contrastText}
|
color={theme.palette.primary.contrastText}
|
||||||
fontSize={18}
|
fontSize={18}
|
||||||
>
|
>
|
||||||
C
|
C
|
||||||
@@ -49,9 +49,8 @@ const Logo = ({ collapsed }) => {
|
|||||||
<Typography
|
<Typography
|
||||||
lineHeight={1}
|
lineHeight={1}
|
||||||
mt={theme.spacing(2)}
|
mt={theme.spacing(2)}
|
||||||
color={theme.palette.primary.contrastText}
|
variant="h2"
|
||||||
fontSize={"var(--env-var-font-size-medium-plus)"}
|
fontWeight={500}
|
||||||
sx={{ fontWeight: 500 }}
|
|
||||||
>
|
>
|
||||||
{t("common.appName")}
|
{t("common.appName")}
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -59,9 +58,3 @@ const Logo = ({ collapsed }) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Logo.propTypes = {
|
|
||||||
collapsed: PropTypes.bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Logo;
|
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
import { Icon } from "@/Components/design-elements";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Globe,
|
||||||
|
Gauge,
|
||||||
|
Link,
|
||||||
|
Bell,
|
||||||
|
FileText,
|
||||||
|
AlertTriangle,
|
||||||
|
Wifi,
|
||||||
|
Wrench,
|
||||||
|
Database,
|
||||||
|
Settings,
|
||||||
|
HelpCircle,
|
||||||
|
MessageCircle,
|
||||||
|
Code,
|
||||||
|
User,
|
||||||
|
Lock,
|
||||||
|
Users,
|
||||||
|
} from "lucide-react";
|
||||||
|
|
||||||
|
export const getMenu = (t: Function) => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.uptime"),
|
||||||
|
path: "uptime",
|
||||||
|
icon: <Icon icon={Globe} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.pagespeed"),
|
||||||
|
path: "pagespeed",
|
||||||
|
icon: <Icon icon={Gauge} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.infrastructure"),
|
||||||
|
path: "infrastructure",
|
||||||
|
icon: <Icon icon={Link} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.notifications"),
|
||||||
|
path: "notifications",
|
||||||
|
icon: <Icon icon={Bell} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.checks"),
|
||||||
|
path: "checks",
|
||||||
|
icon: <Icon icon={FileText} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.incidents"),
|
||||||
|
path: "incidents",
|
||||||
|
icon: <Icon icon={AlertTriangle} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.statusPages"),
|
||||||
|
path: "status",
|
||||||
|
icon: <Icon icon={Wifi} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.maintenance"),
|
||||||
|
path: "maintenance",
|
||||||
|
icon: <Icon icon={Wrench} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.logs"),
|
||||||
|
path: "logs",
|
||||||
|
icon: <Icon icon={Database} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.menu.settings"),
|
||||||
|
icon: <Icon icon={Settings} />,
|
||||||
|
path: "settings",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getBottomMenu = (t: Function) => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.bottomMenu.support"),
|
||||||
|
path: "support",
|
||||||
|
icon: <Icon icon={HelpCircle} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.bottomMenu.discussions"),
|
||||||
|
path: "discussions",
|
||||||
|
icon: <Icon icon={MessageCircle} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.bottomMenu.docs"),
|
||||||
|
path: "docs",
|
||||||
|
icon: <Icon icon={FileText} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.bottomMenu.changelog"),
|
||||||
|
path: "changelog",
|
||||||
|
icon: <Icon icon={Code} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getAccountMenu = (t: Function) => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.accountMenu.profile"),
|
||||||
|
path: "account/profile",
|
||||||
|
icon: <Icon icon={User} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.accountMenu.password"),
|
||||||
|
path: "account/password",
|
||||||
|
icon: <Icon icon={Lock} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t("components.sidebar.accountMenu.team"),
|
||||||
|
path: "account/team",
|
||||||
|
icon: <Icon icon={Users} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
+36
-22
@@ -3,19 +3,31 @@ import ListItemButton from "@mui/material/ListItemButton";
|
|||||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import PropTypes from "prop-types";
|
import useSidebar from "@/Hooks/useSidebar";
|
||||||
|
|
||||||
const NavItem = ({ item, collapsed, selected, onClick }) => {
|
export interface NavData {
|
||||||
|
name: string;
|
||||||
|
icon: React.ReactElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NavItem = ({
|
||||||
|
item,
|
||||||
|
selected,
|
||||||
|
onClick,
|
||||||
|
}: {
|
||||||
|
item: NavData;
|
||||||
|
selected: boolean;
|
||||||
|
onClick: (event: React.MouseEvent) => void;
|
||||||
|
}) => {
|
||||||
|
const { collapsed } = useSidebar();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const iconStroke = selected
|
const iconStroke = selected ? theme.palette.primary.main : theme.palette.text.secondary;
|
||||||
? theme.palette.primary.contrastText
|
|
||||||
: theme.palette.primary.contrastTextTertiary;
|
|
||||||
|
|
||||||
const buttonBgColor = selected ? theme.palette.secondary.main : "transparent";
|
const buttonBgColor = selected ? theme.palette.action.selected : "transparent";
|
||||||
const buttonBgHoverColor = selected
|
const buttonBgHoverColor = selected
|
||||||
? theme.palette.secondary.main
|
? theme.palette.action.selected
|
||||||
: theme.palette.tertiary.main;
|
: theme.palette.action.hover;
|
||||||
const fontWeight = selected ? 600 : 400;
|
const fontWeight = selected ? 600 : 400;
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@@ -38,10 +50,14 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
|||||||
<ListItemButton
|
<ListItemButton
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: buttonBgColor,
|
backgroundColor: buttonBgColor,
|
||||||
|
backgroundImage: "none",
|
||||||
|
border: 1,
|
||||||
|
borderColor: "transparent",
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: buttonBgHoverColor,
|
backgroundColor: buttonBgHoverColor,
|
||||||
|
backgroundImage: "none",
|
||||||
},
|
},
|
||||||
height: 37,
|
height: 32,
|
||||||
gap: theme.spacing(4),
|
gap: theme.spacing(4),
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
px: theme.spacing(4),
|
px: theme.spacing(4),
|
||||||
@@ -52,13 +68,20 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
|||||||
<ListItemIcon
|
<ListItemIcon
|
||||||
sx={{
|
sx={{
|
||||||
minWidth: 0,
|
minWidth: 0,
|
||||||
color: iconStroke,
|
|
||||||
"& svg": {
|
"& svg": {
|
||||||
height: 20,
|
height: 16,
|
||||||
width: 20,
|
width: 16,
|
||||||
opacity: 0.81,
|
opacity: 0.81,
|
||||||
|
transition: "stroke 0.2s ease",
|
||||||
|
},
|
||||||
|
"& svg path, & svg line, & svg polyline, & svg rect, & svg circle": {
|
||||||
stroke: iconStroke,
|
stroke: iconStroke,
|
||||||
},
|
},
|
||||||
|
".MuiListItemButton-root:hover &": {
|
||||||
|
"& svg path, & svg line, & svg polyline, & svg rect, & svg circle": {
|
||||||
|
stroke: theme.palette.primary.main,
|
||||||
|
},
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.icon}
|
{item.icon}
|
||||||
@@ -73,7 +96,6 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
|||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body1"
|
||||||
color={theme.palette.primary.contrastText}
|
|
||||||
sx={{
|
sx={{
|
||||||
fontWeight: fontWeight,
|
fontWeight: fontWeight,
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
@@ -86,11 +108,3 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
NavItem.propTypes = {
|
|
||||||
item: PropTypes.object,
|
|
||||||
collapsed: PropTypes.bool,
|
|
||||||
selected: PropTypes.bool,
|
|
||||||
onClick: PropTypes.func,
|
|
||||||
};
|
|
||||||
export default NavItem;
|
|
||||||
+29
-36
@@ -1,18 +1,26 @@
|
|||||||
import React from "react";
|
|
||||||
import { Typography, IconButton, Stack, Box } from "@mui/material";
|
import { Typography, IconButton, Stack, Box } from "@mui/material";
|
||||||
import Icon from "../Icon";
|
import { Icon } from "@/Components/design-elements";
|
||||||
import { useTheme } from "@emotion/react";
|
import { X } from "lucide-react";
|
||||||
|
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
|
||||||
|
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { setStarPromptOpen } from "../../../Features/UI/uiSlice.js";
|
import { setStarPromptOpen } from "@/Features/UI/uiSlice.js";
|
||||||
|
import type { RootState } from "@/Types/state.js";
|
||||||
|
import useSidebar from "@/Hooks/useSidebar.js";
|
||||||
|
|
||||||
const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" }) => {
|
export const StarPrompt = ({
|
||||||
|
repoUrl = "https://github.com/bluewave-labs/checkmate",
|
||||||
|
}: {
|
||||||
|
repoUrl?: string;
|
||||||
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isOpen = useSelector((state) => state.ui?.starPromptOpen ?? true);
|
const isOpen = useSelector((state: RootState) => state.ui?.starPromptOpen ?? true);
|
||||||
const mode = useSelector((state) => state.ui.mode);
|
const mode = useSelector((state: RootState) => state.ui.mode);
|
||||||
|
const { collapsed } = useSidebar();
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
dispatch(setStarPromptOpen(false));
|
dispatch(setStarPromptOpen(false));
|
||||||
};
|
};
|
||||||
@@ -21,38 +29,30 @@ const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" })
|
|||||||
window.open(repoUrl, "_blank");
|
window.open(repoUrl, "_blank");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (collapsed) return null;
|
||||||
if (!isOpen) return null;
|
if (!isOpen) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
direction="column"
|
direction="column"
|
||||||
sx={{
|
gap={theme.spacing(LAYOUT.MD)}
|
||||||
width: "100%",
|
padding={theme.spacing(LAYOUT.SM)}
|
||||||
padding: `${theme.spacing(6)} ${theme.spacing(6)}`,
|
width={"100%"}
|
||||||
borderTop: `1px solid ${theme.palette.primary.lowContrast}`,
|
borderTop={`1px solid ${theme.palette.divider}`}
|
||||||
borderBottom: `1px solid ${theme.palette.primary.lowContrast}`,
|
borderBottom={`1px solid ${theme.palette.divider}`}
|
||||||
borderRadius: 0,
|
|
||||||
gap: theme.spacing(1.5),
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
width="100%"
|
width="100%"
|
||||||
pl={theme.spacing(4)}
|
pl={theme.spacing(LAYOUT.XS)}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
sx={{
|
mt={theme.spacing(SPACING.XXL)}
|
||||||
color:
|
|
||||||
mode === "dark"
|
|
||||||
? theme.palette.primary.contrastText
|
|
||||||
: theme.palette.text.primary,
|
|
||||||
mt: theme.spacing(3),
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{t("starPromptTitle")}
|
{t("components.sidebar.starPrompt.title")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={handleClose}
|
onClick={handleClose}
|
||||||
@@ -60,7 +60,6 @@ const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" })
|
|||||||
sx={{
|
sx={{
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
marginTop: theme.spacing(-5),
|
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
@@ -68,23 +67,19 @@ const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" })
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
name="X"
|
icon={X}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
|
||||||
sx={{
|
sx={{
|
||||||
color: theme.palette.primary.contrastTextTertiary,
|
|
||||||
fontSize: "0.938rem",
|
|
||||||
lineHeight: 1.5,
|
|
||||||
mb: 1,
|
mb: 1,
|
||||||
px: theme.spacing(4),
|
px: theme.spacing(LAYOUT.XS),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("starPromptDescription")}
|
{t("components.sidebar.starPrompt.description")}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
@@ -99,12 +94,10 @@ const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" })
|
|||||||
"&:hover": {
|
"&:hover": {
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
},
|
},
|
||||||
pl: theme.spacing(4),
|
pl: theme.spacing(LAYOUT.XS),
|
||||||
filter: mode === "dark" ? "invert(1)" : "none",
|
filter: mode === "dark" ? "invert(1)" : "none",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default StarPrompt;
|
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import { useEffect } from "react";
|
||||||
|
import Backdrop from "@mui/material/Backdrop";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import List from "@mui/material/List";
|
||||||
|
import Divider from "@mui/material/Divider";
|
||||||
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
|
import { useSidebar } from "@/Hooks/useSidebar.js";
|
||||||
|
import { Logo } from "@/Components/sidebar/Logo";
|
||||||
|
import { getMenu, getBottomMenu, getAccountMenu } from "@/Components/sidebar/Menu";
|
||||||
|
import { NavItem } from "@/Components/sidebar/NavItem";
|
||||||
|
import { StarPrompt } from "@/Components/sidebar/StarPrompt";
|
||||||
|
import { AuthFooter } from "@/Components/sidebar/Authfooter";
|
||||||
|
|
||||||
|
import { useNavigate, useLocation } from "react-router";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useTheme, useMediaQuery } from "@mui/material";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
import { setCollapsed } from "@/Features/UI/uiSlice";
|
||||||
|
|
||||||
|
const URL_MAP: Record<string, string> = {
|
||||||
|
support: "https://discord.com/invite/NAb6H3UTjK",
|
||||||
|
discussions: "https://github.com/bluewave-labs/checkmate/discussions",
|
||||||
|
docs: "https://bluewavelabs.gitbook.io/checkmate",
|
||||||
|
changelog: "https://github.com/bluewave-labs/checkmate/releases",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Sidebar = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { width, transition, collapsed } = useSidebar();
|
||||||
|
const theme = useTheme();
|
||||||
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
|
const menu = getMenu(t);
|
||||||
|
const bottomMenu = getBottomMenu(t);
|
||||||
|
const accountMenu = getAccountMenu(t);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(setCollapsed({ collapsed: isSmall }));
|
||||||
|
}, [isSmall, dispatch]);
|
||||||
|
|
||||||
|
const handleNavClick = (path: string) => {
|
||||||
|
const url = URL_MAP[path];
|
||||||
|
if (url) {
|
||||||
|
window.open(url, "_blank", "noreferrer");
|
||||||
|
} else {
|
||||||
|
navigate(`/${path}`);
|
||||||
|
}
|
||||||
|
if (isSmall) {
|
||||||
|
dispatch(setCollapsed({ collapsed: true }));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Backdrop
|
||||||
|
open={!collapsed && isSmall}
|
||||||
|
onClick={() => dispatch(setCollapsed({ collapsed: true }))}
|
||||||
|
sx={{ zIndex: 999 }}
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
component="aside"
|
||||||
|
position={isSmall ? "fixed" : "sticky"}
|
||||||
|
top={0}
|
||||||
|
left={0}
|
||||||
|
minHeight={"100vh"}
|
||||||
|
maxHeight={"100vh"}
|
||||||
|
paddingTop={theme.spacing(LAYOUT.SM)}
|
||||||
|
paddingBottom={theme.spacing(LAYOUT.SM)}
|
||||||
|
gap={theme.spacing(LAYOUT.SM)}
|
||||||
|
borderRight={`1px solid ${theme.palette.divider}`}
|
||||||
|
width={width}
|
||||||
|
sx={{
|
||||||
|
touchAction: "none",
|
||||||
|
transition: transition,
|
||||||
|
zIndex: 1000,
|
||||||
|
backdropFilter: "blur(8px)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<List
|
||||||
|
component="nav"
|
||||||
|
disablePadding
|
||||||
|
sx={{
|
||||||
|
px: theme.spacing(LAYOUT.SM),
|
||||||
|
flex: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Logo
|
||||||
|
pt={theme.spacing(LAYOUT.MD)}
|
||||||
|
pb={theme.spacing(LAYOUT.MD)}
|
||||||
|
/>
|
||||||
|
{menu.map((item) => {
|
||||||
|
const selected = location.pathname.startsWith(`/${item.path}`);
|
||||||
|
return (
|
||||||
|
<NavItem
|
||||||
|
key={item.path}
|
||||||
|
item={item}
|
||||||
|
selected={selected}
|
||||||
|
onClick={() => handleNavClick(item.path)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</List>
|
||||||
|
<StarPrompt />
|
||||||
|
<List
|
||||||
|
component="nav"
|
||||||
|
disablePadding
|
||||||
|
sx={{ px: theme.spacing(LAYOUT.SM) }}
|
||||||
|
>
|
||||||
|
{bottomMenu.map((item) => {
|
||||||
|
const selected = location.pathname.startsWith(`/${item.path}`);
|
||||||
|
return (
|
||||||
|
<NavItem
|
||||||
|
key={item.path}
|
||||||
|
item={item}
|
||||||
|
selected={selected}
|
||||||
|
onClick={() => handleNavClick(item.path)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</List>
|
||||||
|
<Divider sx={{ borderColor: theme.palette.divider }} />
|
||||||
|
|
||||||
|
<AuthFooter
|
||||||
|
collapsed={collapsed}
|
||||||
|
accountMenuItems={accountMenu}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,228 +0,0 @@
|
|||||||
// Components
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
import Menu from "@mui/material/Menu";
|
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
|
||||||
import Icon from "../Icon";
|
|
||||||
import Dialog from "../Dialog/index.jsx";
|
|
||||||
|
|
||||||
// Utils
|
|
||||||
import { useState } from "react";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import { createToast } from "../../../Utils/toastUtils.jsx";
|
|
||||||
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import { usePauseMonitor, useDeleteMonitor } from "../../../Hooks/monitorHooks.js";
|
|
||||||
|
|
||||||
const ActionsMenu = ({
|
|
||||||
monitor,
|
|
||||||
isAdmin,
|
|
||||||
updateRowCallback,
|
|
||||||
pauseCallback,
|
|
||||||
setIsLoading = () => {},
|
|
||||||
}) => {
|
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
|
||||||
const [actions, setActions] = useState({});
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
|
||||||
const theme = useTheme();
|
|
||||||
const [pauseMonitor, isPausing, error] = usePauseMonitor();
|
|
||||||
const [deleteMonitor, isDeleting] = useDeleteMonitor();
|
|
||||||
|
|
||||||
const handleRemove = async (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
let monitor = { id: actions.id };
|
|
||||||
await deleteMonitor({ monitor });
|
|
||||||
updateRowCallback();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlePause = async () => {
|
|
||||||
try {
|
|
||||||
setIsLoading(true);
|
|
||||||
await pauseMonitor({ monitorId: monitor.id });
|
|
||||||
pauseCallback();
|
|
||||||
} catch (error) {
|
|
||||||
createToast({ body: "Failed to pause monitor." });
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const openMenu = (event, id, url) => {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
setAnchorEl(event.currentTarget);
|
|
||||||
setActions({ id: id, url: url });
|
|
||||||
};
|
|
||||||
|
|
||||||
const openRemove = (e) => {
|
|
||||||
closeMenu(e);
|
|
||||||
setIsOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeMenu = (e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setAnchorEl(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<IconButton
|
|
||||||
aria-label="monitor actions"
|
|
||||||
onClick={(event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
openMenu(event, monitor.id, monitor.type === "ping" ? null : monitor.url);
|
|
||||||
}}
|
|
||||||
sx={{
|
|
||||||
"&:focus": {
|
|
||||||
outline: "none",
|
|
||||||
},
|
|
||||||
"& svg path": {
|
|
||||||
stroke: theme.palette.primary.contrastTextTertiary,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name="Settings"
|
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
|
|
||||||
<Menu
|
|
||||||
className="actions-menu"
|
|
||||||
anchorEl={anchorEl}
|
|
||||||
open={Boolean(anchorEl)}
|
|
||||||
onClose={(e) => closeMenu(e)}
|
|
||||||
disableScrollLock
|
|
||||||
slotProps={{
|
|
||||||
paper: {
|
|
||||||
sx: {
|
|
||||||
"& ul": {
|
|
||||||
p: theme.spacing(2.5),
|
|
||||||
backgroundColor: theme.palette.primary.main,
|
|
||||||
},
|
|
||||||
"& li": { m: 0, color: theme.palette.primary.contrastTextSecondary },
|
|
||||||
/*
|
|
||||||
This should not be set automatically on the last of type
|
|
||||||
"& li:last-of-type": {
|
|
||||||
color: theme.palette.error.main,
|
|
||||||
}, */
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{actions.url !== null ? (
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
closeMenu(e);
|
|
||||||
e.stopPropagation();
|
|
||||||
window.open(actions.url, "_blank", "noreferrer");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Open site
|
|
||||||
</MenuItem>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
navigate(`/uptime/${actions.id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Details
|
|
||||||
</MenuItem>
|
|
||||||
{/* TODO - pass monitor id to Incidents page */}
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
navigate(`/incidents/${actions.id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Incidents
|
|
||||||
</MenuItem>
|
|
||||||
{isAdmin && (
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
navigate(`/uptime/configure/${actions.id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Configure
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
{isAdmin && (
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
navigate(`/uptime/create/${actions.id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Clone
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
{isAdmin && (
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
closeMenu(e);
|
|
||||||
|
|
||||||
e.stopPropagation();
|
|
||||||
handlePause(e);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{monitor?.isActive === true ? "Pause" : "Resume"}
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
{isAdmin && (
|
|
||||||
<MenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
openRemove(e);
|
|
||||||
}}
|
|
||||||
sx={{ "&.MuiButtonBase-root": { color: theme.palette.error.main } }}
|
|
||||||
>
|
|
||||||
Remove
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
</Menu>
|
|
||||||
<Dialog
|
|
||||||
open={isOpen}
|
|
||||||
theme={theme}
|
|
||||||
title="Do you really want to delete this monitor?"
|
|
||||||
description="Once deleted, this monitor cannot be retrieved."
|
|
||||||
/* Do we need stop propagation? */
|
|
||||||
onCancel={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setIsOpen(false);
|
|
||||||
}}
|
|
||||||
confirmationButtonLabel="Delete"
|
|
||||||
/* Do we need stop propagation? */
|
|
||||||
onConfirm={(e) => {
|
|
||||||
console.log(e);
|
|
||||||
e.stopPropagation();
|
|
||||||
handleRemove(e);
|
|
||||||
}}
|
|
||||||
isLoading={isDeleting}
|
|
||||||
modelTitle="modal-delete-monitor"
|
|
||||||
modelDescription="delete-monitor-confirmation"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
ActionsMenu.propTypes = {
|
|
||||||
monitor: PropTypes.shape({
|
|
||||||
id: PropTypes.string,
|
|
||||||
url: PropTypes.string,
|
|
||||||
type: PropTypes.string,
|
|
||||||
isActive: PropTypes.bool,
|
|
||||||
}).isRequired,
|
|
||||||
isAdmin: PropTypes.bool,
|
|
||||||
updateRowCallback: PropTypes.func,
|
|
||||||
pauseCallback: PropTypes.func,
|
|
||||||
setIsLoading: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ActionsMenu;
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
.alert {
|
|
||||||
margin: 0;
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
.alert,
|
|
||||||
.alert button,
|
|
||||||
.alert .MuiTypography-root {
|
|
||||||
font-size: var(--env-var-font-size-medium);
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { Box, Button, IconButton, Stack, Typography } from "@mui/material";
|
|
||||||
import Icon from "../Icon";
|
|
||||||
import "./index.css";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Icons mapping for different alert variants.
|
|
||||||
* @type {Object<string, JSX.Element>}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const icons = {
|
|
||||||
info: (
|
|
||||||
<Icon
|
|
||||||
name="Info"
|
|
||||||
size={24}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
error: (
|
|
||||||
<Icon
|
|
||||||
name="AlertCircle"
|
|
||||||
size={24}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
warning: (
|
|
||||||
<Icon
|
|
||||||
name="AlertTriangle"
|
|
||||||
size={24}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} props
|
|
||||||
* @param {'info' | 'error' | 'warning'} props.variant - The type of alert.
|
|
||||||
* @param {string} [props.title] - The title of the alert.
|
|
||||||
* @param {string} [props.body] - The body text of the alert.
|
|
||||||
* @param {boolean} [props.isToast] - Indicates if the alert is used as a toast notification.
|
|
||||||
* @param {boolean} [props.hasIcon] - Whether to display an icon in the alert.
|
|
||||||
* @param {function} props.onClick - Toast dismiss function.
|
|
||||||
* @returns {JSX.Element}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
/* TODO
|
|
||||||
Do we need other variants for alert?
|
|
||||||
*/
|
|
||||||
|
|
||||||
const text = theme.palette.secondary.contrastText;
|
|
||||||
const border = theme.palette.alert.contrastText;
|
|
||||||
const bg = theme.palette.alert.main;
|
|
||||||
const icon = icons[variant];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="flex-start"
|
|
||||||
alignItems={hasIcon ? "" : "center"}
|
|
||||||
className="alert row-stack"
|
|
||||||
gap={theme.spacing(8)}
|
|
||||||
sx={{
|
|
||||||
padding: hasIcon ? theme.spacing(8) : `${theme.spacing(4)} ${theme.spacing(8)}`,
|
|
||||||
backgroundColor: bg,
|
|
||||||
border: `solid 1px ${border}`,
|
|
||||||
borderRadius: theme.shape.borderRadius,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{hasIcon && <Box sx={{ color: text }}>{icon}</Box>}
|
|
||||||
<Stack
|
|
||||||
direction="column"
|
|
||||||
gap="2px"
|
|
||||||
sx={{ flex: 1 }}
|
|
||||||
>
|
|
||||||
{title && (
|
|
||||||
<Typography sx={{ fontWeight: "700", color: `${text}` }}>{title}</Typography>
|
|
||||||
)}
|
|
||||||
{body && (
|
|
||||||
<Typography sx={{ fontWeight: "400", color: `${text}` }}>{body}</Typography>
|
|
||||||
)}
|
|
||||||
{hasIcon && isToast && (
|
|
||||||
<Button
|
|
||||||
variant="text"
|
|
||||||
color="info"
|
|
||||||
onClick={onClick}
|
|
||||||
sx={{
|
|
||||||
fontWeight: "600",
|
|
||||||
width: "fit-content",
|
|
||||||
mt: theme.spacing(4),
|
|
||||||
padding: 0,
|
|
||||||
minWidth: 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Dismiss
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
{isToast && (
|
|
||||||
<IconButton
|
|
||||||
onClick={onClick}
|
|
||||||
sx={{
|
|
||||||
alignSelf: "flex-start",
|
|
||||||
ml: "auto",
|
|
||||||
mr: "-5px",
|
|
||||||
mt: hasIcon ? "-5px" : 0,
|
|
||||||
padding: "5px",
|
|
||||||
"&:focus": {
|
|
||||||
outline: "none",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name="X"
|
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Alert.propTypes = {
|
|
||||||
variant: PropTypes.oneOf(["info", "error", "warning"]).isRequired,
|
|
||||||
title: PropTypes.string,
|
|
||||||
body: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
||||||
isToast: PropTypes.bool,
|
|
||||||
hasIcon: PropTypes.bool,
|
|
||||||
onClick: function (props, propName, componentName) {
|
|
||||||
if (props.isToast && !props[propName]) {
|
|
||||||
return new Error(
|
|
||||||
`Prop '${propName}' is required when 'isToast' is true in '${componentName}'.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Alert;
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
import { Box, Stack, useTheme } from "@mui/material";
|
|
||||||
// import useUtils from "../../Pages/Uptime/utils";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A component that renders a pulsating dot with a specified color.
|
|
||||||
*
|
|
||||||
* @component
|
|
||||||
* @example
|
|
||||||
* // Example usage:
|
|
||||||
* <PulseDot color="#f00" />
|
|
||||||
*
|
|
||||||
* @param {Object} props
|
|
||||||
* @param {string} props.color - The color of the dot.
|
|
||||||
* @returns {JSX.Element} The PulseDot component.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const PulseDot = ({ color }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
// const { statusToTheme } = useUtils();
|
|
||||||
/* TODO refactor so it gets status and gets theme color. Then uses theme.palette.[themeColor].lowContrast */
|
|
||||||
/* const themeColor = statusToTheme[status]; */
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
width="26px"
|
|
||||||
height="24px"
|
|
||||||
alignItems="center"
|
|
||||||
justifyContent="center"
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
minWidth="18px"
|
|
||||||
minHeight="18px"
|
|
||||||
sx={{
|
|
||||||
position: "relative",
|
|
||||||
backgroundColor: color,
|
|
||||||
borderRadius: "50%",
|
|
||||||
"&::before": {
|
|
||||||
content: `""`,
|
|
||||||
position: "absolute",
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
backgroundColor: "inherit",
|
|
||||||
borderRadius: "50%",
|
|
||||||
animation: "ripple 1.8s ease-out infinite",
|
|
||||||
},
|
|
||||||
"&::after": {
|
|
||||||
content: `""`,
|
|
||||||
position: "absolute",
|
|
||||||
width: "7px",
|
|
||||||
height: "7px",
|
|
||||||
borderRadius: "50%",
|
|
||||||
backgroundColor: theme.palette.accent.contrastText,
|
|
||||||
top: "50%",
|
|
||||||
left: "50%",
|
|
||||||
transform: "translate(-50%, -50%)",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
PulseDot.propTypes = {
|
|
||||||
color: PropTypes.string.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default PulseDot;
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import Icon from "../Icon";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
|
|
||||||
const ArrowLeft = ({ type, color = "#667085", ...props }) => {
|
|
||||||
if (type === "double") {
|
|
||||||
return (
|
|
||||||
<Icon
|
|
||||||
name="ChevronsLeft"
|
|
||||||
color={color}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else if (type === "long") {
|
|
||||||
return (
|
|
||||||
<Icon
|
|
||||||
name="ArrowLeft"
|
|
||||||
color={color}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<Icon
|
|
||||||
name="ChevronLeft"
|
|
||||||
color={color}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ArrowLeft.propTypes = {
|
|
||||||
color: PropTypes.string,
|
|
||||||
type: PropTypes.oneOf(["double", "long", "default"]),
|
|
||||||
};
|
|
||||||
export default ArrowLeft;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import Icon from "../Icon";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
|
|
||||||
const ArrowRight = ({ type, color = "#667085", ...props }) => {
|
|
||||||
if (type === "double") {
|
|
||||||
return (
|
|
||||||
<Icon
|
|
||||||
name="ChevronsRight"
|
|
||||||
color={color}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<Icon
|
|
||||||
name="ChevronRight"
|
|
||||||
color={color}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ArrowRight.propTypes = {
|
|
||||||
type: PropTypes.oneOf(["double", "default"]),
|
|
||||||
color: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ArrowRight;
|
|
||||||
Whitespace-only changes.
@@ -1,73 +0,0 @@
|
|||||||
import { Avatar as MuiAvatar } from "@mui/material";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
/**
|
|
||||||
* @component
|
|
||||||
* @param {Object} props
|
|
||||||
* @param {string} props.src - Path to image for avatar
|
|
||||||
* @param {boolean} props.small - Specifies if avatar should be large
|
|
||||||
* @param {Object} [props.sx] - Additional styles to apply to the button.
|
|
||||||
* @returns {JSX.Element}
|
|
||||||
* @example
|
|
||||||
* // Render a red label
|
|
||||||
* <Avatar src="assets/img" first="Alex" last="Holliday" small />
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Avatar = ({ src, small, sx, onClick = () => {} }) => {
|
|
||||||
const { user } = useSelector((state) => state.auth);
|
|
||||||
const theme = useTheme();
|
|
||||||
|
|
||||||
const style = small ? { width: 32, height: 32 } : { width: 64, height: 64 };
|
|
||||||
const border = small ? 1 : 3;
|
|
||||||
|
|
||||||
const [image, setImage] = useState();
|
|
||||||
useEffect(() => {
|
|
||||||
if (user.avatarImage) {
|
|
||||||
setImage(`data:image/png;base64,${user.avatarImage}`);
|
|
||||||
}
|
|
||||||
}, [user?.avatarImage]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MuiAvatar
|
|
||||||
onClick={onClick}
|
|
||||||
alt={`${user?.firstName} ${user?.lastName}`}
|
|
||||||
/* TODO What is the /static/images/avatar/2.jpg ?*/
|
|
||||||
src={src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"}
|
|
||||||
sx={{
|
|
||||||
fontSize: small ? "16px" : "22px",
|
|
||||||
fontWeight: 400,
|
|
||||||
color: theme.palette.accent.contrastText,
|
|
||||||
backgroundColor: theme.palette.accent.main, // Same BG color as checkmate BG in sidebar
|
|
||||||
display: "inline-flex",
|
|
||||||
/*
|
|
||||||
TODO not sure what this is for*/
|
|
||||||
"&::before": {
|
|
||||||
content: `""`,
|
|
||||||
position: "absolute",
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
width: `100%`,
|
|
||||||
height: `100%`,
|
|
||||||
border: `${border}px solid rgba(255,255,255,0.2)`,
|
|
||||||
borderRadius: "50%",
|
|
||||||
},
|
|
||||||
...style,
|
|
||||||
...sx,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{user.firstName?.charAt(0)}
|
|
||||||
{user.lastName?.charAt(0) || ""}
|
|
||||||
</MuiAvatar>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Avatar.propTypes = {
|
|
||||||
src: PropTypes.string,
|
|
||||||
small: PropTypes.bool,
|
|
||||||
sx: PropTypes.object,
|
|
||||||
onClick: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Avatar;
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
.MuiBreadcrumbs-root {
|
|
||||||
min-height: 34px;
|
|
||||||
}
|
|
||||||
.MuiBreadcrumbs-root svg {
|
|
||||||
width: 16px;
|
|
||||||
min-height: 16px;
|
|
||||||
}
|
|
||||||
.MuiBreadcrumbs-root .MuiBreadcrumbs-li a {
|
|
||||||
font-size: var(--env-var-font-size-medium);
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
.MuiBreadcrumbs-root .MuiBreadcrumbs-li:not(:last-child) {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.MuiBreadcrumbs-root .MuiBreadcrumbs-li:last-child a {
|
|
||||||
font-weight: 500;
|
|
||||||
opacity: 1;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
.MuiBreadcrumbs-root .MuiBreadcrumbs-separator {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
import { Box, Breadcrumbs as MUIBreadcrumbs } from "@mui/material";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import ArrowRight from "../ArrowRight/index.jsx";
|
|
||||||
import "./index.css";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Breadcrumbs component that displays a list of breadcrumb items.
|
|
||||||
*
|
|
||||||
* @param {Object} props
|
|
||||||
* @param {Array} props.list - Array of breadcrumb items. Each item should have `name` and `path` properties.
|
|
||||||
* @param {string} props.list.name - The name to display for the breadcrumb.
|
|
||||||
* @param {string} props.list.path - The path to navigate to when the breadcrumb is clicked.
|
|
||||||
*
|
|
||||||
* @returns {JSX.Element} The rendered Breadcrumbs component.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Breadcrumbs = ({ list }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MUIBreadcrumbs
|
|
||||||
separator={<ArrowRight />}
|
|
||||||
aria-label="breadcrumb"
|
|
||||||
px={theme.spacing(2)}
|
|
||||||
py={theme.spacing(3.5)}
|
|
||||||
width="fit-content"
|
|
||||||
backgroundColor={theme.palette.secondary.main}
|
|
||||||
borderRadius={theme.shape.borderRadius}
|
|
||||||
lineHeight="18px"
|
|
||||||
sx={{
|
|
||||||
"& .MuiBreadcrumbs-li a": {
|
|
||||||
transition: "background-color 0.2s ease-in-out, color 0.2s ease-in-out",
|
|
||||||
},
|
|
||||||
"& .MuiBreadcrumbs-li:not(:last-of-type):hover a": {
|
|
||||||
backgroundColor: theme.palette.secondary.contrastText,
|
|
||||||
color: theme.palette.secondary.main,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{list.map((item, index) => {
|
|
||||||
return (
|
|
||||||
<Box
|
|
||||||
component="a"
|
|
||||||
key={`${item.name}-${index}`}
|
|
||||||
px={theme.spacing(4)}
|
|
||||||
pt={theme.spacing(2)}
|
|
||||||
pb={theme.spacing(3)}
|
|
||||||
borderRadius={theme.shape.borderRadius}
|
|
||||||
onClick={() => navigate(item.path)}
|
|
||||||
sx={{
|
|
||||||
opacity: 0.8,
|
|
||||||
textTransform: "capitalize",
|
|
||||||
"&, &:hover": {
|
|
||||||
color: theme.palette.secondary.contrastText,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item.name}
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</MUIBreadcrumbs>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Breadcrumbs.propTypes = {
|
|
||||||
list: PropTypes.arrayOf(
|
|
||||||
PropTypes.shape({
|
|
||||||
name: PropTypes.string.isRequired,
|
|
||||||
path: PropTypes.string.isRequired,
|
|
||||||
}).isRequired
|
|
||||||
).isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Breadcrumbs;
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import Button from "@mui/material/Button";
|
|
||||||
import { styled } from "@mui/material/styles";
|
|
||||||
|
|
||||||
const RoundGradientButton = styled(Button)(({ theme }) => ({
|
|
||||||
position: "relative",
|
|
||||||
border: "5px solid transparent",
|
|
||||||
backgroundClip: "padding-box",
|
|
||||||
borderRadius: 30,
|
|
||||||
fontSize: "1.2rem",
|
|
||||||
color: theme.palette.primary.contrastText,
|
|
||||||
backgroundColor: theme.palette.background.main,
|
|
||||||
|
|
||||||
"&:after": {
|
|
||||||
position: "absolute",
|
|
||||||
top: -3,
|
|
||||||
left: -3,
|
|
||||||
right: -3,
|
|
||||||
bottom: -3,
|
|
||||||
background:
|
|
||||||
theme.palette.mode === "dark"
|
|
||||||
? "linear-gradient(90deg, #842bd2, #ff5451, #8c52ff)"
|
|
||||||
: "linear-gradient(90deg, #842bd2, #ff5451, #8c52ff)",
|
|
||||||
content: '""',
|
|
||||||
zIndex: -1,
|
|
||||||
borderRadius: 30,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export default RoundGradientButton;
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
/**
|
|
||||||
* CustomAreaChart component for rendering an area chart with optional gradient and custom ticks.
|
|
||||||
*
|
|
||||||
* @param {Object} props - The properties object.
|
|
||||||
* @param {Array} props.data - The data array for the chart.
|
|
||||||
* @param {Array} props.dataKeys - An array of data keys to be plotted as separate areas.
|
|
||||||
* @param {string} props.xKey - The key for the x-axis data.
|
|
||||||
* @param {string} [props.yKey] - The key for the y-axis data (optional).
|
|
||||||
* @param {Object} [props.xTick] - Custom tick component for the x-axis.
|
|
||||||
* @param {Object} [props.yTick] - Custom tick component for the y-axis.
|
|
||||||
* @param {string} [props.strokeColor] - The base stroke color for the areas.
|
|
||||||
* If not provided, uses a predefined color palette.
|
|
||||||
* @param {string} [props.fillColor] - The base fill color for the areas.
|
|
||||||
* @param {boolean} [props.gradient=false] - Whether to apply a gradient fill to the areas.
|
|
||||||
* @param {string} [props.gradientDirection="vertical"] - The direction of the gradient.
|
|
||||||
* @param {string} [props.gradientStartColor] - The start color of the gradient.
|
|
||||||
* Defaults to the area's stroke color if not provided.
|
|
||||||
* @param {string} [props.gradientEndColor] - The end color of the gradient.
|
|
||||||
* @param {Object} [props.customTooltip] - Custom tooltip component for the chart.
|
|
||||||
* @param {string|number} [props.height="100%"] - Height of the chart container.
|
|
||||||
*
|
|
||||||
* @returns {JSX.Element} The rendered area chart component.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* // Single series chart
|
|
||||||
* <CustomAreaChart
|
|
||||||
* data={temperatureData}
|
|
||||||
* dataKeys={["temperature"]}
|
|
||||||
* xKey="date"
|
|
||||||
* yKey="temperature"
|
|
||||||
* gradient={true}
|
|
||||||
* gradientStartColor="#ff6b6b"
|
|
||||||
* gradientEndColor="#4ecdc4"
|
|
||||||
* />
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* // Multi-series chart with custom tooltip
|
|
||||||
* <CustomAreaChart
|
|
||||||
* data={performanceData}
|
|
||||||
* dataKeys={["cpu.usage", "memory.usage"]}
|
|
||||||
* xKey="timestamp"
|
|
||||||
* xTick={<CustomTimeTick />}
|
|
||||||
* yTick={<PercentageTick />}
|
|
||||||
* gradient={true}
|
|
||||||
* customTooltip={({ active, payload, label }) => (
|
|
||||||
* <CustomTooltip
|
|
||||||
* label={label}
|
|
||||||
* payload={payload}
|
|
||||||
* active={active}
|
|
||||||
* />
|
|
||||||
* )}
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {
|
|
||||||
AreaChart,
|
|
||||||
Area,
|
|
||||||
XAxis,
|
|
||||||
YAxis,
|
|
||||||
CartesianGrid,
|
|
||||||
Tooltip,
|
|
||||||
ResponsiveContainer,
|
|
||||||
} from "recharts";
|
|
||||||
import { createGradient } from "../Utils/gradientUtils.jsx";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import { useTheme } from "@mui/material";
|
|
||||||
import { useId } from "react";
|
|
||||||
import { Fragment } from "react";
|
|
||||||
|
|
||||||
const CustomAreaChart = ({
|
|
||||||
data,
|
|
||||||
dataKeys,
|
|
||||||
xKey,
|
|
||||||
xDomain,
|
|
||||||
yKey,
|
|
||||||
yDomain,
|
|
||||||
xTick,
|
|
||||||
yTick,
|
|
||||||
strokeColor,
|
|
||||||
fillColor,
|
|
||||||
gradient = false,
|
|
||||||
gradientDirection = "vertical",
|
|
||||||
gradientStartColor,
|
|
||||||
gradientEndColor,
|
|
||||||
customTooltip,
|
|
||||||
height = "100%",
|
|
||||||
}) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const uniqueId = useId();
|
|
||||||
|
|
||||||
const AREA_COLORS = [
|
|
||||||
// Blues
|
|
||||||
"#3182bd", // Deep blue
|
|
||||||
"#6baed6", // Medium blue
|
|
||||||
"#9ecae1", // Light blue
|
|
||||||
|
|
||||||
// Greens
|
|
||||||
"#74c476", // Soft green
|
|
||||||
"#a1d99b", // Light green
|
|
||||||
"#c7e9c0", // Pale green
|
|
||||||
|
|
||||||
// Oranges
|
|
||||||
"#fdae6b", // Warm orange
|
|
||||||
"#fdd0a2", // Light orange
|
|
||||||
"#feedde", // Pale orange
|
|
||||||
|
|
||||||
// Purples
|
|
||||||
"#9467bd", // Lavender
|
|
||||||
"#a55194", // Deep magenta
|
|
||||||
"#c994c7", // Soft magenta
|
|
||||||
|
|
||||||
// Reds
|
|
||||||
"#ff9896", // Soft red
|
|
||||||
"#de2d26", // Deep red
|
|
||||||
"#fc9272", // Medium red
|
|
||||||
|
|
||||||
// Cyans/Teals
|
|
||||||
"#17becf", // Cyan
|
|
||||||
"#7fcdbb", // Teal
|
|
||||||
"#a1dab4", // Light teal
|
|
||||||
|
|
||||||
// Yellows
|
|
||||||
"#fec44f", // Mustard
|
|
||||||
"#fee391", // Light yellow
|
|
||||||
"#ffffd4", // Pale yellow
|
|
||||||
|
|
||||||
// Additional colors
|
|
||||||
"#e377c2", // Soft pink
|
|
||||||
"#bcbd22", // Olive
|
|
||||||
"#2ca02c", // Vibrant green
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ResponsiveContainer
|
|
||||||
width="100%"
|
|
||||||
height={height}
|
|
||||||
// FE team HELP! Why does this overflow if set to 100%?
|
|
||||||
>
|
|
||||||
<AreaChart data={data}>
|
|
||||||
<XAxis
|
|
||||||
dataKey={xKey}
|
|
||||||
{...(xDomain && { domain: xDomain })}
|
|
||||||
{...(xTick && { tick: xTick })}
|
|
||||||
/>
|
|
||||||
<YAxis
|
|
||||||
dataKey={yKey}
|
|
||||||
{...(yDomain && { domain: yDomain })}
|
|
||||||
{...(yTick && { tick: yTick })}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CartesianGrid
|
|
||||||
stroke={theme.palette.primary.lowContrast}
|
|
||||||
strokeWidth={1}
|
|
||||||
strokeOpacity={1}
|
|
||||||
fill="transparent"
|
|
||||||
vertical={false}
|
|
||||||
/>
|
|
||||||
{dataKeys.map((dataKey, index) => {
|
|
||||||
const gradientId = `gradient-${uniqueId}-${index}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Fragment key={dataKey}>
|
|
||||||
{gradient === true &&
|
|
||||||
createGradient({
|
|
||||||
id: gradientId,
|
|
||||||
startColor: gradientStartColor || AREA_COLORS[index],
|
|
||||||
endColor: gradientEndColor,
|
|
||||||
direction: gradientDirection,
|
|
||||||
})}
|
|
||||||
<Area
|
|
||||||
yKey={dataKey}
|
|
||||||
key={dataKey}
|
|
||||||
type="monotone"
|
|
||||||
dataKey={dataKey}
|
|
||||||
stroke={strokeColor || AREA_COLORS[index]}
|
|
||||||
fill={gradient === true ? `url(#${gradientId})` : fillColor}
|
|
||||||
/>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{customTooltip ? (
|
|
||||||
<Tooltip
|
|
||||||
cursor={{ stroke: theme.palette.primary.lowContrast }}
|
|
||||||
content={customTooltip}
|
|
||||||
wrapperStyle={{ pointerEvents: "none" }}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Tooltip />
|
|
||||||
)}
|
|
||||||
</AreaChart>
|
|
||||||
</ResponsiveContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
CustomAreaChart.propTypes = {
|
|
||||||
data: PropTypes.array.isRequired,
|
|
||||||
dataKeys: PropTypes.array.isRequired,
|
|
||||||
xTick: PropTypes.object, // Recharts takes an instance of component, so we can't pass the component itself
|
|
||||||
yTick: PropTypes.object, // Recharts takes an instance of component, so we can't pass the component itself
|
|
||||||
xKey: PropTypes.string.isRequired,
|
|
||||||
xDomain: PropTypes.array,
|
|
||||||
yKey: PropTypes.string,
|
|
||||||
yDomain: PropTypes.array,
|
|
||||||
fillColor: PropTypes.string,
|
|
||||||
strokeColor: PropTypes.string,
|
|
||||||
gradient: PropTypes.bool,
|
|
||||||
gradientDirection: PropTypes.string,
|
|
||||||
gradientStartColor: PropTypes.string,
|
|
||||||
gradientEndColor: PropTypes.string,
|
|
||||||
customTooltip: PropTypes.object,
|
|
||||||
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CustomAreaChart;
|
|
||||||
Whitespace-only changes.
@@ -1,181 +0,0 @@
|
|||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { Box, Stack, Tooltip, Typography } from "@mui/material";
|
|
||||||
import { formatDateWithTz } from "../../../../Utils/timeUtilsLegacy.js";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import "./index.css";
|
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
|
|
||||||
/* TODO add prop validation and jsdocs */
|
|
||||||
const BarChart = ({ checks = [] }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const [animate, setAnimate] = useState(false);
|
|
||||||
const uiTimezone = useSelector((state) => state.ui.timezone);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setAnimate(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// set responseTime to average if there's only one check
|
|
||||||
if (checks.length === 1) {
|
|
||||||
checks[0] = { ...checks[0], responseTime: 50 };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checks.length !== 25) {
|
|
||||||
const placeholders = Array(25 - checks.length).fill("placeholder");
|
|
||||||
checks = [...checks, ...placeholders];
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
flexWrap="nowrap"
|
|
||||||
gap={theme.spacing(1.5)}
|
|
||||||
height="50px"
|
|
||||||
width="fit-content"
|
|
||||||
onClick={(event) => event.stopPropagation()}
|
|
||||||
sx={{
|
|
||||||
cursor: "default",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{checks.map((check, index) =>
|
|
||||||
check === "placeholder" ? (
|
|
||||||
/* TODO what is the purpose of this box? */
|
|
||||||
// CAIO_REVIEW the purpose of this box is to make sure there are always at least 25 bars
|
|
||||||
// even if there are less than 25 checks
|
|
||||||
<Box
|
|
||||||
key={`${check}-${index}`}
|
|
||||||
position="relative"
|
|
||||||
width={theme.spacing(4.5)}
|
|
||||||
height="100%"
|
|
||||||
backgroundColor={theme.palette.primary.lowContrast}
|
|
||||||
sx={{
|
|
||||||
borderRadius: theme.spacing(1.5),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Tooltip
|
|
||||||
title={
|
|
||||||
<>
|
|
||||||
<Typography>
|
|
||||||
{formatDateWithTz(
|
|
||||||
check.updatedAt,
|
|
||||||
"ddd, MMMM D, YYYY, HH:mm A",
|
|
||||||
uiTimezone
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
<Box mt={theme.spacing(2)}>
|
|
||||||
<Box
|
|
||||||
display="inline-block"
|
|
||||||
width={theme.spacing(4)}
|
|
||||||
height={theme.spacing(4)}
|
|
||||||
backgroundColor={
|
|
||||||
check.status
|
|
||||||
? theme.palette.success.lowContrast
|
|
||||||
: theme.palette.error.lowContrast
|
|
||||||
}
|
|
||||||
sx={{ borderRadius: "50%" }}
|
|
||||||
/>
|
|
||||||
<Stack
|
|
||||||
display="inline-flex"
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
ml={theme.spacing(2)}
|
|
||||||
gap={theme.spacing(12)}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
component="span"
|
|
||||||
sx={{ opacity: 0.8 }}
|
|
||||||
>
|
|
||||||
Response Time
|
|
||||||
</Typography>
|
|
||||||
<Typography component="span">
|
|
||||||
{check.originalResponseTime}
|
|
||||||
<Typography
|
|
||||||
component="span"
|
|
||||||
sx={{ opacity: 0.8 }}
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
ms
|
|
||||||
</Typography>
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
placement="top"
|
|
||||||
key={`check-${check?.id}`}
|
|
||||||
slotProps={{
|
|
||||||
popper: {
|
|
||||||
className: "bar-tooltip",
|
|
||||||
modifiers: [
|
|
||||||
{
|
|
||||||
name: "offset",
|
|
||||||
options: {
|
|
||||||
offset: [0, -10],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
sx: {
|
|
||||||
"& .MuiTooltip-tooltip": {
|
|
||||||
backgroundColor: theme.palette.secondary.main,
|
|
||||||
border: 1,
|
|
||||||
borderColor: theme.palette.primary.lowContrast,
|
|
||||||
borderRadius: theme.shape.borderRadius,
|
|
||||||
boxShadow: theme.shape.boxShadow,
|
|
||||||
px: theme.spacing(4),
|
|
||||||
py: theme.spacing(3),
|
|
||||||
},
|
|
||||||
"& .MuiTooltip-tooltip p": {
|
|
||||||
/* TODO Font size should point to theme */
|
|
||||||
fontSize: 12,
|
|
||||||
color: theme.palette.secondary.contrastText,
|
|
||||||
fontWeight: 500,
|
|
||||||
},
|
|
||||||
"& .MuiTooltip-tooltip span": {
|
|
||||||
/* TODO Font size should point to theme */
|
|
||||||
fontSize: 11,
|
|
||||||
color: theme.palette.secondary.contrastText,
|
|
||||||
fontWeight: 600,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
position="relative"
|
|
||||||
width="9px"
|
|
||||||
height="100%"
|
|
||||||
backgroundColor={theme.palette.primary.lowContrast}
|
|
||||||
sx={{
|
|
||||||
borderRadius: theme.spacing(1.5),
|
|
||||||
/*
|
|
||||||
TODO this doesn't seem to be used
|
|
||||||
"&:hover > .MuiBox-root": {
|
|
||||||
filter: "brightness(0.8)",
|
|
||||||
}, */
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
position="absolute"
|
|
||||||
bottom={0}
|
|
||||||
width="100%"
|
|
||||||
height={`${animate ? check.responseTime : 0}%`}
|
|
||||||
backgroundColor={
|
|
||||||
check.status
|
|
||||||
? theme.palette.success.lowContrast
|
|
||||||
: theme.palette.error.lowContrast
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
borderRadius: theme.spacing(1.5),
|
|
||||||
transition: "height 600ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</Tooltip>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default BarChart;
|
|
||||||
Loaded 100 of 488 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user