Skip to content

Commit

Permalink
feat: for uptime, show passing/failing for groups
Browse files Browse the repository at this point in the history
Closes #1434

fix: use total subrows and remove space
  • Loading branch information
mainawycliffe committed Nov 2, 2023
1 parent 0d4c6bb commit ab22105
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/components/Canary/CanaryTableColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,18 @@ export function getCanaryTableColumns({
cellClassName: "w-28 overflow-hidden overflow-ellipsis relative"
},
enableSorting: true,
cell: ({ getValue }: CellContext<HealthCheck, any>) => {
cell: ({ getValue, row }: CellContext<HealthCheck, any>) => {
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;
Expand Down
3 changes: 0 additions & 3 deletions src/components/Canary/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit ab22105

Please sign in to comment.