Merge branch 'develop' into fix/update-average-response-time-chart-color

This commit is contained in:
Peter Carl Pardo committed 2024-12-13 00:47:59 +08:00
commit 017eab53ff
59 files changed
+885 -828

No files matched your search

@@ -1,6 +1,6 @@
## Describe your changes ## Describe your changes
Provide a brief description of the changes you’ve made and their purpose. Briefly describe the changes you made and their purpose.
## Issue number ## Issue number
@@ -11,4 +11,11 @@ Mention the issue number(s) this PR addresses (e.g., #123).
- [ ] I have performed a self-review of my code. - [ ] I have performed a self-review of my code.
- [ ] I have included the issue # in the PR. - [ ] I have included the issue # in the PR.
- [ ] I have labelled the PR correctly. - [ ] I have labelled the PR correctly.
- [ ] My PR is granular and targeted to one specific feature only. - [ ] The issue I am working on is assigned to me.
- [ ] I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
- [ ] I made sure font sizes, color choices etc are all referenced from the theme.
- [ ] My PR is granular and targeted to one specific feature.
- [ ] I took a screenshot or a video and attached to this PR if there is a UI change.
+92 -80
View File
@@ -11,20 +11,20 @@
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",
"@fontsource/roboto": "^5.0.13", "@fontsource/roboto": "^5.0.13",
"@mui/icons-material": "6.1.10", "@mui/icons-material": "6.2.0",
"@mui/lab": "6.0.0-beta.18", "@mui/lab": "6.0.0-beta.19",
"@mui/material": "6.1.10", "@mui/material": "6.2.0",
"@mui/x-charts": "^7.5.1", "@mui/x-charts": "^7.5.1",
"@mui/x-data-grid": "7.23.1", "@mui/x-data-grid": "7.23.1",
"@mui/x-date-pickers": "7.23.1", "@mui/x-date-pickers": "7.23.1",
"@reduxjs/toolkit": "2.4.0", "@reduxjs/toolkit": "2.5.0",
"axios": "^1.7.4", "axios": "^1.7.4",
"dayjs": "1.11.13", "dayjs": "1.11.13",
"joi": "17.13.3", "joi": "17.13.3",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-redux": "9.1.2", "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",
"react-toastify": "^10.0.5", "react-toastify": "^10.0.5",
@@ -1071,15 +1071,15 @@
} }
}, },
"node_modules/@mui/base": { "node_modules/@mui/base": {
"version": "5.0.0-beta.64", "version": "5.0.0-beta.66",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.64.tgz", "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.66.tgz",
"integrity": "sha512-nu663PoZs/Pee0fkPYkjUADfT+AAi2QWvvHghDhLeSx8sa3i+GGaOoUsFmB4CPlyYqWfq9hRGA7H1T3d6VrGgw==", "integrity": "sha512-1SzcNbtIms0o/Dx+599B6QbvR5qUMBUjwc2Gs47h1HsF7RcEFXxqaq7zrWkIWbvGctIIPx0j330oGx/SkF+UmA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
"@floating-ui/react-dom": "^2.1.1", "@floating-ui/react-dom": "^2.1.1",
"@mui/types": "^7.2.19", "@mui/types": "^7.2.19",
"@mui/utils": "^6.1.10", "@mui/utils": "^6.2.0",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
@@ -1092,9 +1092,9 @@
"url": "https://opencollective.com/mui-org" "url": "https://opencollective.com/mui-org"
}, },
"peerDependencies": { "peerDependencies": {
"@types/react": "^17.0.0 || ^18.0.0", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react": "^17.0.0 || ^18.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0" "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@types/react": { "@types/react": {
@@ -1103,9 +1103,9 @@
} }
}, },
"node_modules/@mui/core-downloads-tracker": { "node_modules/@mui/core-downloads-tracker": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.2.0.tgz",
"integrity": "sha512-LY5wdiLCBDY7u+Od8UmFINZFGN/5ZU90fhAslf/ZtfP+5RhuY45f679pqYIxe0y54l6Gkv9PFOc8Cs10LDTBYg==", "integrity": "sha512-Nn5PSkUqbDrvezpiiiYZiAbX4SFEiy3CbikUL6pWOXEUsq+L1j50OOyyUIHpaX2Hr+5V5UxTh+fPeC4nsGNhdw==",
"license": "MIT", "license": "MIT",
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@@ -1113,9 +1113,9 @@
} }
}, },
"node_modules/@mui/icons-material": { "node_modules/@mui/icons-material": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-6.2.0.tgz",
"integrity": "sha512-G6P1BCSt6EQDcKca47KwvKjlqgOXFbp2I3oWiOlFgKYTANBH89yk7ttMQ5ysqNxSYAB+4TdM37MlPYp4+FkVrQ==", "integrity": "sha512-WR1EEhGOSvxAsoTSzWZBlrWFjul8wziDrII4rC3PvMBHhBYBqEc2n/0aamfFbwkH5EiYb96aqc6kYY6tB310Sw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0" "@babel/runtime": "^7.26.0"
@@ -1128,7 +1128,7 @@
"url": "https://opencollective.com/mui-org" "url": "https://opencollective.com/mui-org"
}, },
"peerDependencies": { "peerDependencies": {
"@mui/material": "^6.1.10", "@mui/material": "^6.2.0",
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react": "^17.0.0 || ^18.0.0 || ^19.0.0" "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
}, },
@@ -1139,16 +1139,16 @@
} }
}, },
"node_modules/@mui/lab": { "node_modules/@mui/lab": {
"version": "6.0.0-beta.18", "version": "6.0.0-beta.19",
"resolved": "https://registry.npmjs.org/@mui/lab/-/lab-6.0.0-beta.18.tgz", "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-6.0.0-beta.19.tgz",
"integrity": "sha512-O7jNn36Jb0530NOZeFLj33RGB57x3kfyiYOaj5sL/j/Pmq9T0tonKMkoW/AUCucmBa7RuEzEYMyqBpfqminebA==", "integrity": "sha512-t7iub8kjpLdA5uDGwGnNRjtGc1vYEUnDwSROjKrnYqjOlCQhBajFa8uoQtaST6jE/VEk6cxpDMnN5MalC6YpCg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
"@mui/base": "5.0.0-beta.64", "@mui/base": "5.0.0-beta.66",
"@mui/system": "^6.1.10", "@mui/system": "^6.2.0",
"@mui/types": "^7.2.19", "@mui/types": "^7.2.19",
"@mui/utils": "^6.1.10", "@mui/utils": "^6.2.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
}, },
@@ -1162,8 +1162,8 @@
"peerDependencies": { "peerDependencies": {
"@emotion/react": "^11.5.0", "@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0", "@emotion/styled": "^11.3.0",
"@mui/material": "^6.1.10", "@mui/material": "^6.2.0",
"@mui/material-pigment-css": "^6.1.10", "@mui/material-pigment-css": "^6.2.0",
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
@@ -1184,22 +1184,22 @@
} }
}, },
"node_modules/@mui/material": { "node_modules/@mui/material": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.2.0.tgz",
"integrity": "sha512-txnwYObY4N9ugv5T2n5h1KcbISegZ6l65w1/7tpSU5OB6MQCU94YkP8n/3slDw2KcEfRk4+4D8EUGfhSPMODEQ==", "integrity": "sha512-7FXXUPIyYzP02a7GvqwJ7ocmdP+FkvLvmy/uxG1TDmTlsr8nEClQp75uxiVznJqAY/jJy4d+Rj/fNWNxwidrYQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
"@mui/core-downloads-tracker": "^6.1.10", "@mui/core-downloads-tracker": "^6.2.0",
"@mui/system": "^6.1.10", "@mui/system": "^6.2.0",
"@mui/types": "^7.2.19", "@mui/types": "^7.2.19",
"@mui/utils": "^6.1.10", "@mui/utils": "^6.2.0",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"@types/react-transition-group": "^4.4.11", "@types/react-transition-group": "^4.4.11",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"csstype": "^3.1.3", "csstype": "^3.1.3",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"react-is": "^18.3.1", "react-is": "^19.0.0",
"react-transition-group": "^4.4.5" "react-transition-group": "^4.4.5"
}, },
"engines": { "engines": {
@@ -1212,7 +1212,7 @@
"peerDependencies": { "peerDependencies": {
"@emotion/react": "^11.5.0", "@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0", "@emotion/styled": "^11.3.0",
"@mui/material-pigment-css": "^6.1.10", "@mui/material-pigment-css": "^6.2.0",
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
@@ -1232,14 +1232,20 @@
} }
} }
}, },
"node_modules/@mui/material/node_modules/react-is": {
"version": "19.0.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.0.0.tgz",
"integrity": "sha512-H91OHcwjZsbq3ClIDHMzBShc1rotbfACdWENsmEf0IFvZ3FgGPtdHMcsv45bQ1hAbgdfiA8SnxTKfDS+x/8m2g==",
"license": "MIT"
},
"node_modules/@mui/private-theming": { "node_modules/@mui/private-theming": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.2.0.tgz",
"integrity": "sha512-DqgsH0XFEweeG3rQfVkqTkeXcj/E76PGYWag8flbPdV8IYdMo+DfVdFlZK8JEjsaIVD2Eu1kJg972XnH5pfnBQ==", "integrity": "sha512-lYd2MrVddhentF1d/cMXKnwlDjr/shbO3A2eGq22PCYUoZaqtAGZMc0U86KnJ/Sh5YzNYePqTOaaowAN8Qea8A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
"@mui/utils": "^6.1.10", "@mui/utils": "^6.2.0",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
}, },
"engines": { "engines": {
@@ -1260,9 +1266,9 @@
} }
}, },
"node_modules/@mui/styled-engine": { "node_modules/@mui/styled-engine": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.2.0.tgz",
"integrity": "sha512-+NV9adKZYhslJ270iPjf2yzdVJwav7CIaXcMlPSi1Xy1S/zRe5xFgZ6BEoMdmGRpr34lIahE8H1acXP2myrvRw==", "integrity": "sha512-rV4YCu6kcCjMnHFXU/tQcL6XfYVfFVR8n3ZVNGnk2rpXnt/ctOPJsF+eUQuhkHciueLVKpI06+umr1FxWWhVmQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
@@ -1294,16 +1300,16 @@
} }
}, },
"node_modules/@mui/system": { "node_modules/@mui/system": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/system/-/system-6.2.0.tgz",
"integrity": "sha512-5YNIqxETR23SIkyP7MY2fFnXmplX/M4wNi2R+10AVRd3Ub+NLctWY/Vs5vq1oAMF0eSDLhRTGUjaUe+IGSfWqg==", "integrity": "sha512-DCeqev9Cd4f4pm3O1lqSGW/DIHHBG6ZpqMX9iIAvN4asYv+pPWv2/lKov9kWk5XThhxFnGSv93SRNE1kNRRg5Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
"@mui/private-theming": "^6.1.10", "@mui/private-theming": "^6.2.0",
"@mui/styled-engine": "^6.1.10", "@mui/styled-engine": "^6.2.0",
"@mui/types": "^7.2.19", "@mui/types": "^7.2.19",
"@mui/utils": "^6.1.10", "@mui/utils": "^6.2.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"csstype": "^3.1.3", "csstype": "^3.1.3",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
@@ -1348,17 +1354,17 @@
} }
}, },
"node_modules/@mui/utils": { "node_modules/@mui/utils": {
"version": "6.1.10", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.1.10.tgz", "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.2.0.tgz",
"integrity": "sha512-1ETuwswGjUiAf2dP9TkBy8p49qrw2wXa+RuAjNTRE5+91vtXJ1HKrs7H9s8CZd1zDlQVzUcUAPm9lpQwF5ogTw==", "integrity": "sha512-77CaFJi+OIi2SjbPwCis8z5DXvE0dfx9hBz5FguZHt1VYFlWEPCWTHcMsQCahSErnfik5ebLsYK8+D+nsjGVfw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.26.0", "@babel/runtime": "^7.26.0",
"@mui/types": "^7.2.19", "@mui/types": "^7.2.19",
"@types/prop-types": "^15.7.13", "@types/prop-types": "^15.7.14",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"react-is": "^18.3.1" "react-is": "^19.0.0"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"
@@ -1377,6 +1383,12 @@
} }
} }
}, },
"node_modules/@mui/utils/node_modules/react-is": {
"version": "19.0.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.0.0.tgz",
"integrity": "sha512-H91OHcwjZsbq3ClIDHMzBShc1rotbfACdWENsmEf0IFvZ3FgGPtdHMcsv45bQ1hAbgdfiA8SnxTKfDS+x/8m2g==",
"license": "MIT"
},
"node_modules/@mui/x-charts": { "node_modules/@mui/x-charts": {
"version": "7.23.1", "version": "7.23.1",
"resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.23.1.tgz", "resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.23.1.tgz",
@@ -1679,9 +1691,9 @@
} }
}, },
"node_modules/@reduxjs/toolkit": { "node_modules/@reduxjs/toolkit": {
"version": "2.4.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.4.0.tgz", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.0.tgz",
"integrity": "sha512-wJZEuSKj14tvNfxiIiJws0tQN77/rDqucBq528ApebMIRHyWpCanJVQRxQ8WWZC19iCDKxDsGlbAir3F1layxA==", "integrity": "sha512-awNe2oTodsZ6LmRqmkFhtb/KH03hUhxOamEQy411m3Njj3BbFvoBovxo4Q1cBWnV1ErprVj9MlF0UPXkng0eyg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"immer": "^10.0.3", "immer": "^10.0.3",
@@ -1690,7 +1702,7 @@
"reselect": "^5.1.0" "reselect": "^5.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"react": "^16.9.0 || ^17.0.0 || ^18", "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
"react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
@@ -2354,15 +2366,15 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/prop-types": { "node_modules/@types/prop-types": {
"version": "15.7.13", "version": "15.7.14",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz",
"integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==", "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/react": { "node_modules/@types/react": {
"version": "18.3.14", "version": "18.3.16",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.14.tgz", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.16.tgz",
"integrity": "sha512-NzahNKvjNhVjuPBQ+2G7WlxstQ+47kXZNHlUvFakDViuIEfGY926GqhMueQFZ7woG+sPiQKlF36XfrIUVSUfFg==", "integrity": "sha512-oh8AMIC4Y2ciKufU8hnKgs+ufgbA/dhPTACaZPM86AbwX9QwnFtSoPWEeRUj8fge+v6kFt78BXcDhAU1SrrAsw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/prop-types": "*", "@types/prop-types": "*",
@@ -2370,9 +2382,9 @@
} }
}, },
"node_modules/@types/react-dom": { "node_modules/@types/react-dom": {
"version": "18.3.3", "version": "18.3.5",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.3.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.5.tgz",
"integrity": "sha512-uTYkxTLkYp41nq/ULXyXMtkNT1vu5fXJoqad6uTNCOGat5t9cLgF4vMNLBXsTOXpdOI44XzKPY1M5RRm0bQHuw==", "integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
@@ -2389,9 +2401,9 @@
} }
}, },
"node_modules/@types/use-sync-external-store": { "node_modules/@types/use-sync-external-store": {
"version": "0.0.3", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz", "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
"integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==", "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@ungap/structured-clone": { "node_modules/@ungap/structured-clone": {
@@ -5333,17 +5345,17 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/react-redux": { "node_modules/react-redux": {
"version": "9.1.2", "version": "9.2.0",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.2.tgz", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
"integrity": "sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w==", "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/use-sync-external-store": "^0.0.3", "@types/use-sync-external-store": "^0.0.6",
"use-sync-external-store": "^1.0.0" "use-sync-external-store": "^1.4.0"
}, },
"peerDependencies": { "peerDependencies": {
"@types/react": "^18.2.25", "@types/react": "^18.2.25 || ^19",
"react": "^18.0", "react": "^18.0 || ^19",
"redux": "^5.0.0" "redux": "^5.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
@@ -6163,12 +6175,12 @@
} }
}, },
"node_modules/use-sync-external-store": { "node_modules/use-sync-external-store": {
"version": "1.2.2", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz",
"integrity": "sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==", "integrity": "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
} }
}, },
"node_modules/victory-vendor": { "node_modules/victory-vendor": {
+5 -5
View File
@@ -14,20 +14,20 @@
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",
"@fontsource/roboto": "^5.0.13", "@fontsource/roboto": "^5.0.13",
"@mui/icons-material": "6.1.10", "@mui/icons-material": "6.2.0",
"@mui/lab": "6.0.0-beta.18", "@mui/lab": "6.0.0-beta.19",
"@mui/material": "6.1.10", "@mui/material": "6.2.0",
"@mui/x-charts": "^7.5.1", "@mui/x-charts": "^7.5.1",
"@mui/x-data-grid": "7.23.1", "@mui/x-data-grid": "7.23.1",
"@mui/x-date-pickers": "7.23.1", "@mui/x-date-pickers": "7.23.1",
"@reduxjs/toolkit": "2.4.0", "@reduxjs/toolkit": "2.5.0",
"axios": "^1.7.4", "axios": "^1.7.4",
"dayjs": "1.11.13", "dayjs": "1.11.13",
"joi": "17.13.3", "joi": "17.13.3",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-redux": "9.1.2", "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",
"react-toastify": "^10.0.5", "react-toastify": "^10.0.5",
+13 -13
View File
@@ -8,8 +8,8 @@ import NotFound from "./Pages/NotFound";
import Login from "./Pages/Auth/Login"; import Login from "./Pages/Auth/Login";
import Register from "./Pages/Auth/Register/Register"; import Register from "./Pages/Auth/Register/Register";
import Account from "./Pages/Account"; import Account from "./Pages/Account";
import Monitors from "./Pages/Monitors/Home"; import Uptime from "./Pages/Uptime/Home";
import CreateMonitor from "./Pages/Monitors/CreateMonitor"; import CreateMonitor from "./Pages/Uptime/CreateUptime";
import CreateInfrastructureMonitor from "./Pages/Infrastructure/CreateMonitor"; import CreateInfrastructureMonitor from "./Pages/Infrastructure/CreateMonitor";
import Incidents from "./Pages/Incidents"; import Incidents from "./Pages/Incidents";
import Status from "./Pages/Status"; import Status from "./Pages/Status";
@@ -20,10 +20,10 @@ import CheckEmail from "./Pages/Auth/CheckEmail";
import SetNewPassword from "./Pages/Auth/SetNewPassword"; import SetNewPassword from "./Pages/Auth/SetNewPassword";
import NewPasswordConfirmed from "./Pages/Auth/NewPasswordConfirmed"; import NewPasswordConfirmed from "./Pages/Auth/NewPasswordConfirmed";
import ProtectedRoute from "./Components/ProtectedRoute"; import ProtectedRoute from "./Components/ProtectedRoute";
import Details from "./Pages/Monitors/Details"; import UptimeDetails from "./Pages/Uptime/Details";
import AdvancedSettings from "./Pages/AdvancedSettings"; import AdvancedSettings from "./Pages/AdvancedSettings";
import Maintenance from "./Pages/Maintenance"; import Maintenance from "./Pages/Maintenance";
import Configure from "./Pages/Monitors/Configure"; import Configure from "./Pages/Uptime/Configure";
import PageSpeed from "./Pages/PageSpeed"; import PageSpeed from "./Pages/PageSpeed";
import CreatePageSpeed from "./Pages/PageSpeed/CreatePageSpeed"; import CreatePageSpeed from "./Pages/PageSpeed/CreatePageSpeed";
import CreateNewMaintenanceWindow from "./Pages/Maintenance/CreateMaintenance"; import CreateNewMaintenanceWindow from "./Pages/Maintenance/CreateMaintenance";
@@ -43,8 +43,8 @@ import { Infrastructure } from "./Pages/Infrastructure";
import InfrastructureDetails from "./Pages/Infrastructure/Details"; import InfrastructureDetails from "./Pages/Infrastructure/Details";
function App() { function App() {
const AdminCheckedRegister = withAdminCheck(Register); const AdminCheckedRegister = withAdminCheck(Register);
const MonitorsWithAdminProp = withAdminProp(Monitors); const UptimeWithAdminProp = withAdminProp(Uptime);
const MonitorDetailsWithAdminProp = withAdminProp(Details); const UptimeDetailsWithAdminProp = withAdminProp(UptimeDetails);
const PageSpeedWithAdminProp = withAdminProp(PageSpeed); const PageSpeedWithAdminProp = withAdminProp(PageSpeed);
const PageSpeedDetailsWithAdminProp = withAdminProp(PageSpeedDetails); const PageSpeedDetailsWithAdminProp = withAdminProp(PageSpeedDetails);
const MaintenanceWithAdminProp = withAdminProp(Maintenance); const MaintenanceWithAdminProp = withAdminProp(Maintenance);
@@ -92,22 +92,22 @@ function App() {
<Route <Route
exact exact
path="/" path="/"
element={<Navigate to="/monitors" />} element={<Navigate to="/uptime" />}
/> />
<Route <Route
path="/monitors" path="/uptime"
element={<ProtectedRoute Component={MonitorsWithAdminProp} />} element={<ProtectedRoute Component={UptimeWithAdminProp} />}
/> />
<Route <Route
path="/monitors/create/:monitorId?" path="/uptime/create/:monitorId?"
element={<ProtectedRoute Component={CreateMonitor} />} element={<ProtectedRoute Component={CreateMonitor} />}
/> />
<Route <Route
path="/monitors/:monitorId/" path="/uptime/:monitorId/"
element={<ProtectedRoute Component={MonitorDetailsWithAdminProp} />} element={<ProtectedRoute Component={UptimeDetailsWithAdminProp} />}
/> />
<Route <Route
path="/monitors/configure/:monitorId/" path="/uptime/configure/:monitorId/"
element={<ProtectedRoute Component={Configure} />} element={<ProtectedRoute Component={Configure} />}
/> />
<Route <Route
+35 -16
View File
@@ -3,33 +3,50 @@ import { FormControlLabel, Checkbox as MuiCheckbox } from "@mui/material";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import CheckboxOutline from "../../../assets/icons/checkbox-outline.svg?react"; import CheckboxOutline from "../../../assets/icons/checkbox-outline.svg?react";
import CheckboxFilled from "../../../assets/icons/checkbox-filled.svg?react"; import CheckboxFilled from "../../../assets/icons/checkbox-filled.svg?react";
import "./index.css"; import "./index.css";
/** /**
* @param {Object} props * Checkbox Component
* @param {string} props.id - The id attribute for the checkbox input.
* @param {string} props.label - The label to display next to the checkbox.
* @param {('small' | 'medium' | 'large')} - The size of the checkbox.
* @param {boolean} props.isChecked - Whether the checkbox is checked or not.
* @param {string} [props.value] - The value of the checkbox input.
* @param {function} [props.onChange] - The function to call when the checkbox value changes.
* @param {boolean} [props.isDisabled] - Whether the checkbox is disabled or not.
* *
* @returns {JSX.Element} * A customized checkbox component using Material-UI that supports custom sizing,
* disabled states, and custom icons.
*
* @component
* @param {Object} props - Component properties
* @param {string} props.id - Unique identifier for the checkbox input
* @param {string} [props.name] - Optional name attribute for the checkbox
* @param {(string|React.ReactNode)} props.label - Label text or node for the checkbox
* @param {('small'|'medium'|'large')} [props.size='medium'] - Size of the checkbox icon
* @param {boolean} props.isChecked - Current checked state of the checkbox
* @param {string} [props.value] - Optional value associated with the checkbox
* @param {Function} [props.onChange] - Callback function triggered when checkbox state changes
* @param {boolean} [props.isDisabled] - Determines if the checkbox is disabled
*
* @returns {React.ReactElement} Rendered Checkbox component
* *
* @example * @example
* // Basic usage
* <Checkbox * <Checkbox
* id="checkbox-id" * id="terms-checkbox"
* label="Ping monitoring" * label="I agree to terms"
* isChecked={checks.type === "ping"} * isChecked={agreed}
* value="ping" * onChange={handleAgree}
* onChange={handleChange} * />
*
* @example
* // With custom size and disabled state
* <Checkbox
* id="advanced-checkbox"
* label="Advanced Option"
* size="large"
* isChecked={isAdvanced}
* isDisabled={!canModify}
* onChange={handleAdvancedToggle}
* /> * />
*/ */
const Checkbox = ({ const Checkbox = ({
id, id,
name,
label, label,
size = "medium", size = "medium",
isChecked, isChecked,
@@ -46,6 +63,7 @@ const Checkbox = ({
control={ control={
<MuiCheckbox <MuiCheckbox
checked={isDisabled ? false : isChecked} checked={isDisabled ? false : isChecked}
name={name}
value={value} value={value}
onChange={onChange} onChange={onChange}
icon={<CheckboxOutline />} icon={<CheckboxOutline />}
@@ -89,6 +107,7 @@ const Checkbox = ({
Checkbox.propTypes = { Checkbox.propTypes = {
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
name: PropTypes.string,
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired, label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
size: PropTypes.oneOf(["small", "medium", "large"]), size: PropTypes.oneOf(["small", "medium", "large"]),
isChecked: PropTypes.bool.isRequired, isChecked: PropTypes.bool.isRequired,
@@ -93,6 +93,9 @@ const Search = ({
{ {
borderColor: theme.palette.border.light, borderColor: theme.palette.border.light,
}, },
"& .MuiOutlinedInput-root": {
paddingY: 0,
},
}} }}
/> />
{error && ( {error && (
+3 -3
View File
@@ -141,9 +141,9 @@ const StatusLabel = ({ status, text, customStyles }) => {
borderColor: theme.palette.warning.light, borderColor: theme.palette.warning.light,
}, },
pending: { pending: {
dotColor: theme.palette.warning.main, dotColor: theme.palette.text.secondary,
bgColor: theme.palette.warning.dark, bgColor: theme.palette.background.main,
borderColor: theme.palette.warning.light, borderColor: theme.palette.border.dark,
}, },
"cannot resolve": { "cannot resolve": {
dotColor: theme.palette.unresolved.main, dotColor: theme.palette.unresolved.main,
+2 -2
View File
@@ -47,7 +47,7 @@ import Folder from "../../assets/icons/folder.svg?react";
import "./index.css"; import "./index.css";
const menu = [ const menu = [
{ name: "Monitors", path: "monitors", icon: <Monitors /> }, { name: "Uptime", path: "uptime", icon: <Monitors /> },
{ name: "Pagespeed", path: "pagespeed", icon: <PageSpeed /> }, { name: "Pagespeed", path: "pagespeed", icon: <PageSpeed /> },
{ name: "Infrastructure", path: "infrastructure", icon: <Integrations /> }, { name: "Infrastructure", path: "infrastructure", icon: <Integrations /> },
{ name: "Incidents", path: "incidents", icon: <Incidents /> }, { name: "Incidents", path: "incidents", icon: <Incidents /> },
@@ -265,7 +265,7 @@ function Sidebar() {
sx={{ sx={{
px: theme.spacing(6), px: theme.spacing(6),
height: "100%", height: "100%",
overflow: "hidden" overflow: "hidden",
}} }}
> >
{menu.map((item) => {menu.map((item) =>
+2 -2
View File
@@ -388,7 +388,7 @@ const Login = () => {
useEffect(() => { useEffect(() => {
if (authToken) { if (authToken) {
navigate("/monitors"); navigate("/uptime");
return; return;
} }
networkService networkService
@@ -454,7 +454,7 @@ const Login = () => {
} else { } else {
const action = await dispatch(login(form)); const action = await dispatch(login(form));
if (action.payload.success) { if (action.payload.success) {
navigate("/monitors"); navigate("/uptime");
createToast({ createToast({
body: "Welcome back! You're successfully logged in.", body: "Welcome back! You're successfully logged in.",
}); });
+1 -1
View File
@@ -237,7 +237,7 @@ const Register = ({ isSuperAdmin }) => {
if (action.payload.success) { if (action.payload.success) {
const authToken = action.payload.data; const authToken = action.payload.data;
localStorage.setItem("token", authToken); localStorage.setItem("token", authToken);
navigate("/monitors"); navigate("/uptime");
createToast({ createToast({
body: "Welcome! Your account was created successfully.", body: "Welcome! Your account was created successfully.",
}); });
@@ -31,7 +31,6 @@ function StepThree({ onSubmit, onBack }) {
}, []); }, []);
const { handleChange, feedbacks, form, errors } = useValidatePassword(); const { handleChange, feedbacks, form, errors } = useValidatePassword();
console.log(errors);
return ( return (
<> <>
<Stack <Stack
@@ -5,32 +5,58 @@ import { useTheme } from "@emotion/react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
/** /**
* `CustomThreshold` is a functional React component that displays a * CustomThreshold Component
* group of CheckBox with a label and its correspondant threshold input field.
* *
* @param {{ checkboxId: any; checkboxLabel: any; onCheckboxChange: any; fieldId: any; onFieldChange: any; onFieldBlur: any; alertUnit: any; infrastructureMonitor: any; errors: any; }} param0 * A reusable component that renders a checkbox with an associated numeric input field
* @param {string} param0.checkboxId - The text is the id of the checkbox. * and an optional unit label. The input field can be enabled/disabled based on checkbox state.
* @param {string} param0.checkboxLabel - The text to be displayed as the label next to the check icon.
* @param {func} param0.onCheckboxChange - The function to invoke when checkbox is checked or unchecked.
* @param {string} param0.fieldId - The text is the id of the input field.
* @param {func} param0.onFieldChange - The function to invoke when input field is changed.
* @param {func} param0.onFieldBlur - The function to invoke when input field is losing focus.
* @param {string} param0.alertUnit the threshold unit such as usage percentage '%' etc
* @param {object} param0.infrastructureMonitor the form object of the create infrastrcuture monitor page
* @param {object} param0.errors the object that holds all the errors of the form page
* @returns A compound React component that renders the custom threshold alert section
* *
* @component
* @param {Object} props - Component properties
* @param {string} [props.checkboxId] - Optional unique identifier for the checkbox
* @param {string} [props.checkboxName] - Optional name attribute for the checkbox
* @param {string} props.checkboxLabel - Label text for the checkbox
* @param {boolean} props.isChecked - Current checked state of the checkbox
* @param {Function} props.onCheckboxChange - Callback function when checkbox is toggled
* @param {string} props.fieldId - Unique identifier for the input field
* @param {string} [props.fieldName] - Optional name attribute for the input field
* @param {string} props.fieldValue - Current value of the input field
* @param {Function} props.onFieldChange - Callback function when input field value changes
* @param {Function} props.onFieldBlur - Callback function when input field loses focus
* @param {string} props.alertUnit - Unit label displayed next to the input field
* @param {Object} props.errors - Object containing validation errors for the field
* @param {Object} props.infrastructureMonitor - Infrastructure monitor configuration object
*
* @returns {React.ReactElement} Rendered CustomThreshold component
*
* @example
* <CustomThreshold
* checkboxId="cpu-threshold"
* checkboxName="cpu_threshold"
* checkboxLabel="Enable CPU Threshold"
* isChecked={true}
* onCheckboxChange={handleCheckboxToggle}
* fieldId="cpu-threshold-value"
* fieldName="cpu_threshold_value"
* fieldValue="80"
* onFieldChange={handleFieldChange}
* onFieldBlur={handleFieldBlur}
* alertUnit="%"
* errors={{}}
* infrastructureMonitor={monitorConfig}
* />
*/ */
export const CustomThreshold = ({ export const CustomThreshold = ({
checkboxId, checkboxId,
checkboxName,
checkboxLabel, checkboxLabel,
onCheckboxChange, onCheckboxChange,
isChecked,
fieldId, fieldId,
fieldName,
fieldValue,
onFieldChange, onFieldChange,
onFieldBlur, onFieldBlur,
alertUnit, alertUnit,
infrastructureMonitor,
errors, errors,
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
@@ -46,8 +72,9 @@ export const CustomThreshold = ({
<Box> <Box>
<Checkbox <Checkbox
id={checkboxId} id={checkboxId}
name={checkboxName}
label={checkboxLabel} label={checkboxLabel}
isChecked={infrastructureMonitor[checkboxId]} isChecked={isChecked}
onChange={onCheckboxChange} onChange={onCheckboxChange}
/> />
</Box> </Box>
@@ -61,11 +88,12 @@ export const CustomThreshold = ({
maxWidth="var(--env-var-width-4)" maxWidth="var(--env-var-width-4)"
type="number" type="number"
id={fieldId} id={fieldId}
value={infrastructureMonitor[fieldId]} name={fieldName}
value={fieldValue}
onBlur={onFieldBlur} onBlur={onFieldBlur}
onChange={onFieldChange} onChange={onFieldChange}
error={errors[fieldId] ? true : false} error={errors[fieldId] ? true : false}
disabled={!infrastructureMonitor[checkboxId]} disabled={!isChecked}
/> />
<Typography <Typography
@@ -80,10 +108,14 @@ export const CustomThreshold = ({
}; };
CustomThreshold.propTypes = { CustomThreshold.propTypes = {
checkboxId: PropTypes.string.isRequired, checkboxId: PropTypes.string,
checkboxName: PropTypes.string,
checkboxLabel: PropTypes.string.isRequired, checkboxLabel: PropTypes.string.isRequired,
isChecked: PropTypes.bool.isRequired,
onCheckboxChange: PropTypes.func.isRequired, onCheckboxChange: PropTypes.func.isRequired,
fieldId: PropTypes.string.isRequired, fieldId: PropTypes.string.isRequired,
fieldName: PropTypes.string,
fieldValue: PropTypes.string.isRequired,
onFieldChange: PropTypes.func.isRequired, onFieldChange: PropTypes.func.isRequired,
onFieldBlur: PropTypes.func.isRequired, onFieldBlur: PropTypes.func.isRequired,
alertUnit: PropTypes.string.isRequired, alertUnit: PropTypes.string.isRequired,
@@ -1,27 +1,62 @@
import { useState } from "react"; // React, Redux, Router
import { Box, Stack, Typography } from "@mui/material";
import LoadingButton from "@mui/lab/LoadingButton";
import { useSelector, useDispatch } from "react-redux";
import { infrastructureMonitorValidation } from "../../../Validation/validation";
import { parseDomainName } from "../../../Utils/monitorUtils";
import {
createInfrastructureMonitor,
checkInfrastructureEndpointResolution,
} from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
import { useNavigate } from "react-router-dom";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { createToast } from "../../../Utils/toastUtils"; import { useNavigate } from "react-router-dom";
import Link from "../../../Components/Link"; import { useState } from "react";
import { ConfigBox } from "../../Monitors/styled"; import { useSelector, useDispatch } from "react-redux";
import TextInput from "../../../Components/Inputs/TextInput";
import Select from "../../../Components/Inputs/Select"; // Utility and Network
import Checkbox from "../../../Components/Inputs/Checkbox"; import { infrastructureMonitorValidation } from "../../../Validation/validation";
import Breadcrumbs from "../../../Components/Breadcrumbs"; import { createInfrastructureMonitor } from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
import { buildErrors, hasValidationErrors } from "../../../Validation/error";
import { capitalizeFirstLetter } from "../../../Utils/stringUtils"; import { capitalizeFirstLetter } from "../../../Utils/stringUtils";
import { CustomThreshold } from "../CreateMonitor/CustomThreshold";
// MUI
import { Box, Stack, Typography, Button, ButtonGroup } from "@mui/material";
import LoadingButton from "@mui/lab/LoadingButton";
//Components
import Breadcrumbs from "../../../Components/Breadcrumbs";
import Link from "../../../Components/Link";
import { ConfigBox } from "../../Uptime/styled";
import TextInput from "../../../Components/Inputs/TextInput";
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
import { createToast } from "../../../Utils/toastUtils";
import Checkbox from "../../../Components/Inputs/Checkbox";
import Select from "../../../Components/Inputs/Select";
import { CustomThreshold } from "./CustomThreshold";
const SELECT_VALUES = [
{ _id: 0.25, name: "15 seconds" },
{ _id: 0.5, name: "30 seconds" },
{ _id: 1, name: "1 minute" },
{ _id: 2, name: "2 minutes" },
{ _id: 5, name: "5 minutes" },
{ _id: 10, name: "10 minutes" },
];
const METRICS = ["cpu", "memory", "disk", "temperature"];
const METRIC_PREFIX = "usage_";
const MS_PER_MINUTE = 60000;
const hasAlertError = (errors) => {
return Object.keys(errors).filter((k) => k.startsWith(METRIC_PREFIX)).length > 0;
};
const getAlertError = (errors) => {
return Object.keys(errors).find((key) => key.startsWith(METRIC_PREFIX))
? errors[Object.keys(errors).find((key) => key.startsWith(METRIC_PREFIX))]
: null;
};
const CreateInfrastructureMonitor = () => { const CreateInfrastructureMonitor = () => {
const theme = useTheme();
const { user, authToken } = useSelector((state) => state.auth);
const monitorState = useSelector((state) => state.infrastructureMonitor);
const dispatch = useDispatch();
const navigate = useNavigate();
// State
const [errors, setErrors] = useState({});
const [https, setHttps] = useState(false);
const [infrastructureMonitor, setInfrastructureMonitor] = useState({ const [infrastructureMonitor, setInfrastructureMonitor] = useState({
url: "", url: "",
name: "", name: "",
@@ -38,118 +73,73 @@ const CreateInfrastructureMonitor = () => {
secret: "", secret: "",
}); });
const MS_PER_MINUTE = 60000; // Handlers
const THRESHOLD_FIELD_PREFIX = "usage_"; const handleCreateInfrastructureMonitor = async (event) => {
const HARDWARE_MONITOR_TYPES = ["cpu", "memory", "disk", "temperature"];
const { user, authToken } = useSelector((state) => state.auth);
const monitorState = useSelector((state) => state.infrastructureMonitor);
const dispatch = useDispatch();
const navigate = useNavigate();
const theme = useTheme();
const idMap = {
"notify-email-default": "notification-email",
};
const [errors, setErrors] = useState({});
const alertErrKeyLen = Object.keys(errors).filter((k) =>
k.startsWith(THRESHOLD_FIELD_PREFIX)
).length;
const handleCustomAlertCheckChange = (event) => {
const { value, id } = event.target;
setInfrastructureMonitor((prev) => {
const newState = {
[id]: prev[id] == undefined && value == "on" ? true : !prev[id],
};
return {
...prev,
...newState,
[THRESHOLD_FIELD_PREFIX + id]: newState[id]
? prev[THRESHOLD_FIELD_PREFIX + id]
: "",
};
});
// Remove the error if unchecked
setErrors((prev) => {
return buildErrors(prev, [THRESHOLD_FIELD_PREFIX + id]);
});
};
const handleBlur = (event, appendID) => {
event.preventDefault(); event.preventDefault();
const { value, id } = event.target;
let name = idMap[id] ?? id; // Build the form
if (name === "url" && infrastructureMonitor.name === "") { let form = {
setInfrastructureMonitor((prev) => ({ url: `http${https ? "s" : ""}://` + infrastructureMonitor.url,
...prev, name:
name: parseDomainName(value), infrastructureMonitor.name === ""
})); ? infrastructureMonitor.url
: infrastructureMonitor.name,
interval: infrastructureMonitor.interval * MS_PER_MINUTE,
cpu: infrastructureMonitor.cpu,
...(infrastructureMonitor.cpu
? { usage_cpu: infrastructureMonitor.usage_cpu }
: {}),
memory: infrastructureMonitor.memory,
...(infrastructureMonitor.memory
? { usage_memory: infrastructureMonitor.usage_memory }
: {}),
disk: infrastructureMonitor.disk,
...(infrastructureMonitor.disk
? { usage_disk: infrastructureMonitor.usage_disk }
: {}),
temperature: infrastructureMonitor.temperature,
...(infrastructureMonitor.temperature
? { usage_temperature: infrastructureMonitor.usage_temperature }
: {}),
secret: infrastructureMonitor.secret,
};
const { error } = infrastructureMonitorValidation.validate(form, {
abortEarly: false,
});
if (error) {
const newErrors = {};
error.details.forEach((err) => {
newErrors[err.path[0]] = err.message;
});
setErrors(newErrors);
createToast({ body: "Please check the form for errors." });
return;
} }
if (id?.startsWith("notify-email-")) return; // Build the thresholds for the form
const { error } = infrastructureMonitorValidation.validate( const {
{ [id ?? appendID]: value }, cpu,
{ usage_cpu,
abortEarly: false, memory,
} usage_memory,
); disk,
setErrors((prev) => { usage_disk,
return buildErrors(prev, id ?? appendID, error); temperature,
}); usage_temperature,
}; ...rest
} = form;
const handleChange = (event, appendedId) => { const thresholds = {
event.preventDefault(); ...(cpu ? { usage_cpu: usage_cpu / 100 } : {}),
const { value, id } = event.target; ...(memory ? { usage_memory: usage_memory / 100 } : {}),
let name = appendedId ?? idMap[id] ?? id; ...(disk ? { usage_disk: usage_disk / 100 } : {}),
if (name.includes("notification-")) { ...(temperature ? { usage_temperature: usage_temperature / 100 } : {}),
name = name.replace("notification-", ""); };
let hasNotif = infrastructureMonitor.notifications.some(
(notification) => notification.type === name
);
setInfrastructureMonitor((prev) => {
const notifs = [...prev.notifications];
if (hasNotif) {
return {
...prev,
notifications: notifs.filter((notif) => notif.type !== name),
};
} else {
return {
...prev,
notifications: [
...notifs,
name === "email"
? { type: name, address: value }
: // TODO - phone number
{ type: name, phone: value },
],
};
}
});
} else {
setInfrastructureMonitor((prev) => ({
...prev,
[name]: value,
}));
}
};
const generatePayload = (form) => {
let thresholds = {};
Object.keys(form)
.filter((k) => k.startsWith(THRESHOLD_FIELD_PREFIX))
.map((k) => {
if (form[k]) thresholds[k] = form[k] / 100;
delete form[k];
delete form[k.substring(THRESHOLD_FIELD_PREFIX.length)];
});
form = { form = {
...form, ...rest,
description: form.name, description: form.name,
teamId: user.teamId, teamId: user.teamId,
userId: user._id, userId: user._id,
@@ -157,54 +147,69 @@ const CreateInfrastructureMonitor = () => {
notifications: infrastructureMonitor.notifications, notifications: infrastructureMonitor.notifications,
thresholds, thresholds,
}; };
return form;
};
const handleCreateInfrastructureMonitor = async (event) => {
event.preventDefault();
let form = {
...infrastructureMonitor,
name:
infrastructureMonitor.name === ""
? infrastructureMonitor.url
: infrastructureMonitor.name,
interval: infrastructureMonitor.interval * MS_PER_MINUTE,
};
delete form.notifications; const action = await dispatch(
if (hasValidationErrors(form, infrastructureMonitorValidation, setErrors)) { createInfrastructureMonitor({ authToken, monitor: form })
return; );
if (action.meta.requestStatus === "fulfilled") {
createToast({ body: "Infrastructure monitor created successfully!" });
navigate("/infrastructure");
} else { } else {
const checkEndpointAction = await dispatch( createToast({ body: "Failed to create monitor." });
checkInfrastructureEndpointResolution({ authToken, monitorURL: form.url })
);
if (checkEndpointAction.meta.requestStatus === "rejected") {
createToast({
body: "The endpoint you entered doesn't resolve. Check the URL again.",
});
setErrors({ url: "The entered URL is not reachable." });
return;
}
const action = await dispatch(
createInfrastructureMonitor({ authToken, monitor: generatePayload(form) })
);
if (action.meta.requestStatus === "fulfilled") {
createToast({ body: "Infrastructure monitor created successfully!" });
navigate("/infrastructure");
} else {
createToast({ body: "Failed to create monitor." });
}
} }
}; };
//select values const handleChange = (event) => {
const frequencies = [ const { value, name } = event.target;
{ _id: 0.25, name: "15 seconds" }, setInfrastructureMonitor({
{ _id: 0.5, name: "30 seconds" }, ...infrastructureMonitor,
{ _id: 1, name: "1 minute" }, [name]: value,
{ _id: 2, name: "2 minutes" }, });
{ _id: 5, name: "5 minutes" },
{ _id: 10, name: "10 minutes" }, const { error } = infrastructureMonitorValidation.validate(
]; { [name]: value },
{ abortEarly: false }
);
setErrors((prev) => ({
...prev,
...(error ? { [name]: error.details[0].message } : { [name]: undefined }),
}));
};
const handleCheckboxChange = (event) => {
const { name } = event.target;
const { checked } = event.target;
setInfrastructureMonitor({
...infrastructureMonitor,
[name]: checked,
});
};
const handleNotifications = (event, type) => {
const { value } = event.target;
let notifications = [...infrastructureMonitor.notifications];
const notificationExists = notifications.some((notification) => {
if (notification.type === type && notification.address === value) {
return true;
}
return false;
});
if (notificationExists) {
notifications = notifications.filter((notification) => {
if (notification.type === type && notification.address === value) {
return false;
}
return true;
});
} else {
notifications.push({ type, address: value });
}
setInfrastructureMonitor((prev) => ({
...prev,
notifications,
}));
};
return ( return (
<Box className="create-infrastructure-monitor"> <Box className="create-infrastructure-monitor">
@@ -239,56 +244,75 @@ const CreateInfrastructureMonitor = () => {
fontSize="inherit" fontSize="inherit"
fontWeight="inherit" fontWeight="inherit"
> >
infrastructure monitor monitor
</Typography> </Typography>
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Box> <Stack gap={theme.spacing(6)}>
<Stack gap={theme.spacing(6)}> <Typography component="h2">General settings</Typography>
<Typography component="h2">General settings</Typography> <Typography component="p">
<Typography component="p"> Here you can select the URL of the host, together with the friendly name and
Here you can select the URL of the host, together with the friendly name authorization secret to connect to the server agent.
and authorization secret to connect to the server agent. </Typography>
</Typography> <Typography component="p">
<Typography component="p"> The server you are monitoring must be running the{" "}
The server you are monitoring must be running the{" "} <Link
<Link level="primary"
level="primary" url="https://github.com/bluewave-labs/checkmate-agent"
url="https://github.com/bluewave-labs/checkmate-agent" label="Checkmate Monitoring Agent"
label="Checkmate Monitoring Agent" />
/> </Typography>
</Typography> </Stack>
</Stack>
</Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<TextInput <TextInput
type="text" type="url"
id="url" id="url"
name="url"
startAdornment={<HttpAdornment https={https} />}
placeholder={"localhost:59232/api/v1/metrics"}
label="Server URL" label="Server URL"
placeholder="https://" https={https}
value={infrastructureMonitor.url} value={infrastructureMonitor.url}
onBlur={handleBlur}
onChange={handleChange} onChange={handleChange}
error={errors["url"] ? true : false} error={errors["url"] ? true : false}
helperText={errors["url"]} helperText={errors["url"]}
/> />
<Box>
<Typography component="p">Protocol</Typography>
<ButtonGroup>
<Button
variant="group"
filled={https.toString()}
onClick={() => setHttps(true)}
>
HTTPS
</Button>
<Button
variant="group"
filled={(!https).toString()}
onClick={() => setHttps(false)}
>
HTTP
</Button>
</ButtonGroup>
</Box>
<TextInput <TextInput
type="text" type="text"
id="name" id="name"
name="name"
label="Display name" label="Display name"
placeholder="Google" placeholder="Google"
isOptional={true} isOptional={true}
value={infrastructureMonitor.name} value={infrastructureMonitor.name}
onBlur={handleBlur}
onChange={handleChange} onChange={handleChange}
error={errors["name"]} error={errors["name"]}
/> />
<TextInput <TextInput
type="text" type="text"
id="secret" id="secret"
name="secret"
label="Authorization secret" label="Authorization secret"
value={infrastructureMonitor.secret} value={infrastructureMonitor.secret}
onBlur={handleBlur}
onChange={handleChange} onChange={handleChange}
error={errors["secret"] ? true : false} error={errors["secret"] ? true : false}
helperText={errors["secret"]} helperText={errors["secret"]}
@@ -303,7 +327,6 @@ const CreateInfrastructureMonitor = () => {
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="p">When there is a new incident,</Typography>
<Checkbox <Checkbox
id="notify-email-default" id="notify-email-default"
label={`Notify via email (to ${user.email})`} label={`Notify via email (to ${user.email})`}
@@ -311,12 +334,10 @@ const CreateInfrastructureMonitor = () => {
(notification) => notification.type === "email" (notification) => notification.type === "email"
)} )}
value={user?.email} value={user?.email}
onChange={(e) => handleChange(e)} onChange={(event) => handleNotifications(event, "email")}
onBlur={handleBlur}
/> />
</Stack> </Stack>
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Customize alerts</Typography> <Typography component="h2">Customize alerts</Typography>
@@ -326,25 +347,31 @@ const CreateInfrastructureMonitor = () => {
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
{HARDWARE_MONITOR_TYPES.map((type, idx) => ( {METRICS.map((metric) => {
<CustomThreshold return (
key={idx} <CustomThreshold
checkboxId={type} key={metric}
checkboxLabel={ infrastructureMonitor={infrastructureMonitor}
type !== "cpu" ? capitalizeFirstLetter(type) : type.toUpperCase() errors={errors}
} checkboxId={metric}
onCheckboxChange={handleCustomAlertCheckChange} checkboxName={metric}
fieldId={THRESHOLD_FIELD_PREFIX + type} checkboxLabel={
fieldValue={infrastructureMonitor[THRESHOLD_FIELD_PREFIX + type] ?? ""} metric !== "cpu"
onFieldChange={handleChange} ? capitalizeFirstLetter(metric)
onFieldBlur={handleBlur} : metric.toUpperCase()
// TODO: need BE, maybe in another PR }
alertUnit={type == "temperature" ? "°C" : "%"} onCheckboxChange={handleCheckboxChange}
infrastructureMonitor={infrastructureMonitor} isChecked={infrastructureMonitor[metric]}
errors={errors} fieldId={METRIC_PREFIX + metric}
/> fieldName={METRIC_PREFIX + metric}
))} fieldValue={infrastructureMonitor[METRIC_PREFIX + metric]}
{alertErrKeyLen > 0 && ( onFieldChange={handleChange}
alertUnit={metric == "temperature" ? "°C" : "%"}
/>
);
})}
{/* Error text */}
{hasAlertError(errors) && (
<Typography <Typography
component="span" component="span"
className="input-error" className="input-error"
@@ -354,14 +381,7 @@ const CreateInfrastructureMonitor = () => {
opacity: 0.8, opacity: 0.8,
}} }}
> >
{ {getAlertError(errors)}
errors[
THRESHOLD_FIELD_PREFIX +
HARDWARE_MONITOR_TYPES.filter(
(type) => errors[THRESHOLD_FIELD_PREFIX + type]
)[0]
]
}
</Typography> </Typography>
)} )}
</Stack> </Stack>
@@ -373,11 +393,11 @@ const CreateInfrastructureMonitor = () => {
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
id="interval" id="interval"
name="interval"
label="Check frequency" label="Check frequency"
value={infrastructureMonitor.interval || 15} value={infrastructureMonitor.interval || 15}
onChange={(e) => handleChange(e, "interval")} onChange={handleChange}
onBlur={(e) => handleBlur(e, "interval")} items={SELECT_VALUES}
items={frequencies}
/> />
</Stack> </Stack>
</ConfigBox> </ConfigBox>
@@ -8,7 +8,7 @@ import AreaChart from "../../../Components/Charts/AreaChart";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { networkService } from "../../../main"; import { networkService } from "../../../main";
import PulseDot from "../../../Components/Animated/PulseDot"; import PulseDot from "../../../Components/Animated/PulseDot";
import useUtils from "../../Monitors/utils"; import useUtils from "../../Uptime/utils";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import Empty from "./empty"; import Empty from "./empty";
import { logger } from "../../../Utils/Logger"; import { logger } from "../../../Utils/Logger";
@@ -283,7 +283,7 @@ const InfrastructureDetails = () => {
{ {
type: "memory", type: "memory",
value: decimalToPercentage(memoryUsagePercent), value: decimalToPercentage(memoryUsagePercent),
heading: "Memory Usage", heading: "Memory usage",
metricOne: "Used", metricOne: "Used",
valueOne: formatBytes(memoryUsedBytes), valueOne: formatBytes(memoryUsedBytes),
metricTwo: "Total", metricTwo: "Total",
@@ -292,7 +292,7 @@ const InfrastructureDetails = () => {
{ {
type: "cpu", type: "cpu",
value: decimalToPercentage(cpuUsagePercent), value: decimalToPercentage(cpuUsagePercent),
heading: "CPU Usage", heading: "CPU usage",
metricOne: "Cores", metricOne: "Cores",
valueOne: cpuPhysicalCores ?? 0, valueOne: cpuPhysicalCores ?? 0,
metricTwo: "Frequency", metricTwo: "Frequency",
@@ -364,7 +364,7 @@ const InfrastructureDetails = () => {
heading: "Memory usage", heading: "Memory usage",
strokeColor: theme.palette.primary.main, strokeColor: theme.palette.primary.main,
gradientStartColor: theme.palette.primary.main, gradientStartColor: theme.palette.primary.main,
yLabel: "Memory Usage", yLabel: "Memory usage",
yDomain: [0, 1], yDomain: [0, 1],
yTick: <PercentTick />, yTick: <PercentTick />,
xTick: <TzTick />, xTick: <TzTick />,
@@ -372,7 +372,7 @@ const InfrastructureDetails = () => {
<InfrastructureTooltip <InfrastructureTooltip
dotColor={theme.palette.primary.main} dotColor={theme.palette.primary.main}
yKey={"memory.usage_percent"} yKey={"memory.usage_percent"}
yLabel={"Memory Usage"} yLabel={"Memory usage"}
/> />
), ),
}, },
@@ -383,7 +383,7 @@ const InfrastructureDetails = () => {
heading: "CPU usage", heading: "CPU usage",
strokeColor: theme.palette.success.main, strokeColor: theme.palette.success.main,
gradientStartColor: theme.palette.success.main, gradientStartColor: theme.palette.success.main,
yLabel: "CPU Usage", yLabel: "CPU usage",
yDomain: [0, 1], yDomain: [0, 1],
yTick: <PercentTick />, yTick: <PercentTick />,
xTick: <TzTick />, xTick: <TzTick />,
@@ -391,7 +391,7 @@ const InfrastructureDetails = () => {
<InfrastructureTooltip <InfrastructureTooltip
dotColor={theme.palette.success.main} dotColor={theme.palette.success.main}
yKey={"cpu.usage_percent"} yKey={"cpu.usage_percent"}
yLabel={"CPU Usage"} yLabel={"CPU usage"}
/> />
), ),
}, },
@@ -109,88 +109,6 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
}, },
}} }}
> >
{/*
Open site action. Not necessary for infrastructure?
{actions.url !== null ? (
<MenuItem
onClick={(e) => {
closeMenu(e);
e.stopPropagation();
window.open(actions.url, "_blank", "noreferrer");
}}
>
Open site
</MenuItem>
) : (
""
)}
*/}
<MenuItem onClick={() => openDetails(monitor.id)}>Details</MenuItem>
{/*
Incidents. Necessary?
<MenuItem
onClick={(e) => {
e.stopPropagation();
navigate(`/incidents/${actions.id}`);
}}
>
Incidents
</MenuItem> */}
{/*
Configure. Necessary?
{isAdmin && (
<MenuItem
onClick={(e) => {
e.stopPropagation();
navigate(`/monitors/configure/${actions.id}`);
}}
>
Configure
</MenuItem>
)} */}
{/*
Clone. Necessary?
{isAdmin && (
<MenuItem
onClick={(e) => {
e.stopPropagation();
navigate(`/monitors/create/${actions.id}`);
}}
>
Clone
</MenuItem>
)} */}
{/*
Pause. Necessary?
const handlePause = async () => {
try {
const action = await dispatch(
pauseUptimeMonitor({ authToken, monitorId: monitor._id })
);
if (pauseUptimeMonitor.fulfilled.match(action)) {
updateCallback();
const state = action?.payload?.data.isActive === false ? "paused" : "resumed";
createToast({ body: `Monitor ${state} successfully.` });
} else {
throw new Error(action?.error?.message ?? "Failed to pause monitor.");
}
} catch (error) {
logger.error("Error pausing monitor:", monitor._id, error);
createToast({ body: "Failed to pause monitor." });
}
};
{isAdmin && (
<MenuItem
onClick={(e) => {
e.stopPropagation();
handlePause(e);
}}
>
{monitor?.isActive === true ? "Pause" : "Resume"}
</MenuItem>
)} */}
{isAdmin && <MenuItem onClick={openRemove}>Remove</MenuItem>} {isAdmin && <MenuItem onClick={openRemove}>Remove</MenuItem>}
</Menu> </Menu>
<Dialog <Dialog
+21 -26
View File
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { /* useDispatch, */ useSelector } from "react-redux"; import { /* useDispatch, */ useSelector } from "react-redux";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import useUtils from "../Monitors/utils"; import useUtils from "../Uptime/utils.jsx";
import { jwtDecode } from "jwt-decode"; import { jwtDecode } from "jwt-decode";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import Fallback from "../../Components/Fallback"; import Fallback from "../../Components/Fallback";
@@ -28,7 +28,7 @@ import { Pagination } from "./components/TablePagination";
// import { getInfrastructureMonitorsByTeamId } from "../../Features/InfrastructureMonitors/infrastructureMonitorsSlice"; // import { getInfrastructureMonitorsByTeamId } from "../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
import { networkService } from "../../Utils/NetworkService.js"; import { networkService } from "../../Utils/NetworkService.js";
import CustomGauge from "../../Components/Charts/CustomGauge/index.jsx"; import CustomGauge from "../../Components/Charts/CustomGauge/index.jsx";
import Host from "../Monitors/Home/host.jsx"; import Host from "../Uptime/Home/host.jsx";
import { useIsAdmin } from "../../Hooks/useIsAdmin.js"; import { useIsAdmin } from "../../Hooks/useIsAdmin.js";
import { InfrastructureMenu } from "./components/Menu"; import { InfrastructureMenu } from "./components/Menu";
@@ -191,31 +191,26 @@ function Infrastructure() {
<SkeletonLayout /> <SkeletonLayout />
) : monitorState.monitors?.length !== 0 ? ( ) : monitorState.monitors?.length !== 0 ? (
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(8)}>
<Breadcrumbs list={BREADCRUMBS} /> <Box>
<Stack <Breadcrumbs list={BREADCRUMBS} />
direction="row" <Stack
sx={{ direction="row"
justifyContent: "end", justifyContent="end"
alignItems: "center", alignItems="center"
gap: "1rem", mt={theme.spacing(5)}
flexWrap: "wrap",
marginBottom: "2rem",
}}
>
{/*
This will be removed from here, but keeping the commented code to remind me to add a max width to the greeting component
<Box style={{ maxWidth: "65ch" }}>
<Greeting type="uptime" />
</Box> */}
<Button
variant="contained"
color="primary"
onClick={navigateToCreate}
sx={{ fontWeight: 500 }}
> >
Create infrastructure monitor {isAdmin && (
</Button> <Button
</Stack> variant="contained"
color="primary"
onClick={navigateToCreate}
sx={{ fontWeight: 500, whiteSpace: "nowrap" }}
>
Create new
</Button>
)}
</Stack>
</Box>
<Stack <Stack
sx={{ sx={{
gap: "1rem", gap: "1rem",
@@ -13,7 +13,7 @@ import {
import { monitorValidation } from "../../../Validation/validation"; import { monitorValidation } from "../../../Validation/validation";
import { createToast } from "../../../Utils/toastUtils"; import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger"; import { logger } from "../../../Utils/Logger";
import { ConfigBox } from "../../Monitors/styled"; import { ConfigBox } from "../../Uptime/styled";
import TextInput from "../../../Components/Inputs/TextInput"; import TextInput from "../../../Components/Inputs/TextInput";
import Select from "../../../Components/Inputs/Select"; import Select from "../../../Components/Inputs/Select";
import Checkbox from "../../../Components/Inputs/Checkbox"; import Checkbox from "../../../Components/Inputs/Checkbox";
@@ -23,7 +23,7 @@ import PulseDot from "../../../Components/Animated/PulseDot";
import LoadingButton from "@mui/lab/LoadingButton"; import LoadingButton from "@mui/lab/LoadingButton";
import PlayCircleOutlineRoundedIcon from "@mui/icons-material/PlayCircleOutlineRounded"; import PlayCircleOutlineRoundedIcon from "@mui/icons-material/PlayCircleOutlineRounded";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import useUtils from "../../Monitors/utils"; import useUtils from "../../Uptime/utils";
import "./index.css"; import "./index.css";
import Dialog from "../../../Components/Dialog"; import Dialog from "../../../Components/Dialog";
@@ -1,42 +1,51 @@
import { useState } from "react"; // React, Redux, Router
import { Box, Button, ButtonGroup, Stack, Typography } from "@mui/material";
import LoadingButton from "@mui/lab/LoadingButton";
import { useSelector, useDispatch } from "react-redux";
import { monitorValidation } from "../../../Validation/validation";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTheme } from "@emotion/react"; import { useState } from "react";
import { useSelector, useDispatch } from "react-redux";
// Utility and Network
import { monitorValidation } from "../../../Validation/validation";
import { import {
createPageSpeed, createPageSpeed,
checkEndpointResolution, checkEndpointResolution,
} from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice"; } from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice";
import { createToast } from "../../../Utils/toastUtils"; import { parseDomainName } from "../../../Utils/monitorUtils";
import { logger } from "../../../Utils/Logger";
import { ConfigBox } from "../../Monitors/styled"; // MUI
import Radio from "../../../Components/Inputs/Radio"; import { useTheme } from "@emotion/react";
import { Box, Stack, Typography, Button, ButtonGroup } from "@mui/material";
import LoadingButton from "@mui/lab/LoadingButton";
//Components
import Breadcrumbs from "../../../Components/Breadcrumbs";
import TextInput from "../../../Components/Inputs/TextInput"; import TextInput from "../../../Components/Inputs/TextInput";
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments"; import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
import Select from "../../../Components/Inputs/Select"; import { ConfigBox } from "../../Uptime/styled";
import { createToast } from "../../../Utils/toastUtils";
import Radio from "../../../Components/Inputs/Radio";
import Checkbox from "../../../Components/Inputs/Checkbox"; import Checkbox from "../../../Components/Inputs/Checkbox";
import Breadcrumbs from "../../../Components/Breadcrumbs"; import Select from "../../../Components/Inputs/Select";
import { parseDomainName } from "../../../Utils/monitorUtils";
import "./index.css"; const MS_PER_MINUTE = 60000;
const CRUMBS = [
{ name: "pagespeed", path: "/pagespeed" },
{ name: "create", path: `/pagespeed/create` },
];
const SELECT_VALUES = [
{ _id: 3, name: "3 minutes" },
{ _id: 5, name: "5 minutes" },
{ _id: 10, name: "10 minutes" },
{ _id: 20, name: "20 minutes" },
{ _id: 60, name: "1 hour" },
{ _id: 1440, name: "1 day" },
{ _id: 10080, name: "1 week" },
];
const CreatePageSpeed = () => { const CreatePageSpeed = () => {
const MS_PER_MINUTE = 60000; // State
const { user, authToken } = useSelector((state) => state.auth);
const { isLoading } = useSelector((state) => state.pageSpeedMonitors);
const dispatch = useDispatch();
const navigate = useNavigate();
const theme = useTheme();
const idMap = {
"monitor-url": "url",
"monitor-name": "name",
"monitor-checks-http": "type",
"monitor-checks-ping": "type",
"notify-email-default": "notification-email",
};
const [monitor, setMonitor] = useState({ const [monitor, setMonitor] = useState({
url: "", url: "",
name: "", name: "",
@@ -44,71 +53,20 @@ const CreatePageSpeed = () => {
notifications: [], notifications: [],
interval: 3, interval: 3,
}); });
const [https, setHttps] = useState(true); const [https, setHttps] = useState(true);
const [errors, setErrors] = useState({}); const [errors, setErrors] = useState({});
const { user, authToken } = useSelector((state) => state.auth);
const { isLoading } = useSelector((state) => state.pageSpeedMonitors);
const handleChange = (event, name) => { // Setup
const { value, id } = event.target; const dispatch = useDispatch();
if (!name) name = idMap[id]; const navigate = useNavigate();
const theme = useTheme();
if (name.includes("notification-")) {
name = name.replace("notification-", "");
let hasNotif = monitor.notifications.some(
(notification) => notification.type === name
);
setMonitor((prev) => {
const notifs = [...prev.notifications];
if (hasNotif) {
return {
...prev,
notifications: notifs.filter((notif) => notif.type !== name),
};
} else {
return {
...prev,
notifications: [
...notifs,
name === "email"
? { type: name, address: value }
: // TODO - phone number
{ type: name, phone: value },
],
};
}
});
} else {
setMonitor((prev) => ({
...prev,
[name]: value,
}));
const { error } = monitorValidation.validate(
{ [name]: value },
{ abortEarly: false }
);
setErrors((prev) => {
const updatedErrors = { ...prev };
if (error) updatedErrors[name] = error.details[0].message;
else delete updatedErrors[name];
return updatedErrors;
});
}
};
const onUrlBlur = (event) => {
const { value } = event.target;
if (monitor.name === "") {
setMonitor((prev) => ({
...prev,
name: parseDomainName(value),
}));
}
};
// Handlers
const handleCreateMonitor = async (event) => { const handleCreateMonitor = async (event) => {
event.preventDefault(); event.preventDefault();
//obj to submit
let form = { let form = {
url: `http${https ? "s" : ""}://` + monitor.url, url: `http${https ? "s" : ""}://` + monitor.url,
name: monitor.name === "" ? monitor.url : monitor.name, name: monitor.name === "" ? monitor.url : monitor.name,
@@ -126,46 +84,97 @@ const CreatePageSpeed = () => {
newErrors[err.path[0]] = err.message; newErrors[err.path[0]] = err.message;
}); });
setErrors(newErrors); setErrors(newErrors);
createToast({ body: "Error validation data." }); createToast({ body: "Please check the form for errors." });
} else { return;
const checkEndpointAction = await dispatch( }
checkEndpointResolution({ authToken, monitorURL: form.url })
);
if (checkEndpointAction.meta.requestStatus === "rejected") {
createToast({
body: "The endpoint you entered doesn't resolve. Check the URL again.",
});
setErrors({ url: "The entered URL is not reachable." });
return;
}
form = { const checkEndpointAction = await dispatch(
...form, checkEndpointResolution({ authToken, monitorURL: form.url })
description: form.name, );
teamId: user.teamId,
userId: user._id, if (checkEndpointAction.meta.requestStatus === "rejected") {
notifications: monitor.notifications, createToast({
}; body: "The endpoint you entered doesn't resolve. Check the URL again.",
const action = await dispatch(createPageSpeed({ authToken, monitor: form })); });
if (action.meta.requestStatus === "fulfilled") { setErrors({ url: "The entered URL is not reachable." });
createToast({ body: "Monitor created successfully!" }); return;
navigate("/pagespeed"); }
} else {
createToast({ body: "Failed to create monitor." }); form = {
} ...form,
description: form.name,
teamId: user.teamId,
userId: user._id,
notifications: monitor.notifications,
};
const action = await dispatch(createPageSpeed({ authToken, monitor: form }));
if (action.meta.requestStatus === "fulfilled") {
createToast({ body: "Monitor created successfully!" });
navigate("/pagespeed");
} else {
createToast({ body: "Failed to create monitor." });
}
};
const handleChange = (event) => {
const { value, name } = event.target;
setMonitor({
...monitor,
[name]: value,
});
const { error } = monitorValidation.validate(
{ [name]: value },
{ abortEarly: false }
);
setErrors((prev) => ({
...prev,
...(error ? { [name]: error.details[0].message } : { [name]: undefined }),
}));
};
const handleNotifications = (event, type) => {
const { value } = event.target;
let notifications = [...monitor.notifications];
const notificationExists = notifications.some((notification) => {
if (notification.type === type && notification.address === value) {
return true;
}
return false;
});
if (notificationExists) {
notifications = notifications.filter((notification) => {
if (notification.type === type && notification.address === value) {
return false;
}
return true;
});
} else {
notifications.push({ type, address: value });
}
setMonitor((prev) => ({
...prev,
notifications,
}));
};
const handleBlur = (event) => {
const { name } = event.target;
if (name === "url") {
const { value } = event.target;
if (monitor.name !== "") {
return;
}
setMonitor((prev) => ({
...prev,
name: parseDomainName(value),
}));
} }
}; };
//select values
const frequencies = [
{ _id: 3, name: "3 minutes" },
{ _id: 5, name: "5 minutes" },
{ _id: 10, name: "10 minutes" },
{ _id: 20, name: "20 minutes" },
{ _id: 60, name: "1 hour" },
{ _id: 1440, name: "1 day" },
{ _id: 10080, name: "1 week" },
];
return ( return (
<Box <Box
className="create-monitor" className="create-monitor"
@@ -175,12 +184,7 @@ const CreatePageSpeed = () => {
}, },
}} }}
> >
<Breadcrumbs <Breadcrumbs list={CRUMBS} />
list={[
{ name: "pagespeed", path: "/pagespeed" },
{ name: "create", path: `/pagespeed/create` },
]}
/>
<Stack <Stack
component="form" component="form"
className="create-monitor-form" className="create-monitor-form"
@@ -206,7 +210,7 @@ const CreatePageSpeed = () => {
fontWeight="inherit" fontWeight="inherit"
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
pagespeed monitor PageSpeed monitor
</Typography> </Typography>
</Typography> </Typography>
<ConfigBox> <ConfigBox>
@@ -219,19 +223,21 @@ const CreatePageSpeed = () => {
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<TextInput <TextInput
type={"url"} type={"url"}
name="url"
id="monitor-url" id="monitor-url"
label="URL to monitor" label="URL to monitor"
startAdornment={<HttpAdornment https={https} />} startAdornment={<HttpAdornment https={https} />}
placeholder="google.com" placeholder="google.com"
value={monitor.url} value={monitor.url}
onChange={handleChange} onChange={handleChange}
onBlur={onUrlBlur} onBlur={handleBlur}
error={errors["url"] ? true : false} error={errors["url"] ? true : false}
helperText={errors["url"]} helperText={errors["url"]}
/> />
<TextInput <TextInput
type="text" type="text"
id="monitor-name" id="monitor-name"
name="name"
label="Display name" label="Display name"
isOptional={true} isOptional={true}
placeholder="Google" placeholder="Google"
@@ -253,12 +259,11 @@ const CreatePageSpeed = () => {
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Radio <Radio
id="monitor-checks-http" id="monitor-checks-http"
title="Website monitoring" title="PageSpeed"
desc="Use HTTP(s) to monitor your website or API endpoint." desc="Use the Lighthouse PageSpeed API to monitor your website"
size="small" size="small"
value="http" value="http"
checked={monitor.type === "pagespeed"} checked={monitor.type === "pagespeed"}
onChange={(event) => handleChange(event)}
/> />
<ButtonGroup sx={{ ml: "32px" }}> <ButtonGroup sx={{ ml: "32px" }}>
<Button <Button
@@ -269,8 +274,8 @@ const CreatePageSpeed = () => {
HTTPS HTTPS
</Button> </Button>
<Button <Button
variant="group" variant="group" // Why does this work?
filled={(!https).toString()} filled={(!https).toString()} // There's nothing in the docs about this either
onClick={() => setHttps(false)} onClick={() => setHttps(false)}
> >
HTTP HTTP
@@ -301,14 +306,6 @@ const CreatePageSpeed = () => {
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="p">When there is a new incident,</Typography> <Typography component="p">When there is a new incident,</Typography>
<Checkbox
id="notify-sms"
label="Notify via SMS (coming soon)"
isChecked={false}
value=""
onChange={() => logger.warn("disabled")}
isDisabled={true}
/>
<Checkbox <Checkbox
id="notify-email-default" id="notify-email-default"
label={`Notify via email (to ${user.email})`} label={`Notify via email (to ${user.email})`}
@@ -316,34 +313,8 @@ const CreatePageSpeed = () => {
(notification) => notification.type === "email" (notification) => notification.type === "email"
)} )}
value={user?.email} value={user?.email}
onChange={(event) => handleChange(event)} onChange={(event) => handleNotifications(event, "email")}
/> />
<Checkbox
id="notify-email"
label="Also notify via email to multiple addresses (coming soon)"
isChecked={false}
value=""
onChange={() => logger.warn("disabled")}
isDisabled={true}
/>
{monitor.notifications.some(
(notification) => notification.type === "emails"
) ? (
<Box mx={theme.spacing(16)}>
<TextInput
id="notify-email-list"
type="text"
placeholder="name@gmail.com"
value=""
onChange={() => logger.warn("disabled")}
/>
<Typography mt={theme.spacing(4)}>
You can separate multiple emails with a comma
</Typography>
</Box>
) : (
""
)}
</Stack> </Stack>
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
@@ -353,10 +324,11 @@ const CreatePageSpeed = () => {
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
id="monitor-interval" id="monitor-interval"
name="interval"
label="Check frequency" label="Check frequency"
value={monitor.interval || 3} value={monitor.interval || 3}
onChange={(event) => handleChange(event, "interval")} onChange={handleChange}
items={frequencies} items={SELECT_VALUES}
/> />
</Stack> </Stack>
</ConfigBox> </ConfigBox>
@@ -368,7 +340,7 @@ const CreatePageSpeed = () => {
variant="contained" variant="contained"
color="primary" color="primary"
onClick={handleCreateMonitor} onClick={handleCreateMonitor}
disabled={Object.keys(errors).length !== 0 && true} disabled={!Object.values(errors).every((value) => value === undefined)}
loading={isLoading} loading={isLoading}
> >
Create monitor Create monitor
@@ -378,5 +350,4 @@ const CreatePageSpeed = () => {
</Box> </Box>
); );
}; };
export default CreatePageSpeed; export default CreatePageSpeed;
+1 -1
View File
@@ -19,7 +19,7 @@ import PulseDot from "../../../Components/Animated/PulseDot";
import PagespeedDetailsAreaChart from "./Charts/AreaChart"; import PagespeedDetailsAreaChart from "./Charts/AreaChart";
import Checkbox from "../../../Components/Inputs/Checkbox"; import Checkbox from "../../../Components/Inputs/Checkbox";
import PieChart from "./Charts/PieChart"; import PieChart from "./Charts/PieChart";
import useUtils from "../../Monitors/utils"; import useUtils from "../../Uptime/utils";
import "./index.css"; import "./index.css";
const PageSpeedDetails = ({ isAdmin }) => { const PageSpeedDetails = ({ isAdmin }) => {
+1 -1
View File
@@ -8,7 +8,7 @@ import { IconBox } from "./Details/styled";
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip } from "recharts"; import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip } from "recharts";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { formatDateWithTz, formatDurationSplit } from "../../Utils/timeUtils"; import { formatDateWithTz, formatDurationSplit } from "../../Utils/timeUtils";
import useUtils from "../Monitors/utils"; import useUtils from "../Uptime/utils";
import { useState } from "react"; import { useState } from "react";
/** /**
+29 -6
View File
@@ -11,7 +11,7 @@ import Breadcrumbs from "../../Components/Breadcrumbs";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import Card from "./card"; import Card from "./card";
import { networkService } from "../../main"; import { networkService } from "../../main";
import { Heading } from "../../Components/Heading";
const PageSpeed = ({ isAdmin }) => { const PageSpeed = ({ isAdmin }) => {
const theme = useTheme(); const theme = useTheme();
const dispatch = useDispatch(); const dispatch = useDispatch();
@@ -20,6 +20,7 @@ const PageSpeed = ({ isAdmin }) => {
const { user, authToken } = useSelector((state) => state.auth); const { user, authToken } = useSelector((state) => state.auth);
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [monitors, setMonitors] = useState([]); const [monitors, setMonitors] = useState([]);
const [monitorCount, setMonitorCount] = useState(0);
useEffect(() => { useEffect(() => {
dispatch(getPageSpeedByTeamId(authToken)); dispatch(getPageSpeedByTeamId(authToken));
}, [authToken, dispatch]); }, [authToken, dispatch]);
@@ -44,6 +45,7 @@ const PageSpeed = ({ isAdmin }) => {
}); });
if (res?.data?.data?.monitors) { if (res?.data?.data?.monitors) {
setMonitors(res.data.data.monitors); setMonitors(res.data.data.monitors);
setMonitorCount(res.data.data.monitorCount);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@@ -53,7 +55,7 @@ const PageSpeed = ({ isAdmin }) => {
}; };
fetchMonitors(); fetchMonitors();
}, []); }, [authToken, user.teamId]);
// will show skeletons only on initial load // will show skeletons only on initial load
// since monitor state is being added to redux persist, there's no reason to display skeletons on every render // since monitor state is being added to redux persist, there's no reason to display skeletons on every render
@@ -76,8 +78,8 @@ const PageSpeed = ({ isAdmin }) => {
{isActuallyLoading ? ( {isActuallyLoading ? (
<SkeletonLayout /> <SkeletonLayout />
) : monitors?.length !== 0 ? ( ) : monitors?.length !== 0 ? (
<Box> <Stack gap={theme.spacing(8)}>
<Box mb={theme.spacing(12)}> <Box>
<Breadcrumbs list={[{ name: `pagespeed`, path: "/pagespeed" }]} /> <Breadcrumbs list={[{ name: `pagespeed`, path: "/pagespeed" }]} />
<Stack <Stack
direction="row" direction="row"
@@ -90,13 +92,34 @@ const PageSpeed = ({ isAdmin }) => {
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() => navigate("/pagespeed/create")} onClick={() => navigate("/pagespeed/create")}
sx={{ whiteSpace: "nowrap" }} sx={{ fontWeight: 500, whiteSpace: "nowrap" }}
> >
Create new Create new
</Button> </Button>
)} )}
</Stack> </Stack>
</Box> </Box>
<Stack
direction="row"
sx={{
alignItems: "center",
gap: ".25rem",
flexWrap: "wrap",
}}
>
<Heading component="h2">PageSpeed monitors</Heading>
{/* TODO Correct the class current-monitors-counter, there are some unnecessary things there */}
<Box
component="span"
className="current-monitors-counter"
color={theme.palette.text.primary}
border={1}
borderColor={theme.palette.border.light}
backgroundColor={theme.palette.background.accent}
>
{monitorCount}
</Box>
</Stack>
<Grid <Grid
container container
spacing={theme.spacing(12)} spacing={theme.spacing(12)}
@@ -108,7 +131,7 @@ const PageSpeed = ({ isAdmin }) => {
/> />
))} ))}
</Grid> </Grid>
</Box> </Stack>
) : ( ) : (
<Fallback <Fallback
title="pagespeed monitor" title="pagespeed monitor"
@@ -166,7 +166,7 @@ const Configure = () => {
event.preventDefault(); event.preventDefault();
const action = await dispatch(deleteUptimeMonitor({ authToken, monitor })); const action = await dispatch(deleteUptimeMonitor({ authToken, monitor }));
if (action.meta.requestStatus === "fulfilled") { if (action.meta.requestStatus === "fulfilled") {
navigate("/monitors"); navigate("/uptime");
} else { } else {
createToast({ body: "Failed to delete monitor." }); createToast({ body: "Failed to delete monitor." });
} }
@@ -207,9 +207,9 @@ const Configure = () => {
<> <>
<Breadcrumbs <Breadcrumbs
list={[ list={[
{ name: "monitors", path: "/monitors" }, { name: "uptime", path: "/uptime" },
{ name: "details", path: `/monitors/${monitorId}` }, { name: "details", path: `/uptime/${monitorId}` },
{ name: "configure", path: `/monitors/configure/${monitorId}` }, { name: "configure", path: `/uptime/configure/${monitorId}` },
]} ]}
/> />
<Stack <Stack
@@ -282,7 +282,7 @@ const Configure = () => {
}, },
}} }}
> >
Editting... Editing...
</Typography> </Typography>
</Stack> </Stack>
</Box> </Box>
@@ -60,8 +60,8 @@ const CreateMonitor = () => {
const theme = useTheme(); const theme = useTheme();
const { monitorId } = useParams(); const { monitorId } = useParams();
const crumbs = [ const crumbs = [
{ name: "monitors", path: "/monitors" }, { name: "uptime", path: "/uptime" },
{ name: "create", path: `/monitors/create` }, { name: "create", path: `/uptime/create` },
]; ];
// State // State
@@ -125,7 +125,7 @@ const CreateMonitor = () => {
const action = await dispatch(createUptimeMonitor({ authToken, monitor: form })); const action = await dispatch(createUptimeMonitor({ authToken, monitor: form }));
if (action.meta.requestStatus === "fulfilled") { if (action.meta.requestStatus === "fulfilled") {
createToast({ body: "Monitor created successfully!" }); createToast({ body: "Monitor created successfully!" });
navigate("/monitors"); navigate("/uptime");
} else { } else {
createToast({ body: "Failed to create monitor." }); createToast({ body: "Failed to create monitor." });
} }
@@ -345,8 +345,6 @@ const CreateMonitor = () => {
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="p">When there is a new incident,</Typography>
<Checkbox <Checkbox
id="notify-email-default" id="notify-email-default"
label={`Notify via email (to ${user.email})`} label={`Notify via email (to ${user.email})`}
@@ -100,7 +100,7 @@ const DetailsPage = ({ isAdmin }) => {
} }
}; };
fetchCertificate(); fetchCertificate();
}, [authToken, monitorId, monitor]); }, [authToken, monitorId, monitor, uiTimezone, dateFormat]);
const splitDuration = (duration) => { const splitDuration = (duration) => {
const { time, format } = formatDurationSplit(duration); const { time, format } = formatDurationSplit(duration);
@@ -117,18 +117,17 @@ const DetailsPage = ({ isAdmin }) => {
const [hoveredUptimeData, setHoveredUptimeData] = useState(null); const [hoveredUptimeData, setHoveredUptimeData] = useState(null);
const [hoveredIncidentsData, setHoveredIncidentsData] = useState(null); const [hoveredIncidentsData, setHoveredIncidentsData] = useState(null);
const BREADCRUMBS = [
{ name: "uptime", path: "/uptime" },
{ name: "details", path: `/uptime/${monitorId}` },
];
return ( return (
<Box className="monitor-details"> <Box className="monitor-details">
{loading ? ( {loading ? (
<SkeletonLayout /> <SkeletonLayout />
) : ( ) : (
<> <>
<Breadcrumbs <Breadcrumbs list={BREADCRUMBS} />
list={[
{ name: "monitors", path: "/monitors" },
{ name: "details", path: `/monitors/${monitorId}` },
]}
/>
<Stack <Stack
gap={theme.spacing(10)} gap={theme.spacing(10)}
mt={theme.spacing(10)} mt={theme.spacing(10)}
@@ -262,7 +261,7 @@ const DetailsPage = ({ isAdmin }) => {
<Button <Button
variant="contained" variant="contained"
color="secondary" color="secondary"
onClick={() => navigate(`/monitors/configure/${monitorId}`)} onClick={() => navigate(`/uptime/configure/${monitorId}`)}
sx={{ sx={{
px: theme.spacing(5), px: theme.spacing(5),
"& svg": { "& svg": {
@@ -1,13 +1,13 @@
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { Box, Stack } from "@mui/material"; import { Box, Stack } from "@mui/material";
import Search from "../../../../Components/Inputs/Search"; import Search from "../../../../Components/Inputs/Search";
import MemoizedMonitorTable from "../MonitorTable"; import MemoizedMonitorTable from "../UptimeTable";
import { useState } from "react"; import { useState } from "react";
import useDebounce from "../../../../Utils/debounce"; import useDebounce from "../../../../Utils/debounce";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Heading } from "../../../../Components/Heading"; import { Heading } from "../../../../Components/Heading";
const CurrentMonitoring = ({ totalMonitors, monitors, isAdmin }) => { const CurrentMonitoring = ({ totalMonitors, monitors, isAdmin, handlePause }) => {
const theme = useTheme(); const theme = useTheme();
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [isSearching, setIsSearching] = useState(false); const [isSearching, setIsSearching] = useState(false);
@@ -26,7 +26,7 @@ const CurrentMonitoring = ({ totalMonitors, monitors, isAdmin }) => {
alignItems="center" alignItems="center"
mb={theme.spacing(8)} mb={theme.spacing(8)}
> >
<Heading component="h2">Actively monitoring</Heading> <Heading component="h2">Uptime monitors</Heading>
<Box <Box
className="current-monitors-counter" className="current-monitors-counter"
@@ -55,12 +55,14 @@ const CurrentMonitoring = ({ totalMonitors, monitors, isAdmin }) => {
filter={debouncedFilter} filter={debouncedFilter}
setIsSearching={setIsSearching} setIsSearching={setIsSearching}
isSearching={isSearching} isSearching={isSearching}
handlePause={handlePause}
/> />
</Box> </Box>
); );
}; };
CurrentMonitoring.propTypes = { CurrentMonitoring.propTypes = {
handlePause: PropTypes.func,
totalMonitors: PropTypes.number, totalMonitors: PropTypes.number,
monitors: PropTypes.array, monitors: PropTypes.array,
isAdmin: PropTypes.bool, isAdmin: PropTypes.bool,
@@ -32,7 +32,7 @@ import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded";
import { Pagination } from "../../../Infrastructure/components/TablePagination"; import { Pagination } from "../../../Infrastructure/components/TablePagination";
const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching }) => { const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching, handlePause }) => {
const theme = useTheme(); const theme = useTheme();
const navigate = useNavigate(); const navigate = useNavigate();
const dispatch = useDispatch(); const dispatch = useDispatch();
@@ -48,7 +48,7 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching }) => {
const [sort, setSort] = useState({}); const [sort, setSort] = useState({});
const prevFilter = useRef(filter); const prevFilter = useRef(filter);
const handleActionMenuDelete = () => { const handleRowUpdate = () => {
setUpdateTrigger((prev) => !prev); setUpdateTrigger((prev) => !prev);
}; };
@@ -268,7 +268,7 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching }) => {
}, },
}} }}
onClick={() => { onClick={() => {
navigate(`/monitors/${monitor._id}`); navigate(`/uptime/${monitor._id}`);
}} }}
> >
<TableCell> <TableCell>
@@ -297,7 +297,8 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching }) => {
<ActionsMenu <ActionsMenu
monitor={monitor} monitor={monitor}
isAdmin={isAdmin} isAdmin={isAdmin}
updateCallback={handleActionMenuDelete} updateRowCallback={handleRowUpdate}
pauseCallback={handlePause}
/> />
</TableCell> </TableCell>
</TableRow> </TableRow>
@@ -325,6 +326,7 @@ MonitorTable.propTypes = {
filter: PropTypes.string, filter: PropTypes.string,
setIsSearching: PropTypes.func, setIsSearching: PropTypes.func,
isSearching: PropTypes.bool, isSearching: PropTypes.bool,
setMonitorUpdateTrigger: PropTypes.func,
}; };
const MemoizedMonitorTable = memo(MonitorTable); const MemoizedMonitorTable = memo(MonitorTable);
@@ -14,7 +14,7 @@ import Settings from "../../../assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import Dialog from "../../../Components/Dialog"; import Dialog from "../../../Components/Dialog";
const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => { const ActionsMenu = ({ monitor, isAdmin, updateRowCallback, pauseCallback }) => {
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
const [actions, setActions] = useState({}); const [actions, setActions] = useState({});
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
@@ -47,9 +47,9 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
pauseUptimeMonitor({ authToken, monitorId: monitor._id }) pauseUptimeMonitor({ authToken, monitorId: monitor._id })
); );
if (pauseUptimeMonitor.fulfilled.match(action)) { if (pauseUptimeMonitor.fulfilled.match(action)) {
updateCallback();
const state = action?.payload?.data.isActive === false ? "paused" : "resumed"; const state = action?.payload?.data.isActive === false ? "paused" : "resumed";
createToast({ body: `Monitor ${state} successfully.` }); createToast({ body: `Monitor ${state} successfully.` });
pauseCallback();
} else { } else {
throw new Error(action?.error?.message ?? "Failed to pause monitor."); throw new Error(action?.error?.message ?? "Failed to pause monitor.");
} }
@@ -131,7 +131,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
<MenuItem <MenuItem
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
navigate(`/monitors/${actions.id}`); navigate(`/uptime/${actions.id}`);
}} }}
> >
Details Details
@@ -150,7 +150,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
navigate(`/monitors/configure/${actions.id}`); navigate(`/uptime/configure/${actions.id}`);
}} }}
> >
Configure Configure
@@ -160,7 +160,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
<MenuItem <MenuItem
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
navigate(`/monitors/create/${actions.id}`); navigate(`/uptime/create/${actions.id}`);
}} }}
> >
Clone Clone
@@ -219,7 +219,8 @@ ActionsMenu.propTypes = {
isActive: PropTypes.bool, isActive: PropTypes.bool,
}).isRequired, }).isRequired,
isAdmin: PropTypes.bool, isAdmin: PropTypes.bool,
updateCallback: PropTypes.func, updateRowCallback: PropTypes.func,
pauseCallback: PropTypes.func,
}; };
export default ActionsMenu; export default ActionsMenu;
@@ -1,5 +1,5 @@
import "./index.css"; import "./index.css";
import { useEffect } from "react"; import { useEffect, useState } from "react";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { getUptimeMonitorsByTeamId } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; import { getUptimeMonitorsByTeamId } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
@@ -13,22 +13,29 @@ import Breadcrumbs from "../../../Components/Breadcrumbs";
import Greeting from "../../../Utils/greeting"; import Greeting from "../../../Utils/greeting";
import { CurrentMonitoring } from "./CurrentMonitoring"; import { CurrentMonitoring } from "./CurrentMonitoring";
const Monitors = ({ isAdmin }) => { const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }];
const UptimeMonitors = ({ isAdmin }) => {
const theme = useTheme(); const theme = useTheme();
const navigate = useNavigate(); const navigate = useNavigate();
const monitorState = useSelector((state) => state.uptimeMonitors); const uptimeMonitorsState = useSelector((state) => state.uptimeMonitors);
const authState = useSelector((state) => state.auth); const authState = useSelector((state) => state.auth);
const dispatch = useDispatch({}); const dispatch = useDispatch({});
const [monitorUpdateTrigger, setMonitorUpdateTrigger] = useState(false);
const handlePause = () => {
setMonitorUpdateTrigger((prev) => !prev);
};
useEffect(() => { useEffect(() => {
dispatch(getUptimeMonitorsByTeamId(authState.authToken)); dispatch(getUptimeMonitorsByTeamId(authState.authToken));
}, [authState.authToken, dispatch]); }, [authState.authToken, dispatch, monitorUpdateTrigger]);
//TODO bring fetching to this component, like on pageSpeed //TODO bring fetching to this component, like on pageSpeed
const loading = monitorState?.isLoading; const loading = uptimeMonitorsState?.isLoading;
const totalMonitors = monitorState?.monitorsSummary?.monitorCounts?.total; const totalMonitors = uptimeMonitorsState?.monitorsSummary?.monitorCounts?.total;
const hasMonitors = totalMonitors > 0; const hasMonitors = totalMonitors > 0;
const noMonitors = !hasMonitors; const noMonitors = !hasMonitors;
@@ -40,28 +47,28 @@ const Monitors = ({ isAdmin }) => {
gap={theme.spacing(8)} gap={theme.spacing(8)}
> >
<Box> <Box>
<Breadcrumbs list={[{ name: `monitors`, path: "/monitors" }]} /> <Breadcrumbs list={BREADCRUMBS} />
<Stack <Stack
direction="row" direction="row"
justifyContent="space-between" justifyContent="end"
alignItems="center" alignItems="center"
mt={theme.spacing(5)} mt={theme.spacing(5)}
gap={theme.spacing(6)} gap={theme.spacing(6)}
> >
<Greeting type="uptime" />
{canAddMonitor && ( {canAddMonitor && (
<Button <Button
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() => { onClick={() => {
navigate("/monitors/create"); navigate("/uptime/create");
}} }}
sx={{ fontWeight: 500 }} sx={{ fontWeight: 500, whiteSpace: "nowrap" }}
> >
Create monitor Create new
</Button> </Button>
)} )}
</Stack> </Stack>
<Greeting type="uptime" />
</Box> </Box>
{noMonitors && <Fallback isAdmin={isAdmin} />} {noMonitors && <Fallback isAdmin={isAdmin} />}
{loading ? ( {loading ? (
@@ -77,21 +84,22 @@ const Monitors = ({ isAdmin }) => {
> >
<StatusBox <StatusBox
title="up" title="up"
value={monitorState?.monitorsSummary?.monitorCounts?.up ?? 0} value={uptimeMonitorsState?.monitorsSummary?.monitorCounts?.up ?? 0}
/> />
<StatusBox <StatusBox
title="down" title="down"
value={monitorState?.monitorsSummary?.monitorCounts?.down ?? 0} value={uptimeMonitorsState?.monitorsSummary?.monitorCounts?.down ?? 0}
/> />
<StatusBox <StatusBox
title="paused" title="paused"
value={monitorState?.monitorsSummary?.monitorCounts?.paused ?? 0} value={uptimeMonitorsState?.monitorsSummary?.monitorCounts?.paused ?? 0}
/> />
</Stack> </Stack>
<CurrentMonitoring <CurrentMonitoring
isAdmin={isAdmin} isAdmin={isAdmin}
monitors={monitorState.monitorsSummary.monitors} monitors={uptimeMonitorsState.monitorsSummary.monitors}
totalMonitors={totalMonitors} totalMonitors={totalMonitors}
handlePause={handlePause}
/> />
</> </>
)} )}
@@ -101,7 +109,7 @@ const Monitors = ({ isAdmin }) => {
); );
}; };
Monitors.propTypes = { UptimeMonitors.propTypes = {
isAdmin: PropTypes.bool, isAdmin: PropTypes.bool,
}; };
export default Monitors; export default UptimeMonitors;
File renamed without changes.
File renamed without changes.
+36 -8
View File
@@ -91,10 +91,24 @@ const credentials = joi.object({
}); });
const monitorValidation = joi.object({ const monitorValidation = joi.object({
url: joi.string().uri({ allowRelative: true }).trim().messages({ url: joi
"string.empty": "This field is required.", .string()
"string.uri": "The URL you provided is not valid.", .trim()
}), .custom((value, helpers) => {
const urlRegex =
/^(https?:\/\/)?(([0-9]{1,3}\.){3}[0-9]{1,3}|[\da-z\.-]+)(\.[a-z\.]{2,6})?(:(\d+))?([\/\w \.-]*)*\/?$/i;
if (!urlRegex.test(value)) {
return helpers.error("string.invalidUrl");
}
return value;
})
.messages({
"string.empty": "This field is required.",
"string.uri": "The URL you provided is not valid.",
"string.invalidUrl": "Please enter a valid URL with optional port",
}),
name: joi.string().trim().max(50).allow("").messages({ name: joi.string().trim().max(50).allow("").messages({
"string.max": "This field should not exceed the 50 characters limit.", "string.max": "This field should not exceed the 50 characters limit.",
}), }),
@@ -176,10 +190,24 @@ const advancedSettingsValidation = joi.object({
}); });
const infrastructureMonitorValidation = joi.object({ const infrastructureMonitorValidation = joi.object({
url: joi.string().uri({ allowRelative: true }).trim().messages({ url: joi
"string.empty": "This field is required.", .string()
"string.uri": "The URL you provided is not valid.", .trim()
}), .custom((value, helpers) => {
const urlRegex =
/^(https?:\/\/)?(([0-9]{1,3}\.){3}[0-9]{1,3}|[\da-z\.-]+)(\.[a-z\.]{2,6})?(:(\d+))?([\/\w \.-]*)*\/?$/i;
if (!urlRegex.test(value)) {
return helpers.error("string.invalidUrl");
}
return value;
})
.messages({
"string.empty": "This field is required.",
"string.uri": "The URL you provided is not valid.",
"string.invalidUrl": "Please enter a valid URL with optional port",
}),
name: joi.string().trim().max(50).allow("").messages({ name: joi.string().trim().max(50).allow("").messages({
"string.max": "This field should not exceed the 50 characters limit.", "string.max": "This field should not exceed the 50 characters limit.",
}), }),
+1 -1
View File
@@ -2,7 +2,7 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name uptime-demo.bluewavelabs.ca; server_name checkmate-demo.bluewavelabs.ca;
server_tokens off; server_tokens off;
location /.well-known/acme-challenge/ { location /.well-known/acme-challenge/ {
+1 -1
View File
@@ -2,7 +2,7 @@ services:
client: client:
image: uptime_client:latest image: uptime_client:latest
environment: environment:
UPTIME_APP_API_BASE_URL: "https://uptime-demo.bluewavelabs.ca/api/v1" UPTIME_APP_API_BASE_URL: "https://checkmate-demo.bluewavelabs.ca/api/v1"
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
+1 -1
View File
@@ -2,7 +2,7 @@ services:
client: client:
image: uptime_client:latest image: uptime_client:latest
environment: environment:
UPTIME_APP_API_BASE_URL: "https://uptime-demo.bluewavelabs.ca/api/v1" UPTIME_APP_API_BASE_URL: "https://checkmate-demo.bluewavelabs.ca/api/v1"
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
+4 -4
View File
@@ -2,7 +2,7 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name uptime-demo.bluewavelabs.ca; server_name checkmate-demo.bluewavelabs.ca;
server_tokens off; server_tokens off;
location /.well-known/acme-challenge/ { location /.well-known/acme-challenge/ {
@@ -38,10 +38,10 @@ server {
listen 443 default_server ssl http2; listen 443 default_server ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
server_name uptime-demo.bluewavelabs.ca; server_name checkmate-demo.bluewavelabs.ca;
ssl_certificate /etc/nginx/ssl/live/uptime-demo.bluewavelabs.ca/fullchain.pem; ssl_certificate /etc/nginx/ssl/live/checkmate-demo.bluewavelabs.ca/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/uptime-demo.bluewavelabs.ca/privkey.pem; ssl_certificate_key /etc/nginx/ssl/live/checkmate-demo.bluewavelabs.ca/privkey.pem;
location / { location / {
root /usr/share/nginx/html; root /usr/share/nginx/html;
+1 -1
View File
@@ -72,7 +72,7 @@ We've just launched our [Discussions](https://github.com/bluewave-labs/bluewave-
## 🤝 Contributing ## 🤝 Contributing
We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 600+ stars and attracted 30+ contributors from around the globe. So, don’t hold back — jump in, contribute and learn with us! We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 1300+ stars and attracted 30+ contributors from around the globe. So, don’t hold back — jump in, contribute and learn with us!
Here's how you can contribute: Here's how you can contribute:
+1
View File
@@ -332,6 +332,7 @@ const deleteMonitor = async (req, res, next) => {
await req.db.deleteChecks(monitor._id); await req.db.deleteChecks(monitor._id);
await req.db.deletePageSpeedChecksByMonitorId(monitor._id); await req.db.deletePageSpeedChecksByMonitorId(monitor._id);
await req.db.deleteNotificationsByMonitorId(monitor._id); await req.db.deleteNotificationsByMonitorId(monitor._id);
await req.db.deleteHardwareChecksByMonitorId(monitor._id);
} catch (error) { } catch (error) {
logger.error({ logger.error({
message: `Error deleting associated records for monitor ${monitor._id} with name ${monitor.name}`, message: `Error deleting associated records for monitor ${monitor._id} with name ${monitor.name}`,
+5 -1
View File
@@ -124,7 +124,10 @@ import {
//**************************************** //****************************************
// Hardware Checks // Hardware Checks
//**************************************** //****************************************
import { createHardwareCheck } from "./modules/hardwareCheckModule.js"; import {
createHardwareCheck,
deleteHardwareChecksByMonitorId,
} from "./modules/hardwareCheckModule.js";
//**************************************** //****************************************
// Checks // Checks
@@ -213,6 +216,7 @@ export default {
createPageSpeedCheck, createPageSpeedCheck,
deletePageSpeedChecksByMonitorId, deletePageSpeedChecksByMonitorId,
createHardwareCheck, createHardwareCheck,
deleteHardwareChecksByMonitorId,
createMaintenanceWindow, createMaintenanceWindow,
getMaintenanceWindowsByTeamId, getMaintenanceWindowsByTeamId,
getMaintenanceWindowById, getMaintenanceWindowById,
+13 -1
View File
@@ -37,4 +37,16 @@ const createHardwareCheck = async (hardwareCheckData) => {
} }
}; };
export { createHardwareCheck }; const deleteHardwareChecksByMonitorId = async (monitorId) => {
try {
const result = await HardwareCheck.deleteMany({ monitorId });
console.log("deleted hardware checks", result);
return result.deletedCount;
} catch (error) {
error.service = SERVICE_NAME;
error.method = "deleteHardwareChecksByMonitorId";
throw error;
}
};
export { createHardwareCheck, deleteHardwareChecksByMonitorId };
+1 -1
View File
@@ -44,7 +44,7 @@
} }
}, },
{ {
"url": "https://uptime-demo.bluewavelabs.ca/{API_PATH}", "url": "https://checkmate-demo.bluewavelabs.ca/{API_PATH}",
"description": "Bluewave Demo Server", "description": "Bluewave Demo Server",
"variables": { "variables": {
"PORT": { "PORT": {
+88 -85
View File
@@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"axios": "^1.7.2", "axios": "^1.7.2",
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"bullmq": "5.33.0", "bullmq": "5.34.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"dockerode": "4.0.2", "dockerode": "4.0.2",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
@@ -32,7 +32,7 @@
"winston": "^3.13.0" "winston": "^3.13.0"
}, },
"devDependencies": { "devDependencies": {
"c8": "10.1.2", "c8": "10.1.3",
"chai": "5.1.2", "chai": "5.1.2",
"esm": "3.2.25", "esm": "3.2.25",
"mocha": "11.0.1", "mocha": "11.0.1",
@@ -97,11 +97,14 @@
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/@bcoe/v8-coverage": { "node_modules/@bcoe/v8-coverage": {
"version": "0.2.3", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.1.tgz",
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "integrity": "sha512-W+a0/JpU28AqH4IKtwUPcEUnUyXMDLALcn5/JLczGGT9fHE2sIby/xP/oQnx3nxkForzgzPy201RAKcB4xPAFQ==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT",
"engines": {
"node": ">=18"
}
}, },
"node_modules/@colors/colors": { "node_modules/@colors/colors": {
"version": "1.6.0", "version": "1.6.0",
@@ -1218,9 +1221,9 @@
} }
}, },
"node_modules/bullmq": { "node_modules/bullmq": {
"version": "5.33.0", "version": "5.34.0",
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.33.0.tgz", "resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.34.0.tgz",
"integrity": "sha512-dICdidv1x+umYyA0DqlnCPa1sgHjtHo6gzyww5E10OQq+k9saT2B/rIP8pQbo8HhN/fRViYjJP/+7s8594/xdw==", "integrity": "sha512-TyzeYDkIGkooYUn/P1CeiJW3Am1TboC3unwhlg1cJIwKksoyuRp97TkHyCZcwLchXbYCUtsGBZFUYf/lTAhdSg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"cron-parser": "^4.6.0", "cron-parser": "^4.6.0",
@@ -1253,13 +1256,13 @@
} }
}, },
"node_modules/c8": { "node_modules/c8": {
"version": "10.1.2", "version": "10.1.3",
"resolved": "https://registry.npmjs.org/c8/-/c8-10.1.2.tgz", "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.3.tgz",
"integrity": "sha512-Qr6rj76eSshu5CgRYvktW0uM0CFY0yi4Fd5D0duDXO6sYinyopmftUiJVuzBQxQcwQLor7JWDVRP+dUfCmzgJw==", "integrity": "sha512-LvcyrOAaOnrrlMpW22n690PUvxiq4Uf9WMhQwNJ9vgagkL/ph1+D4uvjvDA5XCbykrc0sx+ay6pVi9YZ1GnhyA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@bcoe/v8-coverage": "^0.2.3", "@bcoe/v8-coverage": "^1.0.1",
"@istanbuljs/schema": "^0.1.3", "@istanbuljs/schema": "^0.1.3",
"find-up": "^5.0.0", "find-up": "^5.0.0",
"foreground-child": "^3.1.1", "foreground-child": "^3.1.1",
@@ -1286,78 +1289,6 @@
} }
} }
}, },
"node_modules/c8/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/c8/node_modules/glob": {
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true,
"license": "ISC",
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^3.1.2",
"minimatch": "^9.0.4",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^1.11.1"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/c8/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/c8/node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/c8/node_modules/test-exclude": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz",
"integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==",
"dev": true,
"license": "ISC",
"dependencies": {
"@istanbuljs/schema": "^0.1.2",
"glob": "^10.4.1",
"minimatch": "^9.0.4"
},
"engines": {
"node": ">=18"
}
},
"node_modules/call-bind": { "node_modules/call-bind": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
@@ -6507,6 +6438,78 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/test-exclude": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz",
"integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==",
"dev": true,
"license": "ISC",
"dependencies": {
"@istanbuljs/schema": "^0.1.2",
"glob": "^10.4.1",
"minimatch": "^9.0.4"
},
"engines": {
"node": ">=18"
}
},
"node_modules/test-exclude/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/test-exclude/node_modules/glob": {
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true,
"license": "ISC",
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^3.1.2",
"minimatch": "^9.0.4",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^1.11.1"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/test-exclude/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/test-exclude/node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/text-hex": { "node_modules/text-hex": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz",
+2 -2
View File
@@ -14,7 +14,7 @@
"dependencies": { "dependencies": {
"axios": "^1.7.2", "axios": "^1.7.2",
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"bullmq": "5.33.0", "bullmq": "5.34.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"dockerode": "4.0.2", "dockerode": "4.0.2",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
@@ -35,7 +35,7 @@
"winston": "^3.13.0" "winston": "^3.13.0"
}, },
"devDependencies": { "devDependencies": {
"c8": "10.1.2", "c8": "10.1.3",
"chai": "5.1.2", "chai": "5.1.2",
"esm": "3.2.25", "esm": "3.2.25",
"mocha": "11.0.1", "mocha": "11.0.1",
+1 -1
View File
@@ -26,7 +26,7 @@ It regularly checks whether a server/website is accessible and performs optimall
## Demo ## Demo
We have a [demo](https://uptime-demo.bluewavelabs.ca/) where you can test how the Uptime Manager works. The username is [uptimedemo@demo.com](mailto:uptimedemo@demo.com) and the password is Demouser1! We have a [demo](https://checkmate-demo.bluewavelabs.ca/) where you can test how the Uptime Manager works. The username is [uptimedemo@demo.com](mailto:uptimedemo@demo.com) and the password is Demouser1!
## Questions & ideas ## Questions & ideas
@@ -20,7 +20,7 @@ When making changes to the Front end please always keep future developers in min
### Back end ### Back end
The back end of this project is not especially complex and is built around Express. The back end is a RESTful API and the [documentation can be found here](https://uptime-demo.bluewavelabs.ca/api-docs). The back end of this project is not especially complex and is built around Express. The back end is a RESTful API and the [documentation can be found here](https://checkmate-demo.bluewavelabs.ca/api-docs).
The application consists of several main conceptual models: The application consists of several main conceptual models:
+1 -1
View File
@@ -201,7 +201,7 @@ Our API is documented in accordance with the [OpenAPI spec](https://www.openapis
You can see the documentation on your local development server at http://localhost:{port}/api-docs You can see the documentation on your local development server at http://localhost:{port}/api-docs
You can also view the documentation on our demo server at [https://uptime-demo.bluewavelabs.ca/api-docs](https://uptime-demo.bluewavelabs.ca/api-docs) You can also view the documentation on our demo server at [https://checkmate-demo.bluewavelabs.ca/api-docs](https://checkmate-demo.bluewavelabs.ca/api-docs)
### Error handling ### Error handling