From 628f3a3d12727da77c4ccd316719ba64ccd32a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sun, 11 Aug 2024 16:15:30 +0300 Subject: [PATCH 01/23] chore: create openapi.json with openapi 3.1.0 format > Objects >> info >> servers --- Server/openapi.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Server/openapi.json diff --git a/Server/openapi.json b/Server/openapi.json new file mode 100644 index 000000000..635dfe0ad --- /dev/null +++ b/Server/openapi.json @@ -0,0 +1,35 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "BluWave Uptime", + "summary": "BlueWave Uptime OpenAPI Specifications", + "description": "BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.", + "contact": { + "name": "API Support", + "url": "mailto:hello@bluewavelabs.ca", + "email": "hello@bluewavelabs.ca" + }, + "license": { + "name": "AGPLv3", + "url": "https://github.com/bluewave-labs/bluewave-uptime/tree/HEAD/LICENSE" + }, + "version": "1.0" + }, + "servers": [ + { + "url": "https://bluewavelabs.ca", + "description": "Remote Development Server" + }, + { + "url": "http://localhost:{PORT}", + "description": "Local Development Server", + "variables": { + "PORT": { + "description": "The Data Set API is accessible via https and http", + "enum": ["5000", "3000", "8080"], + "default": "5000" + } + } + } + ] +} From 0d2366cb3fa05c9577a6e058bf134229955bc122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sun, 11 Aug 2024 18:52:19 +0300 Subject: [PATCH 02/23] chore: update contact email in openapi.json --- Server/openapi.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index 635dfe0ad..8e219b5ae 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -6,8 +6,8 @@ "description": "BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.", "contact": { "name": "API Support", - "url": "mailto:hello@bluewavelabs.ca", - "email": "hello@bluewavelabs.ca" + "url": "mailto:support@bluewavelabs.ca", + "email": "support@bluewavelabs.ca" }, "license": { "name": "AGPLv3", From adbbdd405c01854e0c47b5a63a91eda93f5b4d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sun, 11 Aug 2024 19:03:02 +0300 Subject: [PATCH 03/23] chore(openapi): dynamic API path variables on servers --- Server/openapi.json | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index 8e219b5ae..8d3fff916 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -17,17 +17,29 @@ }, "servers": [ { - "url": "https://bluewavelabs.ca", - "description": "Remote Development Server" + "url": "https://bluewavelabs.ca/{API_PATH}", + "description": "Remote Development Server", + "variables": { + "API_PATH": { + "description": "API Base Path", + "enum": ["api/v1", "api/v1.1", "api/v2"], + "default": "api/v1" + } + } }, { - "url": "http://localhost:{PORT}", + "url": "http://localhost:{PORT}/{API_PATH}", "description": "Local Development Server", "variables": { "PORT": { - "description": "The Data Set API is accessible via https and http", + "description": "API Port", "enum": ["5000", "3000", "8080"], "default": "5000" + }, + "API_PATH": { + "description": "API Base Path", + "enum": ["api/v1", "api/v1.1", "api/v2"], + "default": "api/v1" } } } From 1541fd20fc4934769692bf7b3e8311938f61da29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Mon, 12 Aug 2024 21:39:10 +0300 Subject: [PATCH 04/23] chore(openapi): define the endpoint, method and description on auth routes > Common Responses - 200 - 422 - 500 --- Server/openapi.json | 320 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 319 insertions(+), 1 deletion(-) diff --git a/Server/openapi.json b/Server/openapi.json index 8d3fff916..e66c38294 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -43,5 +43,323 @@ } } } - ] + ], + "tags": [ + { + "name": "auth", + "description": "Authentication" + } + ], + "paths": { + "/auth/register": { + "post": { + "tags": ["auth"], + "description": "Register a new user", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/login": { + "post": { + "tags": ["auth"], + "description": "Login with credentials", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/logout": { + "post": { + "tags": ["auth"], + "description": "Logout", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/user/:userId": { + "put": { + "tags": ["auth"], + "description": "Change user informations", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + }, + "delete": { + "tags": ["auth"], + "description": "Delete user", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/users/admin": { + "get": { + "tags": ["auth"], + "description": "Checks to see if an admin account exists", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/users": { + "get": { + "tags": ["auth"], + "description": "Get all users", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/invite": { + "post": { + "tags": ["auth"], + "description": "Invite people to application", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/invite/verify": { + "post": { + "tags": ["auth"], + "description": "Verify the invite", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/recovery/request": { + "post": { + "tags": ["auth"], + "description": "Request a recovery token", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/recovery/validate": { + "post": { + "tags": ["auth"], + "description": "Validate recovery token", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + }, + "/auth/recovery/reset": { + "post": { + "tags": ["auth"], + "description": "Password reset", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": {} + } + }, + "422": { + "description": "Unprocessable Content", + "content": { + "application/json": {} + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": {} + } + } + } + } + } + } } From 16eb578a5563f2ab289e167fb8178cce2cfea9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Mon, 12 Aug 2024 21:40:15 +0300 Subject: [PATCH 05/23] fix(openapi): update typo in title from 'BluWave uptime' to 'BlueWave Uptime' --- Server/openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/openapi.json b/Server/openapi.json index e66c38294..36f18a73f 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -1,7 +1,7 @@ { "openapi": "3.1.0", "info": { - "title": "BluWave Uptime", + "title": "BlueWave Uptime", "summary": "BlueWave Uptime OpenAPI Specifications", "description": "BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.", "contact": { From e28530cdc7bd2de9cf6689358d00e312626034f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Tue, 13 Aug 2024 00:14:29 +0300 Subject: [PATCH 06/23] chore(openapi): add ErrorResponse and SuccessResponse schema components to auth routes --- Server/openapi.json | 245 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 209 insertions(+), 36 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index 36f18a73f..b0b7deba6 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -59,19 +59,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -85,19 +97,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -111,19 +135,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -137,19 +173,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -161,19 +209,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -187,19 +247,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -213,19 +285,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -239,19 +323,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -265,19 +361,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -291,19 +399,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -317,19 +437,31 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } @@ -343,23 +475,64 @@ "200": { "description": "OK", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessResponse" + } + } } }, "422": { "description": "Unprocessable Content", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, "500": { "description": "Internal Server Error", "content": { - "application/json": {} + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } } } } + }, + "components": { + "schemas": { + "ErrorResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + } + } + }, + "SuccessResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "data": { + "type": "object" + } + } + } + } } } From 137500bbd0d523e14243e8cd97d5ee120d05b98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sun, 18 Aug 2024 20:01:34 +0300 Subject: [PATCH 07/23] chore(openapi): add UserSuccessResponse ref to auth responses --- Server/openapi.json | 241 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 229 insertions(+), 12 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index b0b7deba6..cf4338be6 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -61,7 +61,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -99,7 +99,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -137,7 +137,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -175,7 +175,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -211,7 +211,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -249,7 +249,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -287,7 +287,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -325,7 +325,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -363,7 +363,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -401,7 +401,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -439,7 +439,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -477,7 +477,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/UserSuccessResponse" } } } @@ -532,6 +532,223 @@ "type": "object" } } + }, + "UserSuccessResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "data": { + "type": "object", + "$ref": "#/components/schemas/UserDataType" + } + } + }, + "MonitorSuccessResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "data": { + "type": "object", + "$ref": "#/components/schemas/MonitorDataType" + } + } + }, + "CheckDataSuccessResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "data": { + "type": "object", + "$ref": "#/components/schemas/CheckDataType" + } + } + }, + "AlertDataSuccessResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "data": { + "type": "object", + "$ref": "#/components/schemas/AlertDataType" + } + } + }, + "UserDataType": { + "type": "object", + "required": [ + "firstname", + "lastname", + "email", + "profilePicUrl", + "isActive", + "isVerified", + "updated_at", + "created_at" + ], + "properties": { + "firstname": { + "type": "string" + }, + "lastname": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "profilePicUrl": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "isVerified": { + "type": "boolean" + }, + "updated_at": { + "type": "string" + }, + "created_at": { + "type": "string" + } + } + }, + "MonitorDataType": { + "type": "object", + "required": [ + "userId", + "name", + "description", + "url", + "isActive", + "interval", + "updatedAt", + "createdAt" + ], + "properties": { + "userId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "interval": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + } + }, + "CheckDataType": { + "type": "object", + "required": [ + "monitorId", + "status", + "responseTime", + "statusCode", + "message", + "updatedAt", + "createdAt" + ], + "properties": { + "monitorId": { + "type": "string" + }, + "status": { + "type": "string" + }, + "responseTime": { + "type": "integer" + }, + "statusCode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + } + }, + "AlertDataType": { + "type": "object", + "required": [ + "checkId", + "monitorId", + "userId", + "status", + "message", + "notifiedStatus", + "acknowledgedStatus", + "updatedAt", + "createdAt" + ], + "properties": { + "checkId": { + "type": "string" + }, + "monitorId": { + "type": "string" + }, + "userId": { + "type": "string" + }, + "status": { + "type": "string" + }, + "message": { + "type": "string" + }, + "notifiedStatus": { + "type": "boolean" + }, + "acknowledgedStatus": { + "type": "boolean" + }, + "updatedAt": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + } } } } From cc08d7f8d59602fc33c84ebeb7ba6cf868f99826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sun, 18 Aug 2024 20:20:28 +0300 Subject: [PATCH 08/23] fix(openapi): update property names to camelCase in UserDataType schema --- Server/openapi.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index cf4338be6..536992638 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -602,8 +602,8 @@ "profilePicUrl", "isActive", "isVerified", - "updated_at", - "created_at" + "updatedAt", + "createdAt" ], "properties": { "firstname": { @@ -625,10 +625,10 @@ "isVerified": { "type": "boolean" }, - "updated_at": { + "updatedAt": { "type": "string" }, - "created_at": { + "createdAt": { "type": "string" } } From 21ce46a29e4bdd2e0ac19e16b8691c2829e806bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Fri, 30 Aug 2024 21:09:16 +0300 Subject: [PATCH 09/23] feat(openapi): add request body to login and register routes --- Server/openapi.json | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Server/openapi.json b/Server/openapi.json index 536992638..066bded08 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -55,6 +55,45 @@ "post": { "tags": ["auth"], "description": "Register a new user", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": ["firstName", "lastName", "email", "password", "role", "teamId"], + "properties": { + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "password": { + "type": "string", + "format": "password" + }, + "profileImage": { + "type": "file", + "format": "file" + }, + "role": { + "type": "array", + "enum": [["user"], ["admin"], ["superadmin"]], + "default": ["superadmin"] + }, + "teamId": { + "type": "string", + "format": "uuid" + } + } + } + } + } + }, "responses": { "200": { "description": "OK", @@ -93,6 +132,26 @@ "post": { "tags": ["auth"], "description": "Login with credentials", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": ["email", "password"], + "properties": { + "email": { + "type": "string", + "format": "email" + }, + "password": { + "type": "string", + "format": "password" + } + } + } + } + } + }, "responses": { "200": { "description": "OK", From bdb293c18159b152d35cbcdfd6ac8a167210d0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Fri, 30 Aug 2024 21:10:13 +0300 Subject: [PATCH 10/23] fix(openapi): remove logout route from auth --- Server/openapi.json | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index 066bded08..72397d139 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -186,44 +186,6 @@ } } }, - "/auth/logout": { - "post": { - "tags": ["auth"], - "description": "Logout", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserSuccessResponse" - } - } - } - }, - "422": { - "description": "Unprocessable Content", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, "/auth/user/:userId": { "put": { "tags": ["auth"], From 649cf6835654fbdb3bc3f84b535e8679b81a064f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Fri, 30 Aug 2024 21:12:08 +0300 Subject: [PATCH 11/23] chore(openapi): remove remote development server --- Server/openapi.json | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Server/openapi.json b/Server/openapi.json index 72397d139..5db6250c5 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -16,17 +16,6 @@ "version": "1.0" }, "servers": [ - { - "url": "https://bluewavelabs.ca/{API_PATH}", - "description": "Remote Development Server", - "variables": { - "API_PATH": { - "description": "API Base Path", - "enum": ["api/v1", "api/v1.1", "api/v2"], - "default": "api/v1" - } - } - }, { "url": "http://localhost:{PORT}/{API_PATH}", "description": "Local Development Server", From f680ed8af1b23b3ab0a0d8bbfc1dffbed0b71d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sat, 31 Aug 2024 13:44:23 +0300 Subject: [PATCH 12/23] chore(openapi): add missing route groups to tags - invite - monitors - checks - alerts - pagespeed - maintenance-window - healthy - mail --- Server/openapi.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Server/openapi.json b/Server/openapi.json index 5db6250c5..d9a55dbe6 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -37,6 +37,38 @@ { "name": "auth", "description": "Authentication" + }, + { + "name": "invite", + "description": "Invite" + }, + { + "name": "monitors", + "description": "Monitors" + }, + { + "name": "checks", + "description": "Checks" + }, + { + "name": "alerts", + "description": "Alerts" + }, + { + "name": "pagespeed", + "description": "Page Speed" + }, + { + "name": "maintenance-window", + "description": "Maintenance window" + }, + { + "name": "healthy", + "description": "Health check" + }, + { + "name": "mail", + "description": "Mail service" } ], "paths": { From b6190728a02d32c8ae23631db9d1bfd8a26742a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20=C5=9Ei=C5=9Fmano=C4=9Flu?= Date: Sat, 31 Aug 2024 13:51:36 +0300 Subject: [PATCH 13/23] feat(openapi): add /healthy route for health check --- Server/openapi.json | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Server/openapi.json b/Server/openapi.json index d9a55dbe6..23c16521d 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -546,6 +546,44 @@ } } } + }, + "/healthy": { + "get": { + "tags": ["healthy"], + "description": "Health check", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + } + } } }, "components": { From d75b494d58b1f8aa67d45312a2edacd22d32c6c3 Mon Sep 17 00:00:00 2001 From: M M Date: Sun, 1 Sep 2024 12:25:23 -0700 Subject: [PATCH 14/23] Change color of percentage according to uptime of monitor. --- Client/src/Components/Alert/index.jsx | 4 ++-- .../src/Pages/Monitors/Home/monitorData.jsx | 23 +++++++++++++------ Client/src/Utils/Theme/darkTheme.js | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Client/src/Components/Alert/index.jsx b/Client/src/Components/Alert/index.jsx index eb5fbd13b..cafd58451 100644 --- a/Client/src/Components/Alert/index.jsx +++ b/Client/src/Components/Alert/index.jsx @@ -31,7 +31,7 @@ const icons = { const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => { const theme = useTheme(); - const { text, light, border } = theme.palette[variant]; + const { text, bg, border } = theme.palette[variant]; const icon = icons[variant]; return ( @@ -45,7 +45,7 @@ const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => { padding: hasIcon ? theme.spacing(8) : `${theme.spacing(4)} ${theme.spacing(8)}`, - backgroundColor: light, + backgroundColor: bg, border: `solid 1px ${border}`, borderRadius: theme.shape.borderRadius, }} diff --git a/Client/src/Pages/Monitors/Home/monitorData.jsx b/Client/src/Pages/Monitors/Home/monitorData.jsx index d3fd66958..9fd97408c 100644 --- a/Client/src/Pages/Monitors/Home/monitorData.jsx +++ b/Client/src/Pages/Monitors/Home/monitorData.jsx @@ -32,21 +32,30 @@ export const buildData = (monitors, isAdmin, navigate) => { data.rows = monitors.map((monitor, idx) => { let uptimePercentage = ""; + let percentageColor = theme.palette.success.main; + if (monitor.uptimePercentage !== undefined) { uptimePercentage = monitor.uptimePercentage === 0 - ? "0" - : (monitor.uptimePercentage * 100).toFixed(2); - } + ? "0" + : (monitor.uptimePercentage * 100).toFixed(2); + + if (monitor.uptimePercentage < 0.25) { + percentageColor = theme.palette.error.text; + } else if (monitor.uptimePercentage >= 0.25 && monitor.uptimePercentage < 0.5) { + percentageColor = theme.palette.warning.main; + } else if (monitor.uptimePercentage >= 0.5 && monitor.uptimePercentage < 0.75) { + percentageColor = theme.palette.warning.light; + } else if (monitor.uptimePercentage >= 0.75 && monitor.uptimePercentage <= 1) { + percentageColor = theme.palette.success.main; + } + } const params = { url: monitor.url, title: monitor.name, percentage: uptimePercentage, - percentageColor: - monitor.status === true - ? theme.palette.success.main - : theme.palette.error.text, + percentageColor, status: monitor.status === true ? "up" : "down", }; diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index 15df7c1b8..a39fb4c1c 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -53,7 +53,7 @@ const darkTheme = createTheme({ warning: { text: "#e88c30", main: "#FF9F00", - light: "#27272a", + light: "#ffd600", bg: "#1E1E1E", border: "#e88c30", }, From 3da323e44e24180095198b3285cbc9ad2851af6e Mon Sep 17 00:00:00 2001 From: M M Date: Sun, 1 Sep 2024 13:40:52 -0700 Subject: [PATCH 15/23] Adjust colors for the light theme. --- Client/src/Utils/Theme/lightTheme.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index bb83d09b2..51639fb0e 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -36,7 +36,7 @@ const lightTheme = createTheme({ }, success: { text: "#079455", - main: "#17b26a", + main: "#45bb7a", light: "#d4f4e1", bg: "#ecfdf3", }, @@ -49,8 +49,8 @@ const lightTheme = createTheme({ }, warning: { text: "#DC6803", - main: "#fdb022", - light: "#fffcf5", + main: "#ff7a00", + light: "#ffb400", bg: "#ffecbc", border: "#fec84b", }, From c515358d78c161c9f7eaa132643658fb947441f2 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 2 Sep 2024 10:16:22 -0700 Subject: [PATCH 16/23] fix host proptypes --- Client/src/Pages/Monitors/Home/host.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Client/src/Pages/Monitors/Home/host.jsx b/Client/src/Pages/Monitors/Home/host.jsx index d450a53f4..9e6a71a05 100644 --- a/Client/src/Pages/Monitors/Home/host.jsx +++ b/Client/src/Pages/Monitors/Home/host.jsx @@ -53,7 +53,8 @@ Host.propTypes = { params: PropTypes.shape({ title: PropTypes.string, percentageColor: PropTypes.string, - percentage: PropTypes.number, + percentage: PropTypes.string, + url: PropTypes.string, }).isRequired, }; From 3a27ce0a8aafbf8932e85c89ccc17f5097c8099a Mon Sep 17 00:00:00 2001 From: M M Date: Mon, 2 Sep 2024 14:00:26 -0700 Subject: [PATCH 17/23] Revert to old colors on the light and dark theme. --- Client/src/Utils/Theme/darkTheme.js | 2 +- Client/src/Utils/Theme/lightTheme.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index a39fb4c1c..15df7c1b8 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -53,7 +53,7 @@ const darkTheme = createTheme({ warning: { text: "#e88c30", main: "#FF9F00", - light: "#ffd600", + light: "#27272a", bg: "#1E1E1E", border: "#e88c30", }, diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index 51639fb0e..bb83d09b2 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -36,7 +36,7 @@ const lightTheme = createTheme({ }, success: { text: "#079455", - main: "#45bb7a", + main: "#17b26a", light: "#d4f4e1", bg: "#ecfdf3", }, @@ -49,8 +49,8 @@ const lightTheme = createTheme({ }, warning: { text: "#DC6803", - main: "#ff7a00", - light: "#ffb400", + main: "#fdb022", + light: "#fffcf5", bg: "#ffecbc", border: "#fec84b", }, From 081ad080a8bb3d9cc4ea91b63b147a8d8e0346a4 Mon Sep 17 00:00:00 2001 From: M M Date: Mon, 2 Sep 2024 15:03:40 -0700 Subject: [PATCH 18/23] Add new objects to the color palettes. --- Client/src/Pages/Monitors/Home/monitorData.jsx | 10 +++++----- Client/src/Utils/Theme/darkTheme.js | 6 ++++++ Client/src/Utils/Theme/lightTheme.js | 6 ++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/monitorData.jsx b/Client/src/Pages/Monitors/Home/monitorData.jsx index 9fd97408c..ee167edb4 100644 --- a/Client/src/Pages/Monitors/Home/monitorData.jsx +++ b/Client/src/Pages/Monitors/Home/monitorData.jsx @@ -32,7 +32,7 @@ export const buildData = (monitors, isAdmin, navigate) => { data.rows = monitors.map((monitor, idx) => { let uptimePercentage = ""; - let percentageColor = theme.palette.success.main; + let percentageColor = theme.palette.percentage.green; if (monitor.uptimePercentage !== undefined) { uptimePercentage = @@ -41,13 +41,13 @@ export const buildData = (monitors, isAdmin, navigate) => { : (monitor.uptimePercentage * 100).toFixed(2); if (monitor.uptimePercentage < 0.25) { - percentageColor = theme.palette.error.text; + percentageColor = theme.palette.percentage.red; } else if (monitor.uptimePercentage >= 0.25 && monitor.uptimePercentage < 0.5) { - percentageColor = theme.palette.warning.main; + percentageColor = theme.palette.percentage.orange; } else if (monitor.uptimePercentage >= 0.5 && monitor.uptimePercentage < 0.75) { - percentageColor = theme.palette.warning.light; + percentageColor = theme.palette.percentage.yellow; } else if (monitor.uptimePercentage >= 0.75 && monitor.uptimePercentage <= 1) { - percentageColor = theme.palette.success.main; + percentageColor = theme.palette.percentage.green; } } diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index 15df7c1b8..3b77966cd 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -57,6 +57,12 @@ const darkTheme = createTheme({ bg: "#1E1E1E", border: "#e88c30", }, + percentage: { + red: "#d32f2f", + orange: "#e88c30", + yellow: "#ffd600", + green: "#079455", + }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, divider: border.light, other: { diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index bb83d09b2..67c2d72e5 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -54,6 +54,12 @@ const lightTheme = createTheme({ bg: "#ffecbc", border: "#fec84b", }, + percentage: { + red: "#d32f2f", + orange: "#ec8013", + yellow: "#ffb800", + green: "#079455", + }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, divider: border.light, other: { From 4ebaadbe24549cdb50e77688c260bcc4444aa5ba Mon Sep 17 00:00:00 2001 From: M M Date: Mon, 2 Sep 2024 15:34:01 -0700 Subject: [PATCH 19/23] Use ternary based logic rather than conditional statements for clarity. --- .../src/Pages/Monitors/Home/monitorData.jsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/monitorData.jsx b/Client/src/Pages/Monitors/Home/monitorData.jsx index ee167edb4..2f176bd04 100644 --- a/Client/src/Pages/Monitors/Home/monitorData.jsx +++ b/Client/src/Pages/Monitors/Home/monitorData.jsx @@ -40,16 +40,15 @@ export const buildData = (monitors, isAdmin, navigate) => { ? "0" : (monitor.uptimePercentage * 100).toFixed(2); - if (monitor.uptimePercentage < 0.25) { - percentageColor = theme.palette.percentage.red; - } else if (monitor.uptimePercentage >= 0.25 && monitor.uptimePercentage < 0.5) { - percentageColor = theme.palette.percentage.orange; - } else if (monitor.uptimePercentage >= 0.5 && monitor.uptimePercentage < 0.75) { - percentageColor = theme.palette.percentage.yellow; - } else if (monitor.uptimePercentage >= 0.75 && monitor.uptimePercentage <= 1) { - percentageColor = theme.palette.percentage.green; - } - } + percentageColor = + monitor.uptimePercentage < 0.25 + ? theme.palette.percentage.red + : monitor.uptimePercentage < 0.5 + ? theme.palette.percentage.orange + : monitor.uptimePercentage < 0.75 + ? theme.palette.percentage.yellow + : theme.palette.percentage.green; + } const params = { url: monitor.url, From 6e8334026c6985df02b87f5e33535a56d2b8a02e Mon Sep 17 00:00:00 2001 From: M M Date: Mon, 2 Sep 2024 16:19:56 -0700 Subject: [PATCH 20/23] Add docs. --- Client/src/Pages/Monitors/Home/monitorData.jsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/monitorData.jsx b/Client/src/Pages/Monitors/Home/monitorData.jsx index 2f176bd04..4220fc2c5 100644 --- a/Client/src/Pages/Monitors/Home/monitorData.jsx +++ b/Client/src/Pages/Monitors/Home/monitorData.jsx @@ -27,6 +27,14 @@ const data = { rows: [], }; +/** + * Builds table data for a list of monitors. + * + * @param {Array} monitors - An array of monitor objects containing information about each monitor. + * @param {boolean} isAdmin - Flag indicating if the current user is an admin. + * @param {Function} navigate - A function to navigate to the monitor detail page. + * @returns {Object} The data structure containing columns and rows for the table. + */ export const buildData = (monitors, isAdmin, navigate) => { const theme = useTheme(); @@ -34,13 +42,14 @@ export const buildData = (monitors, isAdmin, navigate) => { let uptimePercentage = ""; let percentageColor = theme.palette.percentage.green; + // Determine uptime percentage and color based on the monitor's uptimePercentage value if (monitor.uptimePercentage !== undefined) { uptimePercentage = monitor.uptimePercentage === 0 ? "0" : (monitor.uptimePercentage * 100).toFixed(2); - percentageColor = + percentageColor = monitor.uptimePercentage < 0.25 ? theme.palette.percentage.red : monitor.uptimePercentage < 0.5 @@ -58,7 +67,7 @@ export const buildData = (monitors, isAdmin, navigate) => { status: monitor.status === true ? "up" : "down", }; - // Reverse checks so latest check is on the right + // Reverse checks so the latest check is on the right const reversedChecks = monitor.checks.slice().reverse(); return { @@ -94,6 +103,3 @@ export const buildData = (monitors, isAdmin, navigate) => { }); return data; }; - - - From c4dafae21e5f626b42e694519bf8e0f922e5c80a Mon Sep 17 00:00:00 2001 From: M M Date: Mon, 2 Sep 2024 19:07:43 -0700 Subject: [PATCH 21/23] Give props more meaningful names. --- Client/src/Pages/Monitors/Home/monitorData.jsx | 10 +++++----- Client/src/Utils/Theme/darkTheme.js | 8 ++++---- Client/src/Utils/Theme/lightTheme.js | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/monitorData.jsx b/Client/src/Pages/Monitors/Home/monitorData.jsx index 4220fc2c5..643327e7e 100644 --- a/Client/src/Pages/Monitors/Home/monitorData.jsx +++ b/Client/src/Pages/Monitors/Home/monitorData.jsx @@ -40,7 +40,7 @@ export const buildData = (monitors, isAdmin, navigate) => { data.rows = monitors.map((monitor, idx) => { let uptimePercentage = ""; - let percentageColor = theme.palette.percentage.green; + let percentageColor = theme.palette.percentage.q4; // Determine uptime percentage and color based on the monitor's uptimePercentage value if (monitor.uptimePercentage !== undefined) { @@ -51,12 +51,12 @@ export const buildData = (monitors, isAdmin, navigate) => { percentageColor = monitor.uptimePercentage < 0.25 - ? theme.palette.percentage.red + ? theme.palette.percentage.q1 : monitor.uptimePercentage < 0.5 - ? theme.palette.percentage.orange + ? theme.palette.percentage.q2 : monitor.uptimePercentage < 0.75 - ? theme.palette.percentage.yellow - : theme.palette.percentage.green; + ? theme.palette.percentage.q3 + : theme.palette.percentage.q4; } const params = { diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index 3b77966cd..f680533f8 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -58,10 +58,10 @@ const darkTheme = createTheme({ border: "#e88c30", }, percentage: { - red: "#d32f2f", - orange: "#e88c30", - yellow: "#ffd600", - green: "#079455", + q1: "#d32f2f", + q2: "#e88c30", + q3: "#ffd600", + q4: "#079455", }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, divider: border.light, diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index 67c2d72e5..cc8b2f226 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -55,10 +55,10 @@ const lightTheme = createTheme({ border: "#fec84b", }, percentage: { - red: "#d32f2f", - orange: "#ec8013", - yellow: "#ffb800", - green: "#079455", + q1: "#d32f2f", + q2: "#ec8013", + q3: "#ffb800", + q4: "#079455", }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, divider: border.light, From ed99748718545b457ed8d49f63ee87bda34ec4a0 Mon Sep 17 00:00:00 2001 From: M M Date: Mon, 2 Sep 2024 19:14:43 -0700 Subject: [PATCH 22/23] Name props according to purpose rather than value. --- Client/src/Pages/Monitors/Home/monitorData.jsx | 10 +++++----- Client/src/Utils/Theme/darkTheme.js | 8 ++++---- Client/src/Utils/Theme/lightTheme.js | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/monitorData.jsx b/Client/src/Pages/Monitors/Home/monitorData.jsx index 643327e7e..1942e5a9c 100644 --- a/Client/src/Pages/Monitors/Home/monitorData.jsx +++ b/Client/src/Pages/Monitors/Home/monitorData.jsx @@ -40,7 +40,7 @@ export const buildData = (monitors, isAdmin, navigate) => { data.rows = monitors.map((monitor, idx) => { let uptimePercentage = ""; - let percentageColor = theme.palette.percentage.q4; + let percentageColor = theme.palette.percentage.uptimeExcellent; // Determine uptime percentage and color based on the monitor's uptimePercentage value if (monitor.uptimePercentage !== undefined) { @@ -51,12 +51,12 @@ export const buildData = (monitors, isAdmin, navigate) => { percentageColor = monitor.uptimePercentage < 0.25 - ? theme.palette.percentage.q1 + ? theme.palette.percentage.uptimePoor : monitor.uptimePercentage < 0.5 - ? theme.palette.percentage.q2 + ? theme.palette.percentage.uptimeFair : monitor.uptimePercentage < 0.75 - ? theme.palette.percentage.q3 - : theme.palette.percentage.q4; + ? theme.palette.percentage.uptimeGood + : theme.palette.percentage.uptimeExcellent; } const params = { diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index f680533f8..008de87db 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -58,10 +58,10 @@ const darkTheme = createTheme({ border: "#e88c30", }, percentage: { - q1: "#d32f2f", - q2: "#e88c30", - q3: "#ffd600", - q4: "#079455", + uptimePoor: "#d32f2f", + uptimeFair: "#e88c30", + uptimeGood: "#ffd600", + uptimeExcellent: "#079455", }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, divider: border.light, diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index cc8b2f226..6688a0ca4 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -55,10 +55,10 @@ const lightTheme = createTheme({ border: "#fec84b", }, percentage: { - q1: "#d32f2f", - q2: "#ec8013", - q3: "#ffb800", - q4: "#079455", + uptimePoor: "#d32f2f", + uptimeFair: "#ec8013", + uptimeGood: "#ffb800", + uptimeExcellent: "#079455", }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, divider: border.light, From d77be4ce7413054d6cfead0b2db62a9d997e65f0 Mon Sep 17 00:00:00 2001 From: M M Date: Tue, 3 Sep 2024 07:41:42 -0700 Subject: [PATCH 23/23] Delete unused component. --- .../Charts/ResponseTimeChart/index.css | 0 .../Charts/ResponseTimeChart/index.jsx | 43 ------------------- 2 files changed, 43 deletions(-) delete mode 100644 Client/src/Components/Charts/ResponseTimeChart/index.css delete mode 100644 Client/src/Components/Charts/ResponseTimeChart/index.jsx diff --git a/Client/src/Components/Charts/ResponseTimeChart/index.css b/Client/src/Components/Charts/ResponseTimeChart/index.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/Client/src/Components/Charts/ResponseTimeChart/index.jsx b/Client/src/Components/Charts/ResponseTimeChart/index.jsx deleted file mode 100644 index fd6c0f41e..000000000 --- a/Client/src/Components/Charts/ResponseTimeChart/index.jsx +++ /dev/null @@ -1,43 +0,0 @@ -import PropTypes from "prop-types"; -import { Stack } from "@mui/material"; -import { BarChart, Bar, ResponsiveContainer, Cell } from "recharts"; -import "./index.css"; - -const ResponseTimeChart = ({ checks = [] }) => { - return ( - - - - - {checks.map((check, index) => ( - - ))} - - - - - ); -}; - -ResponseTimeChart.propTypes = { - checks: PropTypes.array, -}; -export default ResponseTimeChart;