From 6113100b9e5d20aa352cc4e60ab637aa2eea2176 Mon Sep 17 00:00:00 2001 From: yadhap Dahal Date: Thu, 5 Dec 2024 10:46:59 -0500 Subject: [PATCH] Send cluster reachability information in JSON object and not in JSON string --- Tombolo/server/controllers/clusterController.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tombolo/server/controllers/clusterController.js b/Tombolo/server/controllers/clusterController.js index f9364163..5f87bdbc 100644 --- a/Tombolo/server/controllers/clusterController.js +++ b/Tombolo/server/controllers/clusterController.js @@ -322,7 +322,14 @@ const getClusters = async (req, res) => { }, order: [["name", "ASC"]], }); - res.status(200).json({ success: true, data: clusters }); + // Parse the JSON string into a JavaScript object + const parsedClusters = clusters.map((cluster) => { + const clusterData = cluster.get({ plain: true }); + clusterData.reachabilityInfo = JSON.parse(clusterData.reachabilityInfo); + return clusterData; + }); + + res.status(200).json({ success: true, data: parsedClusters }); } catch (err) { logger.error(`Get clusters: ${err.message}`); res