From 2eb8ec9f9004db68d544c574f7b3bf6f56cfafdb Mon Sep 17 00:00:00 2001 From: schakrad <58915923+schakrad@users.noreply.github.com> Date: Thu, 24 Aug 2023 05:55:31 -0700 Subject: [PATCH] fix: graphs not displaying in metrics UI. (#49) * generated tar ball Signed-off-by: schakradari * Removed the tar from dist and added in the manifests folder Signed-off-by: schakradari * Header change Signed-off-by: schakrad * Added comments and moved the file into Metrics folder and renamed it to client Signed-off-by: schakrad * Modified the documentation for the functions in client.ts Signed-off-by: schakrad * change in framing the comment Signed-off-by: schakrad * Updated tar ball Signed-off-by: schakrad * Adding the applicationNameSpace in code Signed-off-by: schakrad * Tar ball after addition of applicationNameSpace. Signed-off-by: schakrad * code fix for the type error Signed-off-by: schakrad * tar ball regeneration Signed-off-by: schakrad * Converting response to response.json() Signed-off-by: schakrad * Adding dependencies Signed-off-by: schakrad * Final tar ball after adding dependency Signed-off-by: schakrad * Reduce tar ball Signed-off-by: schakrad * Tar ball reduction Signed-off-by: schakrad * extension.js file pushed Signed-off-by: schakrad * tar ball regenerated Signed-off-by: schakrad * Fix for the UI bug Signed-off-by: schakrad * Removed space Signed-off-by: schakrad --------- Signed-off-by: schakradari Signed-off-by: schakrad --- .../resource-metrics-extention/ui/src/Metrics/Chart/Chart.tsx | 4 ++-- .../resource-metrics-extention/ui/src/Metrics/client.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/Chart/Chart.tsx b/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/Chart/Chart.tsx index a697622..739b0c0 100644 --- a/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/Chart/Chart.tsx +++ b/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/Chart/Chart.tsx @@ -189,8 +189,8 @@ export const TimeSeriesChart = ({ chartData?.map((data: any) => { newFilter.push(data.name); }); - if (filterChart?.length > 0) { - setFilterChart({ ...filterChart, [groupBy]: newFilter }); + if (Object.keys(filterChart)?.length > 0) { + setFilterChart({ ...filterChart, [groupBy]: (filterChart[groupBy] || []).concat(newFilter) }); } else { setFilterChart({ [groupBy]: newFilter }); } diff --git a/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/client.ts b/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/client.ts index 1105757..f5621ca 100644 --- a/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/client.ts +++ b/extensions/resource-metrics/resource-metrics-extention/ui/src/Metrics/client.ts @@ -45,4 +45,4 @@ export function getHeaders({ "Argocd-Application-Name": `${argocdApplicationName}`, "Argocd-Project-Name": `${project}`, }; -} +} \ No newline at end of file