From 118ad6736909c7b791c0fa030a603b70a4305b81 Mon Sep 17 00:00:00 2001 From: sonvir249 Date: Sun, 25 May 2025 15:54:31 +0530 Subject: [PATCH 1/2] Show port monitors with port numbers. --- client/src/Components/Inputs/Search/index.jsx | 5 ++++- client/src/Pages/Maintenance/CreateMaintenance/index.jsx | 2 +- server/db/mongo/modules/monitorModuleQueries.js | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/Components/Inputs/Search/index.jsx b/client/src/Components/Inputs/Search/index.jsx index a3b75161c..2e81dcb2f 100644 --- a/client/src/Components/Inputs/Search/index.jsx +++ b/client/src/Components/Inputs/Search/index.jsx @@ -155,6 +155,7 @@ const Search = ({ renderOption={(props, option) => { const { key, ...optionProps } = props; const hasSecondaryLabel = secondaryLabel && option[secondaryLabel] !== undefined; + const port = option["port"]; return ( {option[filteredBy] + - (hasSecondaryLabel ? ` (${option[secondaryLabel]})` : "")} + (hasSecondaryLabel + ? ` (${option[secondaryLabel]}${port ? `, ${port}` : ""})` + : "")} ); }} diff --git a/client/src/Pages/Maintenance/CreateMaintenance/index.jsx b/client/src/Pages/Maintenance/CreateMaintenance/index.jsx index 714d57f13..f3754c6b0 100644 --- a/client/src/Pages/Maintenance/CreateMaintenance/index.jsx +++ b/client/src/Pages/Maintenance/CreateMaintenance/index.jsx @@ -137,7 +137,7 @@ const CreateMaintenance = () => { const response = await networkService.getMonitorsByTeamId({ teamId: user.teamId, limit: null, - types: ["http", "ping", "pagespeed"], + types: ["http", "ping", "pagespeed", "port"], }); const monitors = response.data.data.monitors; setMonitors(monitors); diff --git a/server/db/mongo/modules/monitorModuleQueries.js b/server/db/mongo/modules/monitorModuleQueries.js index 0ffaaf6f1..4af3f8985 100755 --- a/server/db/mongo/modules/monitorModuleQueries.js +++ b/server/db/mongo/modules/monitorModuleQueries.js @@ -490,6 +490,7 @@ const buildMonitorsByTeamIdPipeline = ({ matchStage, field, order }) => { _id: 1, name: 1, type: 1, + port: 1, }, }, ]; From 8ec6c2325043c1abb4bcfc8551ba9f6854d3cb8f Mon Sep 17 00:00:00 2001 From: sonvir249 Date: Mon, 26 May 2025 21:13:05 +0530 Subject: [PATCH 2/2] Join port number with colon(:) --- client/src/Components/Inputs/Search/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/Components/Inputs/Search/index.jsx b/client/src/Components/Inputs/Search/index.jsx index 2e81dcb2f..86ce57779 100644 --- a/client/src/Components/Inputs/Search/index.jsx +++ b/client/src/Components/Inputs/Search/index.jsx @@ -171,7 +171,7 @@ const Search = ({ > {option[filteredBy] + (hasSecondaryLabel - ? ` (${option[secondaryLabel]}${port ? `, ${port}` : ""})` + ? ` (${option[secondaryLabel]}${port ? `: ${port}` : ""})` : "")} );