From ab221057858751d4610c0a22596f67a997dedfef Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Thu, 2 Nov 2023 14:48:58 +0300 Subject: [PATCH] feat: for uptime, show passing/failing for groups Closes #1434 fix: use total subrows and remove space --- src/components/Canary/CanaryTableColumns.tsx | 13 ++++++++++++- src/components/Canary/table.tsx | 3 --- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/Canary/CanaryTableColumns.tsx b/src/components/Canary/CanaryTableColumns.tsx index 8002d1053..6768ea776 100644 --- a/src/components/Canary/CanaryTableColumns.tsx +++ b/src/components/Canary/CanaryTableColumns.tsx @@ -106,7 +106,18 @@ export function getCanaryTableColumns({ cellClassName: "w-28 overflow-hidden overflow-ellipsis relative" }, enableSorting: true, - cell: ({ getValue }: CellContext) => { + cell: ({ getValue, row }: CellContext) => { + if (row.getCanExpand()) { + const subRows = row.subRows; + const passed = subRows.filter((r) => r.original.uptime.passed).length; + + return ( + <> + {passed}/{subRows.length} + + ); + } + const value = getValue(); if (!value) { return null; diff --git a/src/components/Canary/table.tsx b/src/components/Canary/table.tsx index a8f0cc2bc..42dbb6ed1 100644 --- a/src/components/Canary/table.tsx +++ b/src/components/Canary/table.tsx @@ -14,8 +14,6 @@ import { useSearchParams } from "react-router-dom"; import { HealthCheck } from "../../api/types/health"; import { getCanaryTableColumns } from "./CanaryTableColumns"; import { useCheckSetEqualityForPreviousVsCurrent } from "../Hooks/useCheckSetEqualityForPreviousVsCurrent"; -import { getColumns, makeColumnsForPivot } from "./Columns"; -import { columnObject, firstColumns } from "./Columns/columns"; import { prepareRows } from "./Rows/lib"; import { getAggregatedGroupedChecks } from "./aggregate"; import { getGroupedChecks } from "./grouping"; @@ -132,7 +130,6 @@ export function Table({ groupBy = "canary_name", ...rest }: TableProps) { - console.log({ showNamespaceTags }); const [params, setParams] = useSearchParams(); const sortByValue = params.get("sortBy") || "name";